^c xBdZddlZddlmZddlmZddlmZmZm Z ddl m Z m Z m Z mZmZmZmZmZmZmZmZmZmZmZmZmZddlmZmZm Z Gdd e j!Z"iZ#ej$e#Z$d Z%iZ&ej'e&Z'e'd d d e'd dd GddZ(GddZ)GddZ*dZ+dZ,e$d dddededfddgededfd d!ded"fd#d$ged%edfd&d'ged(edfdd)ded*edfd+d,d-ed.fddded/fdd0d-ed1fd2d3ded4fdd ded5ed6fg ed7e$j-8d9Z.d:Z/d;Z0ej1Z1e1d<d=Z2ej3Z3e3d>d?h@dAZ4dBZ5e2e4gZ6dS)CaVcommand to transplant changesets from another branch This extension allows you to transplant changes to another parent revision, possibly in another repository. The transplant is done using 'diff' patches. Transplanted patches are recorded in .hg/transplant/transplants, as a map from a changeset hash to its hash in the source repository. N)_)open)binhexshort) bundlerepocmdutilerrorexchangehg logcmdutilmatchmergepatchpycompat registrarrevsetsmartsetstateutilvfs)procutil stringutilurlutilceZdZdS)TransplantErrorN)__name__ __module__ __qualname__2/usr/lib/python3/dist-packages/hgext/transplant.pyrr3sDr!rsships-with-hg-core transplantfilter)defaultlogceZdZdZdS)transplantentryc"||_||_dSN)lnodernode)selfr+r,s r"__init__ztransplantentry.__init__Os  r!N)rrrr.r r!r"r(r(Ns#r!r(c4eZdZddZdZdZdZdZdZdS) transplantsNc||_||_||_|stj|j|_i|_d|_|dSNF)pathtransplantfileopenervfsmodrr0dirtyread)r-r3r4r5s r"r.ztransplants.__init__UsS ,  0 *TY//DK  r!ctj|j|j}|jrtj|r|j|jD]o}tt| d\}}|j |g}| t||ldSdSdS)N:)osr3joinr4existsr5r8 splitlinesmaprsplitr0 setdefaultappendr()r-abspathliner+r,lists r"r8ztransplants.read`s',,ty$*=>>   ;27>>'#:#: ; (()<==HHJJ ; ;"3 4(8(899 u'225"== OE599::::  ; ; ; ; ; ;r!c|jr|jrtj|jstj|j||jd}|jD]I}|D]D}tt|j |j f\}}| |dz|zdzEJ|d|_dS)Nwr: F)r7r4r;r3isdirmkdirr5r0valuesr?rr+r,writeclose)r-fprEtlrs r"rLztransplants.writehs : $- 7==++ $###T0$77B(//11 3 333AsQWag$677DAqHHQX\E122223 HHJJJ r!c:|j|pgSr*)r0get)r-r,s r"rSztransplants.getts##E**0b0r!c|j|g}|t||d|_dSNT)r0rArBr(r7)r-r+r,rEs r"setztransplants.setwsA**5"55 OE511222 r!c|j|j}|r|||=d|_dSdSrU)r0rSr,indexr7)r- transplantrEs r"removeztransplants.remove|sL##J$455  TZZ ++,DJJJ  r!)NNN) rrrr.r8rLrSrVrZr r!r"r0r0Tss    ;;;   111 r!r0cveZdZdZdZddZdZ ddZdZd Z d Z d Z d Z d Z dZddZdZdZdZdS) transplanterc||_|_jd|_t j|j|_t|jd|j|_fd}||_dS)Nr#s transplants)r5ctjdd}tjdd|itjS)Nr#editformr )r mergeeditformgetcommiteditorr strkwargs)r_optsrepos r"raz.transplanter.__init__..getcommiteditorsN,T$ZGGH*!%-%7%=%= r!) uirdrr<r3r6r5r0ra)r-rerdrcras `` r"r.ztransplanter.__init__s HMM-00 j++ & I~dk          /r!ct||r|j|}t||r>|j|}|j|g|d}||vrdS|j|D]v}t||js|j|dS|j|j}||j|g|dvrdSwdS)zmreturns True if a node is already an ancestor of parent or is parent or has already been transplantedT) inclusiveF)hasnode changelogrev ancestorsr0rSr+rZ) r-rdnodeparent parentrevrj reachablerOlnoderevs r"appliedztransplanter.applieds6 4  3**622I 4   .$$T**C00 SD1Iit!%%d++  A4))  ''***uu~))!'22H4>33 X4ttur!Nc < |i}t|}|j}g}tj|j|} d| _dx} } |} |d} |D]} || } d| t| fz}| || |r+|j td|za|j | }|ds|ds|d|kr|| | }|rj||kr)t#j||| t)j||d |j}g}d }| |vr>$M$ UKKKK T%)_555!]--// "6>>#G"4..I dFKKMM$HHHH! 1:,,88I..  ABB"E$KK01%) !'tI!?!?!00"'+ !"= > >#(==%++">!?##1 %QZF $II$,$4apply the patch in patchfile to the repository as a transplantNs%d %dtransplant_sources (transplanted from %s)s applying %s s %s %s %s s"can only omit patchfile if merging)fileseolmodeseries)rrHs=fix up the working directory and run hg transplant --continue)extrareditorsskipping emptied changeset %s )!r}rrerrrrr rrVrrE Exceptionr;r3r<r=rrrr|rLr forcebytestrr setparentsralwaysexactcommitrarr0)r-rdrlclrrr|r}manifestrtimetimezonermessagerrinst seriespathrp2mrs r"rztransplanter.applyoneFs>@V:4)$5'4**%t,  M$(KKb)$L$L !T4  ? 2SYY> >G q)**U4[[8999  ^tT7&;;<<< H H+a EFFGG G    DGT9E4PPPPU    W\\$)Y?? 7>>*--*Ij)))]%%''tWb"EBBB j5d;;eCDDD%4 E  #!!##B OOB % % % AA E""A KK   ''))     GLL=>>tL M M M4 *   D ) ) )s;D G8CG33G8ctjtj|jdSNjournal)r;r3r=r<r-s r" canresumeztransplanter.canresumes(w~~bgll49jAABBBr!cNtjtj|jdr||||\}}|rG|jtdt|t|fzn8|jtdt|fztj|jd}tj|s|j dS| \}}i} |D]}|| |j |< tj||||| ||dS)z7recover last transaction and apply remaining changesetsrs%s transplanted as %s s%s skipped due to empty diff rN)r;r3r=r<recoverrerrrr0rL readseriesrirjrr) r-rdrrcrrlrnodesrrs r"resumeztransplanter.resumes{ 7>>"',,ty*== > > ll466GAt 011U4[[%((4KK788E$KK>IW\\$)Y77 w~~j))    " " $ $ $ F)) v 0 0A./F6#''** + + * 466666r!c4|\}}}}}d} |r |r |r|ds!tjtd|d} t |dkrw|dr`||d} | |vr@tjtdt| t|fznd} d|i} |j } | | kr1tjtd t| z| r| | |d| } | j | j| j| jf\}}}}| s|s|s|s|rm||||| | }|s!tjtd | s|j||nd }|||fS#wxYw) z/commit working directory using journal metadataFrstransplant log file is corruptrurvrwTrs-working directory not at transplant parent %s)rrs commit failedN)readlogr rrlenrSrrrrrrrmodifiedaddedremoveddeletedrrar0rVunlog)r-rdrrcrlrrrrrrmrrstrrrrrs r"rztransplanter.recoversa-1\\^^*dD'7 D4 Dw Dgaj D+a ABBCC C w<>   DzH  x ( ( ( IIa?@@ A A A II5669LL    JJLLL1  r!cg}g}|}|jdD]<}|dr|}|t |=||fS)Nrs# Merges)r5r8r> startswithrBr)r-rrcurrDs r"rztransplanter.readseriess}K$$Y//::<< " "D{++  JJs4yy ! ! ! !vr!c|sdStj|jstj|j|dd}t |D]-}|t||dz.|r?|d|D]'}|t|dz(|dS)NrrGrHs # Merges ) r;r3rIrJr5r~rLrrM)r-rrseriesrjrs r"rztransplanter.saveseriess  Fw}}TY'' HTY   Y--&>> 3 3C LLVC[))E1 2 2 2 2  - LL ' ' ' - - SVVe^,,,, r!cg}g}|jj}d}d}d}|D]}|r|||dr |dd}:|dr |dd}Z|drt |dd}|dr+|t |dd|d sd }||d||fvr!tjtd |||d ||fS) NFs# User s# Date s # Node ID # Parent s# Ts,filter corrupted changeset (no user or date)rH) rdrr8r>rBrrr rrr<) r-rNrrrlinmsgrrrDs r"rztransplanter.parselogsyGGII((** % %D %t$$$$,, %ABBx,, %ABBx// %49~~.. %s48}}----__U++ %t$$$ D$<  +ABB dD%**W"5"5w??r!cvtj|jstj|j|dd}|d|z|d|z|dt |z|dt |zdz|r(|dt |zdz||dz|dS) z,journal changelog metadata for later recoverrrGrs # Date %s s # Node ID %s rrHN) r;r3rIrJr5rLrrstriprM)r-rrrrrrrNs r"r|ztransplanter.logs w}}TY'' HTY    [[T * * $&''' $&''' "SWW,--- B'%/000  5 HH\CGG+e3 4 4 4 !!E)***  r!cR||dSr)rr5rs r"rztransplanter.readlog,s }}T[[44555r!ctj|jd}tj|rtj|dSdS)zremove changelog journalrN)r;r3r<r=r)r-absdsts r"rztransplanter.unlog/sOdi44 7>>& ! !  If       r!cfd}|S)Nc0|rdSj|djkrdSj|d}|d}|r|rdSdS)NFrurrT)rqrirrr8rS)rlrcnoderdrootr-rs r"matchfnz.transplanter.transplantfilter..matchfn6s||D$-- u''--a0DK??u$))$//2EII233E dE488 u4r!r )r-rdrrrs```` r"transplantfilterztransplanter.transplantfilter5s5        r!r*)FFN)F)rrrr.rqrr}rrrrrrrrr|rrrr r!r"r\r\s(///"0ttttl!!!!!!HIM====~CCC7770999v         @@@6    666     r!r\ch |j|duS#tj$rYdSwxYwr2)rirjr StorageError)rdrls r"rhrhDsG~!!$''t33  uus 11ctj|||}g}g}td}|D]-}|||d} | s||} d| | dz} | dkr>||dD]\} } |d| | fz d} nV| dkrP|j|d} tj || |D]}||d} | | d kr| || d kr| || d krn| d krd }d }n/| ||fS)z#interactively transplant changesetssapply changeset? [ynmpcq?]:$$ &yes, transplant this changeset$$ &no, skip this changeset$$ &merge at this changeset$$ show &patch$$ &commit selected changesets$$ &quit and cancel transplant$$ &? (show this help)Nsynmpcq?ru?s%s: %s prymcqr ) r changesetdisplayerrshow promptchoiceextractchoicesrLrirrrrBrM)rerdrrc displayerr0rpromptrlactionchoicecrOrmrs r" browserevsr Ks-b$==IK F  "  FtDz""" __V,,F! 34F~~--f55a833DAqHH[Aq6122224//55a8"Zfd;;$$EHHUOOOO  T>>   t $ $ $ $ t^^ MM$     t^^ E t^^KF EOO   r!ssourcer!stransplant changesets from REPOsREPObbranchs!use this source changeset as headsREVaalls0pull all changesets up to the --branch revisionsrprunes skip over REVrmerges merge at REVrvs)parent to choose when transplanting mergeeseditFs invoke editor on commit messagess%append transplant info to log messagestopsstop interrupted transplantrcontinues7continue last transplant session after fixing conflictss!filter changesets through commandsCMDsChg transplant [-s REPO] [-b BRANCH [-a]] [-p REV] [-m REV] [REV]...) helpcategoryc|5t||g|Ri|cdddS#1swxYwYdS)atransplant changesets from another branch Selected changesets will be applied on top of the current working directory with the log of the original changeset. The changesets are copied and will thus appear twice in the history with different identities. Consider using the graft command if everything is inside the same repository - it will use merges and will usually give a better result. Use the rebase extension if the changesets are unpublished and you want to move them instead of copying them. If --log is specified, log messages will have a comment appended of the form:: (transplanted from CHANGESETHASH) You can rewrite the changelog message with the --filter option. Its argument will be invoked with the current changelog message as $1 and the patch as $2. --source/-s specifies another repository to use for selecting changesets, just as if it temporarily had been pulled. If --branch/-b is specified, these revisions will be used as heads when deciding which changesets to transplant, just as if only these revisions had been pulled. If --all/-a is specified, all the revisions up to the heads specified with --branch will be transplanted. Example: - transplant all changes up to REV on top of your current revision:: hg transplant --branch REV --all You can optionally mark selected transplanted changesets as merge changesets. You will not be prompted to transplant any ancestors of a merged transplant, and you can merge descendants of them normally instead of transplanting them. Merge changesets may be transplanted directly by specifying the proper parent changeset by calling :hg:`transplant --parent`. If no merges or revisions are provided, :hg:`transplant` will start an interactive changeset browser. If a changeset application fails, you can fix the merge by hand and then resume where you left off by calling :hg:`transplant --continue/-c`. N)wlock _dotransplant)rerdrrcs r"rYrYwsT 66R555555666666666666666666s 377c8 tjfd}tjfd}d}tj|}||||ds|dd|d<|ds|dd|d<t |||}|j}t|dkr,||j kr!tj td|d r6|s!tjtd n|d rK|s!tjtd |||St#j|t#j||d } | rt)jd||| d} t-j||| } tj| j|dd} t5| } |D]@} | | |,#tj$rY=wxYwt;j||| t?| d\}}n2|tjj|dd} d} |d r(| || |r |dSdS|!|||dr;fdtEj#|dDfd}n}tjj|dd}i}|rCtEj#|D],}|$|tK|<-n|ds|s|kr|||}n||| |}|dr|}n*tM|||\}}|'||D]}||j()|< |D]}||j()|< |*|||||r |dSdS#|r |wwxYw)Nc32K|D]}||r|VdSr*r )rdcsetsrrls r"incwalkz_dotransplant..incwalks9  DuT{{    r!c3:K|s|}g}||}|D]B}||||C|j||dD]}||r|VdS)zYield all nodes that are ancestors of a head but not ancestors of dest. If no heads are specified, the heads of repo will be used.rN)rsrBancestorrlri nodesbetween)rddestrsrrkctxheadrls r"transplantwalkz%_dotransplant..transplantwalks !JJLLE 4j > >D   S\\$t*55::<< = = = =N// 5AA!D  DuT{{    r!cf|drtj|dgddS|drtj|dgddS|dsM|sK|ds6|ds!tjt d|drY|ds!tjt d |r#tjt d dSdS) Nr)rrrrrrrs9no source URL, branch revision, or revision list providedrs --all requires a branch revisions*--all is incompatible with a revision list)rSr check_incompatible_argumentsr rr)rcrs r" checkoptsz _dotransplant..checkoptssn 88K    0k#@#@#@    F 88G     0g<<<    F HHY    xx!! xx ""  +%  88F   88I&& Jk!$G"H"HIII kCDD     r!r&r#r$rsno revision checked outrsno transplant to continuersno interrupted transplant foundrrr T) onlyheadsforcercDh|]}|Sr )rl).0rQrs r" z _dotransplant..Ls7q   r!c"|o|vSr*r )xprunetfs r"z_dotransplant..Ps1 8!5.r!rr)r)+rrr byteskwargsrSconfigr\rrrrr rrr StateErrorrr checkunfinished bailifchangedrget_unique_pull_pathr rmaplistrrVadd RepoErrorrgetremotechangesr~rrr revrangerlintr extendrirjr)rerdrrcr r'r*tpr sourcerepourrstargetrQr cleanupfnrrralltransplants newmergesr2rr3s @@@r"rrs#'; 15    >   % %D IdD 88F  8yy77V 88I  >))M9==Y b$ % %B     B 4yy1}}t{**k!677888 xx  $||~~ D"1%A#B#BCC C D '  $||~~ J"1%G#H#HII Iwwr4   %%%d###)$$J  (b* M Ma PwtT1%% dhhy".E.EFFU  A  4;;q>>****?    #-#> dfVnnD$ $ $  yy B0G0GHH ' 88K   IIdFD ) ) ) F   IKKKKK  C vr 2 2 88H   #,VTXXh5G5GHHE98888GGG!&-(B1G1GHH  4(66 2 2!'!1!1s1vv 2 XXf   4V 4~~!(g!F!F!F!/BW"""xx )%",R"N"Ni i((( 4 423v'++A..// 0 0A./F6#''** + + vvvt444   IKKKKK  9  IKKKK s%)(JJ$#J$,T F8T Tc|5t||i}|||icdddS#1swxYwYdS)zAlogic to resume an interrupted transplant using 'hg continue'N)rr\r)rerdrBs r" continuecmdrJos )) "dB ' 'yytR(())))))))))))))))))s(A  AAstransplanted([set])cz|rtj||}n|}tjfd|DS)z?Transplanted changesets in set, or all transplanted changesets.cng|]1}|d/|2S)r)rrS)r.rQrds r" z&revsettransplanted..s9CCCqa,,-ABBCCCCr!)rgetsetrbaseset)rdsubsetr1ss` r"revsettransplantedrRzsS  M$ * *   CCCCACCC  r!s transplantedctx)requiresc||d}|d}|rt|pdS)zEString. The node identifier of the transplanted changeset if any.rSrr!)resourcerrSr)contextmappingr%rs r"kwtransplantedrYsH   7F + +C ,--A <Q 3r!c xtjdddttdtddS)Nr#stransplant/journalTsMTo continue: hg transplant --continue To stop: hg transplant --stops8use 'hg transplant --continue' or 'hg transplant --stop')fname clearable continuefunc statushintcmdhint)statemod addunfinishedrJr)res r"extsetuprbsR #  4  MNN      r!)7__doc__r;mercurial.i18nrmercurial.pycompatrmercurial.noderrr mercurialrr r r r r rrrrrrrrr`rrr6mercurial.utilsrrrrrcmdtablecommand testedwith configtable configitemr(r0r\rhr CATEGORY_CHANGE_MANAGEMENTrYrrJrevsetpredicaterRtemplatekeywordrYrb i18nfunctionsr r!r"rrs ###### $     ek     ) H % % #  !Y !+ . .      ,,,,,,,,^~~~~~~~~B)!)!)!X     A0 1 1 AgJJ      A2 3 3 AfII      AA B B  xQQ/00!!F))< xQQ//6;    A: ; ; AfII   wqq!DEEF fdAAFGGH guaa >??@    AH I I      A2 3 3 AfII  O.^A 3k666n4646o66n46nGGGT))),)+--'(()(,)+--F844454   $^4 r!