^c%HLdZddlZddlmZddlmZmZmZddlm Z ddl m Z m Z m Z mZmZmZmZmZmZmZmZmZmZmZmZmZmZmZmZm Z m!Z!m"Z"m#Z#m$Z$m%Z&m'Z'dZ(dZ)hd Z*iZ+ej,e+Z,iZ-ej.e-Z.e.d d d dZ/dZ0dZ1dZ2dldZ3ej4Z4e4ddZ5e4ddZ6dZ7GddZ8e,dddgededfdd ged!edfd"d#ged$edfd%d&d'ed(edfd'd)d ed*fd+d,d'ed-ed.fd/d0d ed1fd2d3d'ed4ed5fd6d7d ed8fd'd9d ed:fd;dd?d ed=fd@dAd'edBfd'dCd edDfdEdFd edGfdHdId edJfd'dKd'edLfge j9ze j:ze j;zedMe,j<NdOZ=dPZ>dmdQZ?dRZ@dSZAdTZBdUZCdVZDdWZEdXZFdYZGdZZHd[ZId\ZJd]ZKd^ZLd_ZMd`ZNdaZOdbZPdcZQ dndeZRdfZSdgZTdhZUdiZVdjZWdkZXdS)ozcommand to move sets of revisions to a different ancestor This extension lets you rebase changesets in an existing Mercurial repository. For more information: https://mercurial-scm.org/wiki/RebaseExtension N)_)nullrevshortwdirrev)open) bookmarkscmdutilcommandscopiesdestutil dirstateguarderror extensions logcmdutilmerge mergestate mergeutilobsoleteobsutilpatchphasespycompat registrarrepairrevset revsetlang rewriteutilscmutilsmartsetstateutils-1>-2-3-4-5develrebase.force-in-memory-mergeF)defaultsships-with-hg-corecdS)Nr,./usr/lib/python3/dist-packages/hgext/rebase.py_nothingtorebaser/Ts 1r-c|dd}|||d<|dd}|||d<dSdS)Nsourcesintermediate-source)extraget)ctxr2ss r. _savegraftr6Xse  4((A}i .55A}()$%%%}r-c4||d<dS)Nbranch)branch)r4r2s r. _savebranchr:aszz||E)r-c4tj|d|d|S)zhsmall wrapper around destmerge to pass the right extra args Please wrap destutil.destmerge instead.rebaseF)action sourceset onheadcheck destspace)r destmerge)repor>r@s r. _destrebaserCes-       r-s _destrebasecd}|(tj|tj||}|tjt ||gzSN)rgetsetr fullreposetbasesetrC)rBsubsetxr>s r._revsetdestrebaserKusOI}M$(> ? ? ? ?  /00000r-c|js'tj|jt d|}|jjd|d|_ |d|_ |d|_ |d|_ |d|_ |d|_|d |_|d |_|d |_d S) z"Restore a previously stored statusr<srebase status resumed originalwddestmapstateskippedcollapsekeep keepbranchesexternalactivebookmarkN)rexistsr wrongtooltocontinuerBr_readr[rrjrmr rorprwrxrkrl)rdatas r. restorestatuszrebaseruntime.restorestatuss}##%% A  ' 1Y<< @ @ @zz|| 5666}-J' (^ J' k*'] !/2[) "#45r-c d|_|j}|jJdddtddd}d}i}i} |d}t |D]\}}|dkr|||d<*|dkr|r||}M|dkr|||d<q|d kr tt||d <|d kr tt||d <|d kr tt||d<|dkrt|dkrd|vs||d<| d} || d} | d} | tvrOt| dkr!|| d} n|} | || <| tkr t|| <|| || <|d!t!jt%d||d<||d<t'} |d st'|}t+|D]>\}}|tkr||vr| |||?| |d<|jdddt+| Dpdz|S)NT)rrrrrrrerrr+rrrrQ:rs.hg/rebasestate is incompleterrrscomputed skipped revs: %s  c3 K|] }d|zV dSrNr,.0rs r. z&rebaseruntime._read..Ys&<>cTkkKK$$$ "Z  *yy<z8rebaseruntime._handleskippingobsolete..ds0HHHQ ! 0E0E0G0GHqHHHr-sdescendants(%ld) and not %ld)rwr[rur _compute_obsolete_setsrBrmr{r|rnupdate_checkobsrebaser isenabledallowdivergenceoptrNpop)r obsoleteset skippedsetrs` r._handleskippingobsoletez%rebaseruntime._handleskippingobsolete^sI :  Fw!!/3HII  FHHHH$*HHH  #49k4< H H  7  6DEE $DEEE 47KDDD  di)D E E ,9<D 6 6 6y~~/:: , ,  sD)))   d++++  , ,r-Tc$d|_ ||t|j||_n#t j$r|rWt|jt|j|jj tdYdStd}td}t j ||wxYw|r"|o|j}|||||SdS)NTsFrebase aborted (no revision is removed, only broken state is cleared) rs#cannot continue inconsistent rebases-use "hg rebase --abort" to clear broken statehint)backup suppwarnsr~confirm)rgrrrestorecollapsemsgrBrsrRepoLookupError clearstatusclearcollapsemsgr[warnrrrv_abort)risabortrrr~rmsgrs r._prepareabortorcontinuez%rebaseruntime._prepareabortorcontinuews@  2     ( ( * * *1$)WEED  $ 2 2 2 2DI&&& +++ !!< qq>??IJJk#D1111 2  , F;;#    sAA A%C)45C)c|stSt|j||j}|s5|jt dtS|\|_|_|_ |jrt|j }t|dkr!tjt dtt!|}|jj|gd}t'|j|j ||_t+t| D]T}|j|}|r1|js*|jt d|zU||jst|}|t|jz}||jz}i}t;j|jt:jrddi} |j |5tCj"|j|d dddn #1swxYwYn4#tj#$r"} | j$t d | _$| d} ~ wwxYwd|_%dS) Nnothing to rebase r+s3--collapse does not work with multiple destinationsT) inclusives reopening closed branch head %s )rsevolution.allowdivergencestruer<)r=s&use --keep to keep original changesets)&r/ buildstaterBrpr[statusrrjrmr rnrrQr InputErrornextiter changelog ancestorsexternalparentrkr closesbranchrxrrwkeysr{r|rrcreatemarkersoptconfigoverriderprecheckrrrf) rrmresultrVr destancestorsdest rebaseset overridesrs r._preparenewrebasezrebaseruntime._preparenewrebases &#%% %DIw?? & GNN1344 5 5 5#%% %6<3$, > Q ++--..E5zzQ&LMM4;;''G I/99 T:M+49dj-PPDMc'.."2"23344 O OG9W%D  "" O4+= Oq!EFFMNNN $$&&&z GLLNN++I THII II C CII!$)X-FGG CW  W++I66QQ(IiPPPPQQQQQQQQQQQQQQQ;   6>HIIAF   s<JJ9 JJ  J J  JK J==KcF|jr;ddlm}||j|_|jjdn1|jd|_|jjd|jjdd|j|jdS)Nr)overlayworkingctxsrebasing in memory srebasing on disk r<susing in-memory rebase: %r )rebase_imm_used)r}mercurial.contextrrBwctxr[rlog)rrs r._assignworkingcopyz rebaseruntime._assignworkingcopys = 6 ; ; ; ; ; ;))$)44DI IL  6 7 7 7 7 $DI IL  4 5 5 5   + M M      r-c, ||j|j}}|jr|jdt |jryt}|j D]c}| || t|dkr!tjtdd|jp|j|_|jrt%j|||r||d|j D}|jtdtdt| fd}t/|jD]9}|jd |} | D]}||||: |td dS) Nrr+s'cannot collapse multiple named branchesc.g|]\}}|tk|Sr,)r)rkrs r. z0rebaseruntime._performrebase..s!BBBtq!Q'\\\\\r-srebasings changesets)unittotalcbd||fzdS)N%d:%s)item) incrementr)r4ps r.progressz.rebaseruntime._performrebase..progresss/ KKh#''))S)99K ; ; ; ; ;r-ssort(%ld, -topo)srebase merging completed )r rBr[rxrtinsertr:rprnr rr9rQrrrrl_activebookmarkr deactivaterr makeprogress sortsourcermrN _rebasenodecompletenote) rrrBr[branchesrcandsrrI sortedrevsrs @r._performrebasezrebaseruntime._performrebases& !!!9dgb    M K 0 0 0~ 55:CLLc!1!1!3!34448}}q((#.HII) #1IT5I   '   & & &   !   R BBtz//11BBB G kNN=!1!1U !   < < < < <!.. 4 4F(;VDDJ! 4 4  S(3333 4  /0011111r-c < |j}||}||}|js@|j t j|| fd|jD}|j}||}i}|j ddrd| i}|j D]}|||t|tj} | |j d} |j | d5|jr.t)||j|||||} n't/||||||} | cdddS#1swxYwYdS) zCommit the wd changes with parents p1 and p2. Reuse commit info from rev but also store useful information in extra. Return node of committed revision.Nci|]:\}}|tk||g;Sr,)rnode)rrrcls r. z/rebaseruntime._concludenode..sK&((GGFOObggfoo%6(((r-r<s store-sources rebase_source))sphasess new-commit)uiallowemptycommit)rr2 commitmsgeditoruserra)r2r*r+r,ra)rB descriptionrprrupdate_hash_refsr rrar[rurrtmaxphaserdraftrzrr}commitmemorynoderr, commitnode) rrr+r*rBr4rar2c destphasernewnoder&s @r. _concludenodezrebaseruntime._concludenode s y3i  ))I~ B#4*.**:*:*<*<Iy <88::D 7  i 9 9 2%swwyy1E  A Ac5MMMM V\22 (1.2.F*F  W # #Iy 9 9  } *'!%'! +                  s&AFFFc  |j|j|j}}}||}t|}|j||kr'|t d|zn||jvrHt d|z} |j| |j |n||j vr|j |} | t d|z} n)t|| } t d|| fz} |j| |j |tt|||j |j|j} | |j|<n|j|tkr|t d|z||t|||j |j|j|j \} }}|jrR|j| kr#|jdd|_nfd|d d i}||d 5 t/||| |||j|j n#t2j$r|jrt3jd |jr|t d  t;j|n2#t2j$r tA|tC|wxYwd|_"|#tIj%|| |jt/||| |||j|j YnwxYwdddn #1swxYwY|js|tLk}t;j'|d }t;j(dd|i|}|j)|| *||*|+||}nd}||||j|<|dtY|z||-r%|.t d|zn|js?|.t d|z|j || |j|<|d| zn8|t d|||j|fz|s|/dSdS)Nsalready rebased %s sInote: not rebasing %s and its descendants as this would cause divergence s+note: not rebasing %s, it has no successor s4note: not rebasing %s, already in destination as %s s rebasing %s sresuming interrupted rebase F)r(s forcemergetoolr-r<)rsDhit merge conflicts; rebasing that commit again in the working copy )wceditformsrebased as %s sRnote: created empty successor for %s, its destination already has all its changes sCnote: not rebasing %s, its destination already has all its changes snext revision set to %d salready rebased %s as %s r,)0rBr[rir\r rrr|rorr{r/ adjustdestrmr defineparentsrgrp1rrr3r rebasenoderprInMemoryMergeConflictsErrorr~ConflictResolutionRequiredr bailifchangedrrrr}r mergemodrr mergeeditformgetcommiteditor setparentsr%r7risemptyrr)rrr progressfnrBr[rir4descrsuccsuccdescrr>p2basermergingr;r+r6s r.rzrebaseruntime._rebasenodeFs2DGTY$b3i}} :c?c ! ! IIa/0047 8 8 8 8 D> > >5   GNN3    L  S ! ! ! ! D? ? ?>sCD|GHH4O#DJ//L8$% GNN3    L  S ! ! !4dlDJ MMD#DJsOO Z_ ' ' IIa())D0 1 1 1 JsOOO(   ; LBD{/ ty||~~1133r99 >???# 3TXXfc5J5JK &&y)<<**)"   N!%!<;N"'"B9"M"MM>"" !F "#1$7777${"""'---,T222!"). //111 RTY????"   N!%/***************V> -"0)DD 0KK(KdKK  $$T"X]]__d2hmmooFFF,,S&99""&w-"3"3"5"5 3+eGnn<====((**GGI ~*GG5 L$$S)))"$ 35:;;;; II/00D$tz#:O3PP               sP3N 5 JN AN+L?N/L//ANN NN  N$'N$c |j|j|j}}}|dt j|}||jrjt|t|j |j |j |j |j \}}}|d}d} |jr|j} nDd} t!|j D]+} | |j vr | d|| zz } ,d}t%j|| } t)|j } |j||||j|| | | }|.||}|j D] }||j |< d |vrt9||j |j fi||j |j|j}|d kr|j}|d |dDvr<|tAd tCj"||d}|jr |j#s|}tI|||j |j |j ||j#||j% tM|tO||tAdtQj)|*dd|j r9tW|j }|tAd|z|,|j-rX|j-|j.vrL|d|j.|j-kr t_j0||j-dSdSdSdS)Nr<editsrebase.collapsesCollapsed revisions * %sT)rPr;)r*qtiprc6g|]}|Sr,rrr4s r.rz/rebaseruntime._finishrebase..s ???Q???r-s0update back to initial working directory parent )fmrsrebase completed sundo ignoremissings%d revisions have been skipped .)1rBr[ri formatterrrr startitemrpr=minr rmror{r3rsrr-r rEr/rrFr%rkr7rtagsupdatemqrjparentsrrrCrrw clearrebasedrvrrr! unlinkpathsjoinrQendrl _bookmarksractivate)rrBr[rirUr>rL_baseeditoptr;r*rebasedr+ revtoreuser6rrnewwd collapsedas skippedlens r. _finishrebasezrebaseruntime._finishrebasesDGTY$b \\)X%9$%?%? @ @  > 0)DJ   ; MBEhhv&&G)H  , 1 %dj11MMGdl22!Yg1J1J1L1L%LL ,'HMMMFTZJ I b$t}2E2J2J2L2L M M M((Fi)G"g**,,"j00F)/DJv&& diikk ! ! T4:t| < *>??? ? ? GGAJKK L L L ODK ( ( ( > "$* "!K   L J L  J<  D '(()))  7++4@@@@ < IT\**J GGA9::ZG H H H    :#t66T !!T_T5H%III  tT%8 9 9 9 9 9  : :66IIr-cZ j fdjD} fd|D}d}|rZ jt dd fd|Dzt dd }t}|r't j |}|t|z r) jt d d }|r|r d d |D} t|} | j |s|s| j d | v} | rt!j j|rt%j j | |jr(j jvrt-j jt1 t3 |s' jt dnM#t1 t3 |s( jt dwwxYwdS)z-Restore the repository to its original state.cTg|]$\}}|dk ||k|j|k"|%Sr)rm)rrr5rs r.rz(rebaseruntime._abort...sHAq66a1ffdl1o)=)=)=)=)=r-cHg|]}||Sr,)mutable)rrrBs r.rz(rebaseruntime._abort..3s,EEEq47??3D3DEEEEr-Ts-warning: can't clean up public changesets %s , c3BK|]}t|VdSrEbytesrrrBs r.rz'rebaseruntime._abort..8s- C CAtAw C C C C C Cr-s see 'hg help phases' for detailsrFsDwarning: new changesets detected on destination branch, can't strip c6g|]}|Sr,)r%rTs r.rz(rebaseruntime._abort..Ks-###%&###r- roots(%ld)rXrsrebase aborted r)rBr rr[rrrrnr descendantsrrmrrrjrrC clean_updaterstriprlrcrrdrr) rrrr~rrg immutablecleanuprz strippointsupdateifonnodes shouldupdaterBs ` @r.rzrebaseruntime._abort%sy= 5  J,,..G FEEEGEEEIG  GHHjj C C C C C C CCCD>??  %%K G!$."<"t':do'M'M"4)<===     T " " " 5 Q233444     T " " " 5 Q2334444 5qs H IA J()FFNrE)TFFF)__name__ __module__ __qualname____doc__rpropertyrBrrrrrrrr r"r7rrlrr,r-r.r^r^sB<</@/@/@/@bX % % % %111,666$KKKZ,,,4LQ    D222h   +2+2+2Z::::xLLL\O:O:O:bBBBBBBr-r^r<sr1s5rebase the specified changesets and their descendantssREVbsbases=rebase everything from branching point of specified changesetrsrevsrebase these revisionsddestr-s#rebase onto the specified changesetrscollapse the rebased changesetsmsmessages#use text as collapse commit messagesTEXTesedits invoke editor on commit messageslslogfiles&read collapse commit message from filesFILEkrskeep original changesetsrskeep original branch namesDsdetachs (DEPRECATED)is interactivettoolsspecify merge toolsstopsstop interrupted rebasecscontinuescontinue an interrupted rebaseasabortsabort an interrupted rebases auto-orphanssLautomatically rebase orphan revisions in the specified revset (EXPERIMENTAL)s>[[-s REV]... | [-b REV]... | [-r REV]...] [-d REV] [OPTION]...) helpcategoryc *|dd}tj|ddd}|r0tj||ddgtj||gdtj|ddtj|d d d |s|d }|dr|t |dhz }tj|d|t||d}tj d|g|d <d|d<|ds|drt||||S|dkr?t||}| 5|5||jr!t#jt'dt)j|t(j}|js2|s0t#jt'dt'dt1j||j| d d d d d d dS#1swxYwYd d d d S#1swxYwYd S|r ddi} || d5t;|||||cd d d S#1swxYwYd S#t"j$rn|ddr|t'dtA|tC|t;||||d cYSwxYwt;||||S)aumove changeset (and descendants) to a different branch Rebase uses repeated merging to graft changesets from one part of history (the source) onto another (the destination). This can be useful for linearizing *local* changes relative to a master development tree. Published commits cannot be rebased (see :hg:`help phases`). To copy commits, see :hg:`help graft`. If you don't specify a destination changeset (``-d/--dest``), rebase will use the same logic as :hg:`merge` to pick a destination. if the current branch contains exactly one other head, the other head is merged with by default. Otherwise, an explicit revision with which to merge with must be provided. (destination changeset is not modified by rebasing, but new changesets are added as its descendants.) Here are the ways to select changesets: 1. Explicitly select them using ``--rev``. 2. Use ``--source`` to select a root changeset and include all of its descendants. 3. Use ``--base`` to select a changeset; rebase will find ancestors and their descendants which are not also ancestors of the destination. 4. If you do not specify any of ``--rev``, ``--source``, or ``--base``, rebase will use ``--base .`` as above. If ``--source`` or ``--rev`` is used, special names ``SRC`` and ``ALLSRC`` can be used in ``--dest``. Destination would be calculated per source revision with ``SRC`` substituted by that single source revision and ``ALLSRC`` substituted by all source revisions. Rebase will destroy original changesets unless you use ``--keep``. It will also move your bookmarks (even if you do). Some changesets may be dropped if they do not contribute changes (e.g. merges from the destination branch). Unlike ``merge``, rebase will do nothing if you are at the branch tip of a named branch with two heads. You will need to explicitly specify source and/or destination. If you need to use a tool to automate merge/conflict decisions, you can specify one with ``--tool``, see :hg:`help merge-tools`. As a caveat: the tool will not be used to mediate when a file was deleted, there is no hook presently available for this. If a rebase is interrupted to manually resolve a conflict, it can be continued with --continue/-c, aborted with --abort/-a, or stopped with --stop. .. container:: verbose Examples: - move "local changes" (current commit back to branching point) to the current branch tip after a pull:: hg rebase - move a single changeset to the stable branch:: hg rebase -r 5f493448 -d stable - splice a commit and all its descendants onto another part of history:: hg rebase --source c0c3 --dest 4cf9 - rebase everything on a branch marked by a bookmark onto the default branch:: hg rebase --base myfeature --dest default - collapse a sequence of changes into a single commit:: hg rebase --collapse -r 1520:1525 -d . - move a named branch while preserving its name:: hg rebase -r "branch(featureX)" -d 1.3 --keepbranches - stabilize orphaned changesets so history looks linear:: hg rebase -r 'orphan()-obsolete()' -d 'first(max((successors(max(roots(ALLSRC) & ::SRC)^)-obsolete())::) + max(::((roots(ALLSRC) & ::SRC)^)-obsolete()))' Configuration Options: You can make rebase require a destination if you set the following config option:: [commands] rebase.requiredest = True By default, rebase will close the transaction after each commit. For performance purposes, you can configure rebase to use a single transaction across the entire rebase. WARNING: This setting introduces a significant risk of losing the work you've done in a rebase if the rebase aborts unexpectedly:: [rebase] singletransaction = True By default, rebase writes to the working copy, but you can configure it to run in-memory for better performance. When the rebase is not moving the parent(s) of the working copy (AKA the "currently checked out changesets"), this may also allow it to run even if the working copy is dirty:: [rebase] experimental.inmemory = True Return Values: Returns 0 on success, 1 if nothing to rebase or there are unresolved conflicts. r<sexperimental.inmemoryabortstopcontinuerdry_run)rsourcerMrrrrMNF auto_orphanss%ld and orphan()s_destautoorphanrebase(SRC)rs!cannot stop in --collapse sessions<cannot remove original changesets with unrebased descendantss^either enable obsmarkers to allow unstable revisions or use --keep to keep original changesetsrrr<singletransactionT)r}r'r(s?hit merge conflicts; re-running rebase without in-memory merge )"rur check_at_most_one_argcheck_incompatible_argumentscurrenttransactionr3rnlistrNr formatspec _dryrunrebaser^wlocklockrrprrRrrrallowunstableoptrwrCr{rjrlr _dorebaser@rrr) r[rBrir}r=disallowed_optsuserrevsrbsrt allowunstablers r.rebaserjsx}}Y(@AAH  *4&* M MF  , &9i0    , &;;;    !$ 9=== !$x@@@ ((**6 xx5d))~&66, ./    $((>":":;;<<!,-@(KKLU 4V  xx .1dhhy11.1Rvt444 6  dB'' ZZ\\  499;;      ! ! ! P&q)M'N'NOOO$.tX5NOOMK = &2&      !$u'7"8 9 9 9    ! ! !+                                        , 1 E;DAI""9i88 L L T64(KKK L L L L L L L L L L L L L L L L L L0 E E E}}X'FGG  GG         T " " "RvteDDD D D D ET64000snJ+2C J; J+J J+J J++J/2J/;LK6) L6K::L=K:>LA:N?Nc $t||dd|}|d}|r#|tdn"|td|5|5d} ddi}||d5t|||||}|tkrVd}|cddd|r,| ddd|d  cdddcdddS dddn #1swxYwY|ru|td | td s| n| ddd| d}n"|td |r,| ddd|d  dddddddS#tj $rj|tdY|r,| ddd|d  dddddddStj$rd}wxYw#|r-| ddd|d  wwxYw#1swxYwYddddS#1swxYwYdS)NT)r}r~rirsstarting in-memory rebase s8starting dry-run rebase; repository will not be changed rr<Fr)rrrr~srebase completed successfully s!apply changes (yn)?$$ &Yes $$ &No)rrrrsWdry-run rebase completed successfully; run without -n/--dry-run to perform this rebase rshit a merge conflict r+)r^r3rrrrr _origrebaser/r promptchoicerlrrAr) r[rBr=rirr needsabortrress r.rrss $T$T J J JEhhy!!G  !2334444 J K K    33tyy{{33 1 :DAI""9i88  ! *,,,,!&J       P --  "88I.. .]333333333333333-               $  !>??@@@q)M'N'NOO ''))))11 $$"& ' 2 #  B  --  "88I.. .]33333333333333/    IIa122 3 3 36 --  "88I.. .]33333333333333${   J  4 --  "88I.. . Y33333333333333333333333333sLK-H,8)E! H,-.K- L5 H,E H,E H, BJ9&.K- L,1J6J9.K- L$J66J991K**K--K1 1L4K1 5LL  L cNt||||}t|||||S)N)ri)r^r)r[rBr=rir}rs r.rrs. $H4 8 8 8E r4u 5 55r-c|dksJ|5|5|drU tjdrd}n#t $rd}YnwxYwd|z}t d|z}tj||j r(|j s!tjt d|r|j r!tjt d |d kr8|d d r"| t d |dkr3tj |}tj|||d k} | | cdddcdddSn|d} t%|||j|dd|dg|dg|dg| } || } | | cdddcdddSt+||j d} |dd} | r|d} t1j| 5d}| r|jst5j|d}t1j|5|| |js|dddn #1swxYwYdddn #1swxYwYdddn #1swxYwYddddS#1swxYwYdS)Nr interactiveshisteditr-s --config extensions.histedit=shg%s help -e histeditsOinteractive history editing is supported by the 'histedit' extension (see "%s")s+message can only be specified with collapses*cannot use collapse with continue or abortrr9Fstool option will be ignored rr _destspacerrrMrr@r<r)rrr3rfindKeyErrorrrrrsrpr mergestatemodrrrcheckunresolvedr_definedestmapr}rstorecollapsemsgru transactionr!acceptinterventionr r"r~rl)r[rBr=rirenablehistedithelprmsretcoder@rmrsingletrdsguards r.rrsg V     I*I*tyy{{I*I* 88M " " ( C?;//)%(N C C C!B C+nL; ?M M&M M&M M&&M*-M*c v |g}tj|stj|ddr2|s0t jt dt dd}|r=tj|} | s$| t ddSn|rTtj|} | s$| t ddS d | | } ntj|pd g} | s$| t d dS|rtj |}n't| | }t|}g} i} | D]Z} d ||}| |g|gz| |<[d| vr| | D],\}}| t' d||z } - d| } | sRt'| |gkrL|r'| t d|zn| t dnމ d| |so|rG| t ddfd| D|fznl| t d|znF| t ddfd| D|fzdSt*| vr!t jt dd | v}|dd|||r*|r(tjtj|s't| | }t|}t/jd| }d|i}| t3j ||}n#tj$ri}| D]}t/jd ||d!<|gd"|#}t9|}|d$kr|||<`|d%kr,|t d&|zt jt d'|zYnwxYw|"|fd(| D}|s$| t d)dS|S)*z:use revisions argument to define destmap {srcrev: destrev}Ncommandsrebase.requiredestsyou must specify a destinationsuse: hg rebase -d REVrs-empty "rev" revision set - nothing to rebase s0empty "source" revision set - nothing to rebase s(%ld):: + (%ld)rXs5empty "base" revision set - can't compute rebase set rsancestor(%d, %d)schildren(%d) & ancestors(%ld)s%ld::s6nothing to rebase - %s is both "base" and destination sAnothing to rebase - working directory parent is also destination s %ld - ::%dsGnothing to rebase - "base" %s is already an ancestor of destination %s +c3BK|]}t|VdSrErtrvs r.rz!_definedestmap..]s-$B$BU47^^$B$B$B$B$B$Br-sVnothing to rebase - working directory parent is already an ancestor of destination %s s nothing to rebase from %s to %s c3BK|]}t|VdSrErtrvs r.rz!_definedestmap..ks- > >AtAw > > > > > >r-scannot rebase the working copyr<s!rebasing working copy parent: %r )rebase_rebasing_wcps%ldsALLSRC) localaliasrsSRCT)r,rr+rs skipping %s - empty destination s'rebase destination for %s is not uniqueci|]}|Sr,r,)rrrs r.r'z"_definedestmap..s111!1g111r-s&nothing to rebase - empty destination )r checkunfinishedrBrurrrrrevrangerrN revsinglerCrurrOr3clearrrrrr rrrranyrevsrQr)r[rBr}destfsrcfbasefrevfr@rrrUrMrootsbpbasebbpbs rebasingwcpallsrcaliasrmrdestsetsizers ` @r.rrs |  D!!! $d### }}["788   / 0 0+,,    D T'd33   IIaIJJ K K K4  O!$--  IIaLMM N N N4II0#s;; "44&99  IIOPP   4  'e44DD D$)DDDED$KKE 2 2A.488::>>DDFFBB++qc1F2JJ 6>> LLNNNllnn O OFB T$))$Db"MMNN NEEIIh.. , Dzzdhhjj\))II2 II< YY}dDHHJJ?? II$  99$B$B$B$BT$B$B$BBBDI JII<   :;;yy > > > > > > >>>EF4)q!BCCDDDt*..""i/KFF-'   $K$%%%d### Ki9EEEFd   "69 5 5F  E | $T5UCCCDD$   G   * 5eQ ? ?f ,,wTe,LL7||199!(GAJJQYYGGABCCd1gMNNNN*DEEQO   $ ((**1111y111  !>??@@@t NsRCU,+U,c Nt}t|}|D]y}||kr ||D]U}||vr=||vr'||Vz|st St |dkr|Stj tdt|d dt|Dfz)zReturn the revision that should be used as the second parent when the revisions in state is collapsed on top of destancestors. Abort if there is more than one parent. r+sKunable to collapse on top of %d, there is more than one external parent: %srrc3 K|] }d|zV dSrr,rrs r.rz!externalparent..s&)M)M%!))M)M)M)M)M)Mr-)rnr[r^rrrrQrrrRrr/rr)rBr rr^rrrs r.rrs% eeG ZZF%% &== c""$$ % %Auuwwe##}(D(D AEEGG$$$ %  7||q{{}}    ,   }  uzz)M)MVG__)M)M)MMM N  O  r-c4d}d|vr|d}||||||||}|r|jddsdS||} || S)zXCommit the memory changes with parents p1 and p2. Return node of committed revision.Nr8)rar2r,r9r+r(r))_compacttomemctxrGr[ru commitctxclean) rBrr+r2r,rar*r9memctx commitress r.r2r2s FEy!  MMOOO ]]   F~~ 2 25:M N Ntv&&IJJLLL r-c\tj}|jddst j|d}|5||||||}|j|||cdddS#1swxYwYdS)zTCommit the wd changes with parents p1 and p2. Return node of committed revision.r<r)textr,rar2r+N) r!nullcontextmanagerr[rur commitdirstate setbranchr9)rBr+r2r,rar*rr6s r.r3r3s%''G 7  i)= > >?-dI>> ++Df   W 4 4 6 6777sAB!!B%(B%c ||}|r||n|d|kr4|jd||fzt j|n|jd|d}|j| ||}|jd||fz|%|jd|||fz|j | | } t j ||dd|| gd| } || || |rtj|||n(tj|||| jd kr;|rt'jt'jd dS) zFRebase a single revision rev on top of p1 using base as merge ancestorrXs update to %d:%s s already in destination Ns merge against %d:%s s detach base %d:%s T)rr1sparent of source) branchmergeforceancestor mergeancestorlabelsr:rr<) isinmemorysetbaserr[rrCr{rrrr isancestorr%_updaterFr graftcopiesr>unresolvedcountrr@rA) rBrr>rLrMr`rp1ctxr4rstatss r.r?r?s  HE  7 U :>>  r ! ! GMM/2u+= > > >  !% ( ( ( ( GMM6 7 7 7Dz D3355666 s)CGMM+sCj8999   /4d2DDEEEN--ejjllCHHJJGGM    #888    E OOEJJLL$r(--//22204e,,,, 4cffhh/// q  ??   >355 529== = ! r-c | fd|D}g}|j|D]} }|tkr3|d||} | || }| kr. |vr*| }|t krtjd z| ||S)aadjust rebase destination given the current rebase state rev is what is being rebased. Return a list of two revs, which are the adjusted destinations for rev's p1 and p2, respectively. If a parent is nullrev, return dest without adjustment for it. For example, when doing rebasing B+E to F, C to G, rebase will first move B to B1, and E's destination will be adjusted from F to B1. B1 <- written during rebasing B | F <- original destination of B, E | | E <- rev, which is being rebased | | | D <- prev, one parent of rev being checked | | | x <- skipped, ex. no successor or successor in (::dest) | | | C <- rebased as C', different destination | | | B <- rebased as B1 C' |/ | A G <- destination of C, different Another example about merge changeset, rebase -r C+G+H -d K, rebase will first move C to C1, G to G1, and when it's checking H, the adjusted destinations will be [C1, G1]. H C1 G1 /| | / F G |/ K | | -> K | C D | | |/ | | B | ... |/ |/ A A Besides, adjust dest according to existing rebase information. For example, B C D B needs to be rebased on top of C, C needs to be rebased on top \|/ of D. We will rebase C first. A C' After rebasing C, when considering B's destination, use C' | instead of the original C. B D \ / A cFg|]\}}|dk |k|v|Sror,)rr5rrrmros r.rzadjustdest..TsH Aq q55WQZ4''AW,<,< ,<,<,.ys-FFU47^^FFFFFFr-s+this rebase will cause divergences from: %ssJto force the rebase please set experimental.evolution.allowdivergence=True,rN)rrrrrrRr) rBr[ rebaseobsrevsrebaseobsskipped divergenceokdivergencebasecandidates divhashesrhs ` r.rrls%dH,GHHL,/??F FFFFF-EFFF >??  ;  sdii &:&:%<<1EEEEFFFFr-c#K|jJ|jjj}t j|j||gD]}||}||VdS)z,yield revision numbers for successors of revN)rrindexget_revr allsuccessorsobsstorer%)rSrrr5rs r. successorrevsrsv ? " " "n"*G  "4=49>>3C3C2D E E GAJJ =GGGr-c  jJjj|}j}ttgt |||t |}td|ddDr dd<nt|D]\} | } tfdt| Dr } n| |vr|| dkr|| } tdD]T\} } | tkr| | rt} %| | r#| | <t} ||| c|| <|<U| <ʼndtkrb|ddkrPtdkrt|dksJ | tt|kr0|vr,tjt!dfztfdDr!tjt!d t#fd t|Ddkrddg} t|D]\}|tks|vrt||hz }t d |||}|rVfd |D}fd |D}t d|||| <td| Drt)dt| D\}|dkr[t!dfd| D}tjt!d|fzdkr?tkrdcd<<||dc|d<|<|d}jdt1zdd|fS)aReturn new parents and optionally a merge base for rev being rebased The destination specified by "dest" cannot always be used directly because previously rebase result could affect destination. For example, D E rebase -r C+D+E -d B |/ C will be rebased to C' B C D's new destination will be C' instead of B |/ E's new destination will be C' instead of B A The new parents of a merge is slightly more complicated. See the comment block below. Nc3,K|]}|tkVdSrErrs r.rz defineparents..s& + +A1< + + + + + +r-r+rc3<K|]}|VdSrEr,)rrJrVrrs r.rz defineparents..s3KKq::aq**KKKKKKr-rs>cannot rebase %d:%s without moving at least one of its parentsc3FK|]}|tko |VdSrEr)rrrrs r.rz defineparents..s8 > >11< .JJsA.. > > > > > >r-!source is ancestor of destinationc3:K|]}|tk |vdVdS)r+Nr)rrnewpss r.rz defineparents..s/ D DALLQe^^1^^^^ D Dr-s(%ld %% (%d+%d))c.g|]\}}|dk |v|Sror,)rrr obsskippeds r.rz!defineparents..s6!Q1q55Qj=P=PA=P=P=Pr-c\g|](}|dtk&|)S)r+)rr)rrr&s r.rz!defineparents..s;BMM!,<,.s'55Dt4555555r-c3BK|]\}}|t||fVdSrE)rQ)rrrNs r.rz defineparents.. sBAt#TA####r-s or c3^K|]'}|dfd|DV(dS)Nrrc32K|]}d||fzVdS)rNr,rvs r.rz*defineparents...+s0"I"Iq8q$q'l#:"I"I"I"I"I"Ir-)r)rrNrBs r.rz defineparents..*sV + "I"I"I"ID"I"I"III++++r-s4rebasing %d:%s will include unwanted changes from %ss future parents are %d and %d )rr isancestorrevrrr<rallranyrrQreversernrrrsumrNrr[rr[rtuple)rBrrmr ror"roldpsbasesrnpjrJunwantedrM other_basessiderevsrmergesr unwanteddescr&rVrrr s`` ` @@@@@r.r=r=s] ? " " " B!J 3 > > > > > > >>>Hq!EFFGGG" D D D Dc%jj D D DDDqHH$< ''  GAtw$%--e**v-K -{D$GGH  "'++-- (#II.&) 55H555 5 5 8(22DAq1uu zz$,   &MNNDI|45Avv8w&&).q58&E!HeAh%*1XuQx"a%( 8DGMM4uU||CDDD 8U1Xt ##r-ctj|jj|}t jt |dD]}|drdSdS)z/Return true if the given patch is in git formatsrbs diff --gitTF)ospathrmqr linereaderr startswith)rB patchnamemqpatchlines r. isagitpatchr@Fsdgll47<33G gu!5!566 ??= ) ) 44  5r-c  i}|j jdd}t jD]}||j}||vrD|jd||jfz|jt||jf||<i |j|r || t|dD]}||vro||\}} |jtd||||||fz |d|| d||zgu ||d  fd |D} | jdd<d _ dSdS) z9Update rebased mq patches - finalize and then import themNs.revision %d is an mq patch (%s), finalize it. T)r+supdating mq patch %s to %d:%s r,r)r=gitrrcZg|]'}j|ddv%|(S)r+r)guard_rer)rr5r:skippedpatchess r.rzupdatemq..{sE   {  A&&q)?? ???r-)r: fullseriesrnappliedr%rr[rnamer@rfinishrrrrqimport seriesdirty savedirty) rBr rorimqrebaseoriginal_seriesrrrHisgit newseriesr:rEs @@r.r]r]OsH BmAAA&OUUN Z ' '16l   %<< GMMB-    V[qv%>%>?HSMM   qv & & & &  $ ((((D111 5 5C'!!&sm e 899U3ZeCj)9:; "s+, ""8C=#34444      $   % aaa A  r-c|pd}|dd}|d|z|dS)z,Store the collapse message to allow recoveryr-last-message.txtrrN)rrclose)rBrsrs r.rrsH$K $d++AGGGk !"""GGIIIIIr-c>|jdddS)zRemove collapse message filerRTrVN)rr`)rBs r.rrs$H+4@@@@@r-c |d}|}|n6#t$r)|rd}n!t jtdYnwxYw|S)z*Restore previously stored collapse messagerRr-s'missing .hg/last-message.txt for rebase)rreadliner|rSFileNotFoundErrorrrr)rBrrrss r.rrs M HH( ) )jjll((**   MMM  MKK+a JKKLL L KM sAA0BBc|}|r|d|jdddS)zRemove the status filesreTrVN)rremovefilegeneratorrr`)rBrs r.rrsR  " "B / ~...Hd;;;;;r-c#Kt|}|rrt|}g}|D]!}|||vr||"|s!tjt d|t|z}|V|pdSdS)ayield source revisions in an order that we only rebase things once If source and destination overlaps, we should filter out revisions depending on other revisions which hasn't been rebased yet. Yield a sorted list of revisions each time. For example, when rebasing A to B, B to C. This function yields [B], then [A], indicating B needs to be rebased first. Raise if there is a cycle so the rebase is impossible. s#source and destination form a cycleN)rnrrrrr)rmsrcsetsrclistrrs r.rrs\\F  .. ! !Aqz'' a    N"1%K#L#LMM M#f++       r-cj|}d}dvr]fdjjD}t ||zr!tjtdtt|}|s!tj tdtd|d}|s!tj tdd}t|| }t|t t#|d k} |D]Z} || } | | } | | kr!tj td | | krԉd } | | kr+| | k}n*| | k}|s]|r[| | vrE| | <jd 9d} jd| | fz\| rd StD]H}dj|D}|r t5fd|Dr||<I||fS)zlDefine which revisions are going to be rebased and where repo: repo destmap: {srcrev: destrev} rXrQcNh|]!}|j"Sr,)r%r)rr5rBs r.rzbuildstate..s+AAAAT!&\%%''AAAr-s&cannot rebase onto an applied mq patchsno matching revisionsrxrc*|SrErS)rs r.revofzbuildstate..revofsuuwwr-)keyr+rNs!source is a child of destination Fs rebase onto %s starting from %s c(g|]}|tk |Sr,rrs r.rzbuildstate..sMMMW 1 r-c3JK|]}||kVdSrE)r3)rrr s r.rzbuildstate..s2??!EIIaLLA-??????r-)rrr\r:rGrnrrrRrrrrrdictfromkeysrrQrr>r9r^r[rrrr))rBrmr`rrj mqapplied sortedsrcrr` emptyrebaserootr commonbaser samebranchrr^r s` @r.rrs  Id!!J $))++AAAAAAA w~~ 9 , Q"1%N#O#OPP PZ(())I <q!9::;;; -166 7 7E <q!9::;;; 5e $ $ $E MM)W - -Ei..A%KKKGDHHJJ'(]]4((   "1%I#J#JKK K   :Dtwwyy  ![[]]dkkmm; ![[]]dkkmm;    tt||~~/E/E%)HHJJdhhjj! CDDD   :dD\IJJJJte}}MMdn77<<MMM  s????w???@@ E#J w %%r-Tc |jj} i} i} tj|tj } g} t |D]v\}}|dkrk||kre| |}|p | |}|| |<d}||vr| s||sd}n|r| |n|f}||| |f<w| r|f| t| <|r|j |j }|j }i}| D]/\}}|D]'}|fd|Dd||<(0||dd }| | |ri} tj|| d | | dS) a~dispose of rebased revision at the end of the rebase If `collapsedas` is not None, the rebase was a collapse whose result if the `collapsedas` node. If `keepf` is not True, the rebase has --keep set and no nodes should be removed (but bookmarks still need to be moved). If `backup` is False, no backup will be stored when stripping rebased revisions. rNr,c&g|] }|Sr,r,)rnhfs r.rz clearrebased..;s!'<'<'**+ ) Z ] ]'--// L LKE4 L L$&B'<'<'<'._dummy_sr-rr)startrrXrs%nothing to rebase - updating instead Nr9s%--tool can only be used with --rebase)r3rurrrrrrr rrBrQr postincomingrrrNrNoMergeDestAbortr destupdaterrr)origr[rBrrirr revsprepullorigpostincomingrret revspostpullr@r_a_bs r. pullrebaserCs xx>, ==&; < < 3CDDCABBD"3T222 2 ZZ\\4 24 2499;;4 24 2xx!! N)  #DD 9 9 9 9  !B    d))K'4    %+H ! 9d2t3d333d33(8%%(8%8888t99Lk))D==U t##X !4!4;!4!G!GHH %.\" 22t,,t,,,,- 2 2 2"*"5d";";KCRd4jnn.... !$:";";<<<< !$M"N"NOOO!D111 2W4 24 24 24 24 24 24 24 24 24 24 24 24 24 24 24 24 24 24 24 24 24 24 24 24 24 24 24 24 24 2l 88F   P"1%M#N#NOO Od2t+d+++d++ Jsu5I/ BI D6) I6EAIF'&I'BI II  I I/I I/I I//I36I3c i}t}|j}|jj t|d}|D]}||}tt j|j|g} | | fd| D} | d| r| |rd||<|} | D]} | | | r| ||<n5 ||vstfd| Dr||||fS)aiFigure out what to do about about obsolete revisions `obsolete_with_successor_in_destination` is a mapping mapping obsolete => successor for all obsolete nodes to be rebased given in `rebaseobsrevs`. `obsolete_with_successor_in_rebase_set` is a set with obsolete revisions, without a successor in destination, that would cause divergence. s extinct()c&h|] }|Sr,r,)rr5rs r.rz)_compute_obsolete_sets..s!3331GGAJJ333r-Nc3 K|]}|vV dSrEr,)rr5rms r.rz)_compute_obsolete_sets..s'/O/OW /O/O/O/O/O/Or-)rnrrrrNr%rrrremovediscardissubsetr(r*r)rBr rmr{r|r& extinctrevssrcrevsrcnode successorssuccrevsdstrevsuccrevrs ` @r.rrs.0*,/EE) BhGdii --..KFF''&//.t}wiHHII '"""3333 333 FX..{;; F=A 26 : :V_F# F F##GV44EL:6BE[((C/O/O/O/Oh/O/O/O,O,O(9==fEEE /- r-c|5|5t||}|ddddn #1swxYwYddddS#1swxYwYdS)NTr)rrr^r)r[rBrs r. abortrebasers 44tyy{{44dB'' %%d%333444444444444444444444444444444444s4A5'A A5A! !A5$A! %A55A9<A9c|5|5t||}tj|}t j||d}||cdddcdddS| d| dddn #1swxYwYddddS#1swxYwYdS)NFr) rrr^rrrrrrr"rl)r[rBrrrs r.continuerebasers tyy{{dB''  % * *4 0 0!"%%%///>>    T""" sAC-AC C- )C C-C C-C C--C14C1c b|jdsdS t||i}||j}n:#t j$r(td}||YdSwxYwtd| D}|td| tdd|z| tddt||z zfzdS) Nres8rebase: (use "hg rebase --abort" to clear broken state) cg|] }|dk| Sror,)rrs r.rzsummaryhook..s:::A166a666r-s#rebase: %s, %s (rebase --continue) s %d rebasedsrebase.rebaseds %d remainingsrebase.remaining) rrr^rr rrrrrQrlabel)r[rBrr r numrebaseds r. summaryhookrs8 8??> * *dB++    LMM    :::::;;JHH 122 HHQ}%%'8 9 9J F HHQ'')< = =5zzJ& (  s,A 3BBctjtjdt}|ddddt df|ddddt dftj dttj dd d d tt dS) Nspullr+r-r<s'rebase working directory to branch headrrsspecify merge tool for rebasereT)fnamestopflag continueflag abortfunc continuefunc)r wrapcommandr tablerrrr summaryhooksrrr addunfinishedrr)r[entrys r.uisetuprs  "8>7J G GE !HOO iq!KLLM !HOOT7C+K)L)LMNNN Y 444 # r-rE)F)NFNT)Yrr8mercurial.i18nrmercurial.noderrrmercurial.pycompatr mercurialrr r r r r rrrrrCrrrrrrrrrrrrrrrr rr!rrrcmdtablerY configtable configitem testedwithr/r6r:rCrevsetpredicaterKrWr\r^ dryrunopts formatteropts confirmoptsCATEGORY_CHANGE_MANAGEMENTrrrrrrr2r3r?r<rrr=r@r]rrrrrrr_rrrrrrr,r-r.rs;  $#####B   ,++  ) H % % !Y !+ . .  # #    ***$$$    ,)+--   E E!  E)**##+*#,F F F F F F F F R      AF G G AfII      AN O O AfII   vr116776C    A4 5 5 AfII   k5!!$F"G"GH    A4 5 5 AgJJ   wqq!DEEF    A7 8 8 AgJJ   wqq!<==> ouaa(E&F&FG y%?!3!34 ~uaa&8&89 wQQ4556 guaa :;;< {E11%F#G#GH x"@ A AB    A:    _8rs9tu:vw;xAGHH3@@@BE1E1C@@BE1P<<<~6666 K*K*K*\^^^B48    />/>/>dKKK\FFF,w$w$w$t333lAAA   <<<4@&@&@&R  9N9N9N9NxBBBJ***Z444   0r-