Qc@sCddlmZmZmZmZddlmZddlmZddl Z ddl Z ddl Z ddl Z ddl Z ddlZddlZddlZddlZddlZdefdYZdZdZd Zd Zed Zd Zd ZdZedZdZdedZ!dS(i(tnullidtnullrevthextbin(t_(tobsoleteNt mergestatecBskeZdZdZd dZdZdZdZdZ dZ dZ d Z d Z RS( s+track 3-way merge state of individual filescCs ||_t|_|jdS(N(t_repotFalset_dirtyt_read(tselftrepo((s3/sys/lib/python2.7/site-packages/mercurial/merge.pyt__init__s  cCsDi|_|r||_ntj|jjdtt|_dS(Ntmerge( t_statet_localtshutiltrmtreeRtjointTrueRR (R tnode((s3/sys/lib/python2.7/site-packages/mercurial/merge.pytresets   cCsi|_y|jjd}xdt|D]V\}}|dkrYt|d |_q+|d jd}|d|j|d|jjD]-\}}|jdj|g|dqHW|j t |_ndS(Ns merge/statetws R( R RRtwriteRRRt iteritemsRRR(R Rtdtv((s3/sys/lib/python2.7/site-packages/mercurial/merge.pytcommit)s % cCstj|jj}|jjjd||jd||j|jt|j |j|j g|j |R6tlfiletafiletanodetofileR1tfcdR3R4tflotflaRR@((s3/sys/lib/python2.7/site-packages/mercurial/merge.pytresolveCs."    (    $  N(t__name__t __module__t__doc__R RIRR R)R7R9R:R=R?RS(((s3/sys/lib/python2.7/site-packages/mercurial/merge.pyRs         cCs^|jj| o]tjj|j|o]|jj||jko]||j||S(N(tdirstatet_ignoretosR-tisfiletwjoint normalizetcmp(R RJtmctxR((s3/sys/lib/python2.7/site-packages/mercurial/merge.pyt_checkunknownfile_scCst}xU|D]M}||kr t||||r t}|jjjtd|q q W|r|tjtdndS(s<check for collisions between unknown files and files in mctxs%s: untracked file differs sLuntracked files in working directory differ from files in requested revisionN( RR_RRRDRERR+tAbort(R RJR^terrorR((s3/sys/lib/python2.7/site-packages/mercurial/merge.pyt _checkunknownes !$cCsg}|rdpd}x<|jD].}||kr%|j||ddfq%q%W|sx?|jD].}||krj|j|dddfqjqjWn|S(s Forget removed files If we're jumping between revisions (as opposed to merging), and if neither the working directory nor the target rev has the file, then we need to remove it from the dirstate, to prevent the dirstate from listing the file when it is no longer in the manifest. If we're merging, and the other revision has removed a file that is not present in the working directory, we need to mark it as removed. R@Rsforget deletedsforget removedN(tdeletedtappendRItremoved(RJR^t branchmergetactionsR>R((s3/sys/lib/python2.7/site-packages/mercurial/merge.pyt_forgetremovedqs   #cst|fd}fd}d}fd}fd}i |d6|d6|d6|d 6|d 6|d 6|d 6|d 6|d6} xH|D]@\} } } } | j| }|st| || | qWi|d6|d6} xB|D]:\} } | j| }|s)t| || dqWi}x_tD]Q} tj| }||krtjtd| ||fn| ||sRtsdivergent renamesRxsrename and deletesresolving manifests s) branchmerge: %s, force: %s, partial: %s s% ancestor: %s, local: %s, remote: %s s .hgsubstatet+R!Rusupdate permissionsRvsremote is newerRwsversions differR'sremote renamed directory to slocal copied/moved to RyiRsRsremote deletedR@s other deletedslocal renamed directory to sremote copied to sremote moved to sremote createds#remote differs from untracked localtudRzs%s: untracked file differs sLuntracked files in working directory differ from files in requested revisiontbranchs remote deletesHlocal changed %s which remote deleted use (c)hanged version or (d)elete?s&Changeds&Deleteis prompt deletes prompt keepsremote recreatingsOremote changed %s which local deleted use (c)hanged version or leave (d)eleted?s&Deletedsprompt recreatingN('Rtp1tdirtyRRDt configboolR~tparentstmanifesttcopiest mergecopiesR&RdtnoteRtdebugtboolR{tvaluestupdatetsubstatetsubt dicthelperstdifft flagsdiffRR|RIR1RR_RER}R+R`t checkcaseR-Rt promptchoice(*R RJtp2tpaRftforcetpartialt acceptremotet overwriteRgtcopyt movewithdirRRBtrettdiverget renamedeletetoftfltm1tm2tmatcopiedtstabortsRtfdiffRtdiff12Rtn12tfl12tn1tn2tfl1tfl2RRtnolRsRot differentRw((s3/sys/lib/python2.7/site-packages/mercurial/merge.pyt manifestmerges    9 # #&      %              (  $+cCs |ddkrdpd|fS(NiR@ii((Rs((s3/sys/lib/python2.7/site-packages/mercurial/merge.pyt actionkeysccs|jj}tj}|j}|j}|j}|jj} d} x|D]} | d} | ddkr|r|jj t d| n| | y||| dt Wq3t k r} |jj t d| | jfq3XnG|r|jj t d| n|| || j| dd| d krS| | fVd} n| d7} qIW| dkr{| | fVnd S( sapply usually-non-interactive updates to the working directory mctx is the context to be merged into the working copy yields tuples for progress updates iiR@s removing %s t ignoremissings update failed to remove %s: %s! s getting %s iidN(RDtverboseR+t unlinkpathR[RCRFtwopenertauditRRRtOSErrorREtstrerrorR/(R R^RRiRtunlinkR[tfctxRFRR targRtinst((s3/sys/lib/python2.7/site-packages/mercurial/merge.pyt getremoves6         $    c( Csd\}}}} t|} | j|jjg} |jdtxB|D]:} | \} }}}|jjd| ||f|dkrT|\}}}|dkrqTn|jjd| |f|| }||}||kr#|jr |j}q5|j | dt }n|j ||}|sS|j | dt }n| j ||||| |kr|r| j | qqTqTW|jj}x`| D]X} tjj|j| r|jjd| || tj|j| qqWt|}g|D]} | d d kr| ^q}g|D]} | d d kr=| ^q=}t|}g|D]} | d d krr| ^qr}t|}g|D]} | d d kr| ^q}g|D] } | ddkr| d ^q}|r(|dd kr(tj|||||nd}tj|jd t|||f|}xO|D]G\}} ||7}|jjtd|d| d|dtdq\Wtj|jd t|||f|}xO|D]G\}} ||7}|jjtd|d| d|dtdqW|rR|dd krRtj|||||ntd}!td}"|jj}#xt|D]\}} | \} }}}|#|!||d d| d|d|"|dkr|\}}}|dkrtj||||j ||qn||| j|||}$|$dk r[|$dkr[| d 7} qa|$dkrt|d 7}qa|d 7}q|dkr_|\}}}%| r|jj td| |f|| |j!||j | j"|%tj|j| n|rR|jj td||f|j!||j |j"|%n|d 7}q|dkr|\}&|jj#td| x|&D]}'|jj#d|'qWq|dkr |\}&|jj#td| xy|&D]}'|jj#d|'qWq|dkr|\}%|| tj$|j| d|%kd|%k|d 7}qqW| j%|#|!dd|d|"|||| fS( sMapply the merge action list to the working directory wctx is the working copy context mctx is the context to be merged into the working copy actx is the context of the common ancestor Return a tuple of counts (updated, merged, removed, unresolved) that describes how many files were affected by the update. iRs %s: %s -> %s Rws .hgsubstates" preserving %s for resolve of %s RAs removing %s itgrRvR@gMbP?tupdatingtitemttotaltunittfilesR'smoving %s to %s sgetting %s to %s Rts<note: possible conflict - %s was renamed multiple times to: s %s Rxs9note: possible conflict - %s was deleted and renamed to: RuR!RB(iiiiN(&RRRRR<RRDRRRCRtancestorR7RdRRRYR-tlexistsR[R+RtlentsubrepotsubmergetworkerRtprogressRRRSRIRRFR/REtsetflagsR)((R RgRJR^tactxRtupdatedtmergedRet unresolvedtmstmovesRsRRwRiRRoR5RqR2R3R4Rt numupdatest workeractionst updateactionst removeactionsthgsubtztprogR Rt _updatingt_filesRR@R1Rtnf((s3/sys/lib/python2.7/site-packages/mercurial/merge.pyt applyupdatess             )) ) )-  $  $   '          " %          ( c CsZg}|t||||||||7}|jdkrV|t|||7}n|S(s4Calculate the actions needed to merge mctx into tctxN(RRRIRh( R ttctxR^RRfRRRRg((s3/sys/lib/python2.7/site-packages/mercurial/merge.pytcalculateupdates,s c Csx|D]~}|\}}}}|dkrW|rD|jj|q|jj|q|dkr|s|jj|qq|dkr|jj|q|dkr|jj|q|dkr|r|jj|q|jj|q|dkr|\}} } |r|jj| ||kr| rK|jj|n|| krm|jj|| q|jj|| qq|| kr|jj| n| r|jj|qq|dkr|\}} } | r||jkrqn|rY|jj| |r:|jj||jj|| n|r|jj|| qq|jj| |r|jj|qqqWdS( s$record merge actions to the dirstateR@RsRRuRvRwR'N( RWtremovetdropR7t normallookupt otherparenttnormalRR( R RgRfRsRRwRiRRoR5Rqtflag((s3/sys/lib/python2.7/site-packages/mercurial/merge.pyt recordupdates8sZ           cCs;|}|j}z|d} |dkry|j| j}Wqtjk r| jdkr{|jd}qtjt d| jqXn|o| } | j } | d||} } |r||}n| j | }| j | j t | t | f\}}}}| rXt| dkrXtjt dn|re|| krtjt dnR|| kr| r| j| jkrtjt dd t d qn| r| js| jrtjt d d t d nxt| jD]7}| j|jr'tjt d |q'q'Wn| s)|| | fkr)| jdt}|s|dkrtj|| j g}||j |kr| }q#|rt d}tj|q#t d}tj|q&| }q)nt|| | |||||}|sq|t|df\}}}}n|s|jddtd|d|nt||| | || }|s|j||t||||s|jj| jqnWd|j X|s7|jdd|d|d|dn|S(s Perform a merge between the working directory and the given node node = the node to update to, or None if unspecified branchmerge = whether to merge between branches force = whether to force branch merging or file overwriting partial = a function to filter file lists (dirstate not updated) mergeancestor = whether it is merging with an ancestor. If true, we should accept the incoming changes for any prompts that occur. If false, merging with an ancestor (fast-forward) is only allowed between different named branches. This flag is used by rebase extension as a temporary fix and should be avoided in general. The table below shows all the behaviors of the update command given the -c and -C or no options, whether the working directory is dirty, whether a revision is specified, and the relationship of the parent rev to the target rev (linear, on the same named branch, or on another named branch). This logic is tested by test-update-branches.t. -c -C dirty rev | linear same cross n n n n | ok (1) x n n n y | ok ok ok n n y * | merge (2) (2) n y * * | --- discard --- y n y * | --- (3) --- y n n * | --- ok --- y y * * | --- (4) --- x = can't happen * = don't-care 1 = abort: crosses branches (use 'hg merge' or 'hg update -c') 2 = abort: crosses branches (use 'hg merge' to merge or use 'hg update -C' to discard changes) 3 = abort: uncommitted local changes 4 = incompatible options (checked in commands.py) Return the same tuple as applyupdates(). tdefaultttipsbranch %s not foundiisoutstanding uncommitted mergess7merging with a working directory ancestor has no effectsnothing to mergethints#use 'hg update' or check 'hg heads'soutstanding uncommitted changessuse 'hg status' to list changess5outstanding uncommitted changes in subrepository '%s'RsCcrosses branches (merge branches or use --clean to discard changes)sCcrosses branches (merge branches or update --check to force update)tt preupdatetthrowtparent1tparent2NRRai(!twlockRIt branchtipRRatRepoLookupErrortlookupR+R`RRRRtstrRRRcR~RRRRRt foregroundRRthookRt setparentsRRWt setbranchtrelease(R RRfRRRt mergeancestortonodeRtwcRtplRRRtfp1tfp2txp1txp2RRRRRgtstats((s3/sys/lib/python2.7/site-packages/mercurial/merge.pyRvs~+   &   6      !"  &("RRRRRti18nRt mercurialRRaR+RHRRRRRRYRtobjectRR_RbRhRRRRRRRRRIR(((s3/sys/lib/python2.7/site-packages/mercurial/merge.pyts""T$Q   9  $ >