o ]Lb!@sddlmZddlZddlmZddlmZmZddlm Z mZm Z m Z m Z m Z mZedZdd d Zdd dZddZddZddZddZdddZdS))absolute_importN)_)hexnullrev)errornodeobsoleteobsutilrevsetscmutilutils\b[0-9a-f]{6,64}\bcsf|jjt|}||krfdd|D}d|}|S|}td}|t||df;}|S)zreturns a string summarizing revisions in a decent size If there are few enough revisions, we list them all. Otherwise we display a summary of the form: 1ea73414a91b and 5 others csg|] }t|qS)rshort.0rtonoder7/usr/lib/python3/dist-packages/mercurial/rewriteutil.py +sz_formatrevs..s, s%s and %d othersr) changelogrlenjoinfirstrr)reporevsmaxrevsnumrevsshortssummaryrrrr _formatrevs s r"rewriteTc Cst|vrtd|}td}tj||dtdd|Dr+|jddd|D}t|dd kr>t td || d |}|r^t ||}td ||f}td }tj||dt ||}|rxtd}tjtd|t|f|d|s|dSt |t jst||} | r| \} } } td|| | f}| | kr|td| 7}|jjr| | kr|td| | f7}|td| | | f7}tj|tddtj|tdddSdS)a&check if revs can be rewritten action is used to control the error message. check_divergence allows skipping the divergence checks in cases like adding a prune marker (A, ()) to obsstore (which can't be diverging). Make sure this function is called after taking the lock. scannot %s the null revisionsno changeset checked out)hintcss|] }t|dVqdS)revN)r safehasattrrrrr Bszprecheck..s-rewriteutil.precheck called with ctx not revscss|]}|VqdSN)r%rrrrr'DsNrs"cannot %s changesets while mergings%ld and public()scannot %s public changesets: %ss see 'hg help phases' for detailss#see 'hg help evolution.instability's7cannot %s changeset, as that will orphan %d descendantss8cannot %s %s, as that creates content-divergence with %ss , from %ss0 changeset %s is a successor of changeset %ss changeset %s already has a successor in changeset %s rewriting changeset %s would create "content-divergence" set experimental.evolution.allowdivergence=True to skip this checksEsee 'hg help evolution.instability' for details on content-divergences@add --verbose for details or see 'hg help evolution.instability')rrr InputErroranyui develwarnrparents StateErrorrr"disallowednewunstabler isenabledallowdivergenceopt_find_new_divergencer%verbose) rractioncheck_divergencemsgr$ publicrevsr! newunstablenew_divergence local_ctx other_ctxbase_ctxrrrprecheck4s         r=cCs(t|tj}|r tS|d||S)zChecks whether editing the revs will create new unstable changesets and are we allowed to create them. To allow new unstable changesets, set the config: `experimental.evolution.allowunstable=True` s (%ld::) - %ld)r r0allowunstableoptr basesetr)rr allowunstablerrrr/sr/cCsR|d|}|D]}t|||}|r&||||d||dfSqdS)Ns%ld and obsolete()rr)rfind_new_divergence_from unfiltered)rrobsrevsrdivrrrr2s &r2cCsl|sdSt||}|r|dd|fSt||}|r4|dd}|dd}|d|fSdS)zreturn divergent revision if rewriting an obsolete cset (ctx) will create divergence Returns (, ) or None Nrsdivergentnodesscommonpredecessor)r r successorssetsr divergentsets)rctxssetdivsetsnsuccsetprecrrrrAs    rAcCs:|dd}|dkr dS|dkrdSttd||f)Nr#sempty-successorsskipTskeepFsf%s doesn't know how to handle config rewrite.empty-successor=%s (only 'skip' and 'keep' are supported))configr ConfigErrorr)r+commandempty_successorrrrskip_empty_successors rPc Cs|si}i}tt|}|}|D]x}zt||}Wn tjy&Yqw|dur,q||}|sB| |} | dur>q| g} n t j || |d} t | dkrt | ddkr| dd} | durut| } ||| dt |}q|jtd|q|jtd|q|S)aReplace all obsolete commit hashes in the message with the current hash. If the obsolete commit was split or is divergent, the hash is not replaced as there's no way to know which successor to choose. For commands that update a series of commits in the current transaction, the new obsolete markers can be considered by setting ``pending`` to a mapping of ``pending[oldnode] = [successor_node1, successor_node2,..]``. N)cacherrsbThe stale commit message reference to %s could not be updated (The referenced commit was dropped) s>The stale commit message reference to %s could not be updated )refindallNODE_RErBr resolvehexnodeidprefixrWdirUnsupportedr getr rErrrreplacer+noter) r commitmsgpendingrQhashesunfihfullnoderG successors successornewhashrrrupdate_hash_refssP    rc)r)r#Tr() __future__rrRi18nrrrrrr r r r r compilerTr"r=r/r2rArPrcrrrrs  $  T