ó a˜Qc@sÜddlmZmZddlmZddlZddlZddlZddlZddl Z ddl Z ddl Z de d„Zdefd„ƒYZde de d„Zd„Ze d „Ze e d „ZdS( iÿÿÿÿ(tnullidtshort(t_Nc CsÐ|jdƒs%tj||||ƒS|rƒt}|jj}x-|D]%}|j|ƒdkrDt}PqDqDW|rƒ|t|fSnt j |j ||d| ƒ}|\}} } t |ƒ| |pÌt | ƒfS(s>Return a tuple (common, anyincoming, heads) used to identify the common subset of nodes between repo and remote. "common" is a list of (at least) the heads of the common subset. "anyincoming" is testable as a boolean indicating if any nodes are missing locally. If remote does not support getbundle, this actually is a list of roots of the nodes that would be incoming, to be supplied to changegroupsubset. No code except for pull should be relying on this fact any longer. "heads" is either the supplied heads, or else the remote's heads. If you pass heads and they are all known locally, the response lists just these heads in "common" and in "heads". Please use findcommonoutgoing to compute the set of outgoing nodes to give extensions a good hook into outgoing. t getbundletabortwhenunrelatedN( tcapablet treediscoverytfindcommonincomingtTruet changelogtnodemaptgettNonetFalset setdiscoverytfindcommonheadstuitlist( trepotremotetheadstforcetallknowntnmthtrestcommontanyinctsrvheads((s7/sys/lib/python2.7/site-packages/mercurial/discovery.pyR s   toutgoingcBsDeZdZd„Zd„Zejd„ƒZejd„ƒZRS(s Represents the set of nodes present in a local repo but not in a (possibly) remote one. Members: missing is a list of all nodes present in local but not in remote. common is a list of all nodes shared between the two repos. excluded is the list of missing changeset that shouldn't be sent remotely. missingheads is the list of heads of missing. commonheads is the list of heads of common. The sets are computed on demand from the heads, unless provided upfront by discovery.cCs:||_||_||_d|_d|_g|_dS(N(t commonheadst missingheadst_revlogR t_commont_missingtexcluded(tselftrevlogRR((s7/sys/lib/python2.7/site-packages/mercurial/discovery.pyt__init__As      cCs1|jj|j|jƒ}|\|_|_dS(N(R tfindcommonmissingRRR!R"(R$tsets((s7/sys/lib/python2.7/site-packages/mercurial/discovery.pyt_computecommonmissingIs cCs#|jdkr|jƒn|jS(N(R!R R)(R$((s7/sys/lib/python2.7/site-packages/mercurial/discovery.pyRNs cCs#|jdkr|jƒn|jS(N(R"R R)(R$((s7/sys/lib/python2.7/site-packages/mercurial/discovery.pytmissingTs ( t__name__t __module__t__doc__R&R)tutilt propertycacheRR*(((s7/sys/lib/python2.7/site-packages/mercurial/discovery.pyR2s    csEt|jddƒ}|dkr9t||d|ƒ}n|\|_}}|jjtjpd|j } | s…|p||j ƒ|_ n+|dkr×|j dƒj ƒ|_ g|j dƒD]} | jƒ^q¹|_nÙ|jj|j|ƒ} | \|_} g|_} g|_}xV| D]N}||} | jƒtjksP| jƒr`|j|ƒq| j|ƒqWt| ƒt| ƒkr’|}ntj|||ƒ}||_ |rA|jƒ|j‰t ‡fd†|jDƒƒ}t ˆj|ƒƒ||_t |jƒ}g|j D]}||kr|^q|_ n|S(sOReturn an outgoing instance to identify the nodes present in repo but not in other. If onlyheads is given, only nodes ancestral to nodes in onlyheads (inclusive) are included. If you already know the local repo's heads, passing them in onlyheads is faster than letting them be recomputed here. If commoninc is given, it must be the result of a prior call to findcommonincoming(repo, other, force) to avoid recomputing it here. If portable is given, compute more conservative common and missingheads, to make bundles created from the instance more portable.Rtservedssecret() or extinct()c3s|]}ˆj|ƒVqdS(N(trev(t.0tn(tcl(s7/sys/lib/python2.7/site-packages/mercurial/discovery.pys sN(RR R RRt _phasecachet phaserootstphasestsecrettobsstoreRRtfilteredtsettnodeR#R'R!R"tphasetextincttappendtlentnewheadsR)t ancestors(Rtothert onlyheadsRt commoninctportabletogt_anyt_hdst mayexcludetctxR(t allmissingR*R#R<Rt missingrevsRR((R4s7/sys/lib/python2.7/site-packages/mercurial/discovery.pytfindcommonoutgoingZs>  .    !    .csëˆj}i}t‡fd†|jDƒƒ}|jƒ}|t|ƒ}|j|ƒtƒ}x|jƒjƒD]{\} } |j| ƒg} g} x:| D]2} | |jkrÄ| j| ƒqŸ| j| ƒqŸW| t | ƒ| f|| ¤sc3s|]}ˆ|VqdS(N((R2R3(R(s7/sys/lib/python2.7/site-packages/mercurial/discovery.pys ¶scss5|]+\}}|ddk r||dfVqdS(iiN(R (R2ROR((s7/sys/lib/python2.7/site-packages/mercurial/discovery.pys Äs css|]}|jƒVqdS(N(R1(R2RK((s7/sys/lib/python2.7/site-packages/mercurial/discovery.pys ÇsiN(R R;R*t branchmaptdifference_updatet iteritemstaddR R?RROR t branchcachetupdate(RRRR4theadssumtbranchest remotemapt newbranchestremotebranchesRORtknowntunsyncedRt missingctxttouchedbranchesRKtnewmapRA((Rs7/sys/lib/python2.7/site-packages/mercurial/discovery.pyt _headssummary–s>             cs…|j‰t‡fd†|Dƒƒ}|jd||jƒ}td„|Dƒƒ}|rhtdgƒpntƒ}i|||fd6S(s;Compute branchmapsummary for repo without branchmap supportc3s$|]}|ˆjkr|VqdS(N(R (R2R(R4(s7/sys/lib/python2.7/site-packages/mercurial/discovery.pys Óssheads(%ln + %ln)css|]}|jƒVqdS(N(R<(R2tc((s7/sys/lib/python2.7/site-packages/mercurial/discovery.pys ÚsN(R R;R*RR (Rt remoteheadsRtinctoldheadstrRAR\((R4s7/sys/lib/python2.7/site-packages/mercurial/discovery.pyt_oldheadssummaryÌs  cCst|tgkrdS|jdƒr7t|||ƒ}nt||||ƒ}g|jƒD]"\}}|ddkrY|^qY} | rË| rËdjt| ƒƒ} tj t dƒ| dt dƒƒ‚n|j } |j dƒ} t ƒ} xr| D]j}| j|ƒ}|ró||kró||||}}tj|||ƒr]| j|jƒƒq]qóqóWd}t}t |jƒ}t d „|j d |jƒDƒƒ}|j|ƒx‚t|jƒƒD]n\}}|ddkrãqÁnt |d ƒ}t |dƒ}|j|d ƒ|j|d ƒd}t ƒ}|jrèt ƒ}x¥|D]”}||krˆ||jƒtjkrˆ|j|ƒqMxVtj|j|gƒD]/}||kr¡||kr¡|j|ƒPq¡q¡W|j|ƒqMWn|}g|d D]}||krù|^qùr t}nt|ƒt|ƒkrOt|| |ƒ}n|rÁ|dkrÒ|dkrt dƒt|dƒ|f}nt dƒt|dƒ}|d rÃt dƒ}qÒt dƒ}n|dk rû|j j!t dƒ|ƒnx1|D]&}|j j!t dƒt|ƒƒqWqÁqÁW|rQtj |d|ƒ‚n|rp|j j"t dƒƒndS(skCheck that a push won't add any outgoing head raise Abort error and display ui message as needed. NRPis, s%push creates new remote branches: %s!thints8use 'hg push --new-branch' to create new remote branchest bookmarkscss|]}|jƒVqdS(N(R<(R2Ra((s7/sys/lib/python2.7/site-packages/mercurial/discovery.pys ss%ldiitdefaults/push creates new remote head %s on branch '%s'!s push creates new remote head %s!s1you should pull and merge or use push -f to forces-did you forget to merge? use push -f to forces new remote heads on branch '%s' snew remote head %s snote: unsynced remote changes! (sdefaultN(#RRR`RfRRR tjointsortedR.tAbortRt _bookmarkstlistkeysR;R Rht validdestRSR<R R*RRUR9R=R7tpublictobsoletet allsuccessorsRR@RRtnotetwarn(RRRRbt newbranchRcRVRORRYt branchnamestlocalbookmarkstremotebookmarkstbookmarkedheadstbmtrnodetlctxtrctxterrorR\RLtallfuturecommontcandidate_newhstoldhstdhstdiscardedheadstnewhstnhtsucRRg((s7/sys/lib/python2.7/site-packages/mercurial/discovery.pyt checkheadsÞsˆ     %     % )        +(R<RRti18nRR.RRR7RqRhRPR R RtobjectRRNR`RfR‡(((s7/sys/lib/python2.7/site-packages/mercurial/discovery.pytsH %(; 6