��Qc@s�ddlmZmZddlmZddlZddlZddlZddlZddl Z ddl
Z
ddlZde
d�Zdefd��YZde
de
d�Zd�Ze
d �Ze
e
d
�ZdS(i�(tnullidtshort(t_NcCs�|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 changelogtnodemaptgettNonetFalsetsetdiscoverytfindcommonheadstuitlist(trepotremotetheadstforcetallknowntnmthtrestcommontanyinctsrvheads((s7/sys/lib/python2.7/site-packages/mercurial/discovery.pyR
s
toutgoingcBsDeZdZd�Zd�Zejd��Zejd��ZRS(sRepresents 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(tcommonheadstmissingheadst_revlogRt_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_computecommonmissingIscCs#|jdkr|j�n|jS(N(R!RR)(R$((s7/sys/lib/python2.7/site-packages/mercurial/discovery.pyRNs
cCs#|jdkr|j�n|jS(N(R"RR)(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�|jd�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|jD]}||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 <genexpr>�sN(RR RRRt_phasecachet
phaserootstphasestsecrettobsstoreRRtfilteredtsettnodeR#R'R!R"tphasetextincttappendtlentnewheadsR)t ancestors(Rtothert onlyheadsRt commoninctportabletogt_anyt_hdst
mayexcludetctxR(t
allmissingR*R#R<RtmissingrevsRR((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|| <qsWt �fd�|jD��}t�}xI|D]A}|j
�} |j| �| |kr!dggf|| <q!q!Wx||D]
} || =qqWtjd�|j�D��}|j
�d�|D��x)|j�D]\} }||| d(q�W|S(s�compute a summary of branch and heads status before and after push
return {'branch': ([remoteheads], [newheads], [unsyncedheads])} mapping
- branch: the branch name
- remoteheads: the list of remote heads known locally
None is the branch is new
- newheads: the new remote heads (known locally) with outgoing pushed
- unsyncedheads: the list of remote heads unknown locally.
c3s|]}�|j�VqdS(N(tbranch(R2R3(R(s7/sys/lib/python2.7/site-packages/mercurial/discovery.pys <genexpr>�sc3s|]}�|VqdS(N((R2R3(R(s7/sys/lib/python2.7/site-packages/mercurial/discovery.pys <genexpr>�scss5|]+\}}|ddk r||dfVqdS(iiN(R(R2ROR((s7/sys/lib/python2.7/site-packages/mercurial/discovery.pys <genexpr>�s css|]}|j�VqdS(N(R1(R2RK((s7/sys/lib/python2.7/site-packages/mercurial/discovery.pys <genexpr>�siN(R R;R*t branchmaptdifference_updatet iteritemstaddR
R?RRORtbranchcachetupdate(RRRR4theadssumtbranchest remotemaptnewbranchestremotebranchesRORtknowntunsyncedRt
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 <genexpr>�ssheads(%ln + %ln)css|]}|j�VqdS(N(R<(R2tc((s7/sys/lib/python2.7/site-packages/mercurial/discovery.pys <genexpr>�sN(R R;R*RR(RtremoteheadsRtinctoldheadstrRAR\((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}|jd�}t
�}
xr|D]j}|j|�}|r�|kr�|||}}tj|||�r]|
j|j��q]q�Wd}t}t
|j�}t
d �|j
d
|j�D��}|j|�x�t|j��D]n\}}|ddkr��nt
|d�}t
|d�}|j|d�|j|d�d}t
�}|jr�
�}x�|D]�}||kr�||j�tjkr�|j|�qMxVtj|j|g�D]/}||kr�||kr�|j|�Pq�q�W|j|�qMWn|}g|dD]}||kr�^q�t}nt|�t|�krOt||
|�}n|r�|dkr�|dkr�t
d�t|d�|f}nt
d�t|d�}|dr�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 <genexpr>
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`RfRRRtjointsortedR.tAbortRt
_bookmarkstlistkeysR;RRht validdestRSR<R
R*RRUR9R=R7tpublictobsoletet
allsuccessorsRR@RRtnotetwarn(RRRRbt newbranchRcRVRORRYtbranchnamestlocalbookmarkstremotebookmarkstbookmarkedheadstbmtrnodetlctxtrctxterrorR\RLtallfuturecommontcandidate_newhstoldhstdhstdiscardedheadstnewhstnhtsucRRg((s7/sys/lib/python2.7/site-packages/mercurial/discovery.pyt
checkheads�s�
%
%
)
+(R<RRti18nRR.RRR7RqRhRPRR
RtobjectRRNR`RfR�(((s7/sys/lib/python2.7/site-packages/mercurial/discovery.pyt<module>sH%(; 6
|