^cWddlZddlmZddlmZmZddlmZmZm Z m Z m Z m Z m Z mZmZmZddZGdd Z dd Zd Zdd Zd ZdZdZdZdS)N)_)hexshort) bookmarks branchmaperrorobsoletephasespycompatscmutil setdiscovery treediscoveryutilFc |dstj||||S|r,|jj t fd|Dr|d|fSt j|j||| |}|\}}}|r)|s'|jj t fd|D}t|||pt|fS)aReturn 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. "ancestorsof" if not None, restrict the discovery to a subset defined by these nodes. Changeset outside of this set won't be considered (but may still appear in "common"). 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. s getbundlec3.K|]}|VdSN.0h knownnodes 5/usr/lib/python3/dist-packages/mercurial/discovery.py z%findcommonincoming..:s+++yy||++++++F)abortwhenunrelated ancestorsofc30K|]}| VdSrr)rnhas_nodes rrz%findcommonincoming..Hs-44!_444444r) capablerfindcommonincoming changeloghasnodeallrfindcommonheadsuianylist) reporemoteheadsforcerrescommonanyincsrvheadsr rs @@rr"r"s, >>, ' 'L/feUKKK )N* ++++U+++ + + )5%( (  &  $9    C #FFH 5V5>)4444e44444 LL&%"94>> ::rcbeZdZdZ ddZdZejdZejdZ dS)outgoingaRepresents the result of a findcommonoutgoing() call. Members: ancestorsof is a list of the nodes whose ancestors are included in the outgoing operation. missing is a list of those ancestors of ancestorsof that are present in local but not in remote. common is a set containing revs common between the local and the remote repository (at least all of those that are ancestors of ancestorsof). commonheads is the list of heads of common. excluded is the list of missing changeset that shouldn't be sent remotely. Some members are computed on demand from the heads, unless provided upfront by discovery.Nc d||fvsJj}||}|rug}|D]6}|fd||D7|||\}} } t | | } fd|D}n |sjg}||_||_||_ d|_ d|_ g|_ dS)Nc*g|]}|jk |Sr)nullid)rpr*s r z%outgoing.__init__..ms%!O!O!Oa4;>N>N!>N>N>Nrcg|]}|v| Srr)rrincludeds rr8z%outgoing.__init__..ts#EEE1H3D3D13D3D3Dr) r#r,extendparents nodesbetweensetr6 commonheadsr_revlog_common_missingexcluded) selfr*r?r missingrootscl discbasesrcsetsrootsr,r:s ` @r__init__zoutgoing.__init__bs \22222 ^  ((**K  (I! Q Q  !O!O!O!ORZZ]]!O!O!OPPPP#%//, "L"L E5%5zzHKEEEEiEEEKK (;-K&&    rcn|j|j|j}|\|_|_dSr)r@findcommonmissingr?rrArB)rDsetss r_computecommonmissingzoutgoing._computecommonmissing~s8|--  d.  '+# dmmmrcF|j||jSr)rArNrDs rr/zoutgoing.commons$ <   & & ( ( (|rcF|j||jSr)rBrNrPs rmissingzoutgoing.missings$ =  & & ( ( (}r)NNN) __name__ __module__ __qualname____doc__rJrNr propertycacher/rRrrrr3r3Ls,FJ8+++    rr3cvt|dd}|t||||}|\|_}}|jjt jp|j} | s|p||_ n=|Q| d|_ d| dD|_ n|j |j|} | \|_} gx|_} gx|_ } | D]k}||}|t jks|r| |V| |lt)| t)| kr|}nt j||| }||_ |r||j fd|jD}t||z |_t|jfd|j D|_ |S)aNReturn 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 ancestorsof, to make bundles created from the instance more portable.N)r-rsservedc6g|]}|Srnoderctxs rr8z&findcommonoutgoing..s PPPcsxxzzPPPrssecret() or extinct()c:h|]}|Srrev)rrrFs r z%findcommonoutgoing..s#666Qrvvayy666rcg|]}|v| Srr)rrr?s rr8z&findcommonoutgoing..s#LLLq 7K7K!7K7K7Kr)r3r"r? _phasecache phaserootsr secretobsstorer,rfilteredr>rCr#rLrArBphaseextinctappendlennewheadsrN ancestors)r*other onlyheadsr- commonincportableog_any_hds mayexcluderM allmissingrRrCr[r]r missingrevsrFr?s @@rfindcommonoutgoingrxs9 $d # #B& %u)   "+BND$!,V];Lt}J %"2djjll  y117799PPTXX6N-O-OPPP ~// JJ!% J "" g!## h % %Dt*Cyy{{fm++s{{}}+%%%%t$$$$ w<<3z?? * *#KK /$ 8DDK$ M   """ ^6666"+666 k2233kA ".)) LLLLR^LLL Irc|j}|j}|j}|j}i}t }t }|jD]F}||} || || G| 5} | di } dddn #1swxYwY|j } | D]^\} }| |vr g}g}|D]8}| |r||#||9|t||f|| <_|D]} | |vrdggf|| <t!j|d| D}||d|D| D]\} }||| ddd<| D])\} }|D]}|||gfz|| <*|jr|jjfd|jD}|fd|jDz}|j|d }t3t5j|D]L\} }|\}}}}t9|||}|t3|d |t3|df|| <M|S) acompute a summary of branch and heads status before and after push return {'branch': ([remoteheads], [newheads], [unsyncedheads], [discardedheads])} mapping - branch: the branch name, - remoteheads: the list of remote heads known locally None if the branch is new, - newheads: the new remote heads (known locally) with outgoing pushed, - unsyncedheads: the list of remote heads unknown locally, - discardedheads: the list of heads made obsolete by the push. branchmapNc3@K|]\}}|d ||dfVdS)rNrrrbranchr,s rrz _headssummary..sE  Qx#U1X ####  rc3>K|]}|VdSrr_r\s rrz _headssummary.. s*99s999999rrc&h|] }|Srrrrtorevs rraz _headssummary..s!>>>AuuQxx>>>rc&h|] }|Srrrs rraz _headssummary..s!???Qa???rT) inclusiver)r* unfilteredr+r3r#r>rRaddr}commandexecutor callcommandresultr$itemsrjr)rremotebranchcacheupdatesortrfr`rr?rmsortedr iteritems_postprocessobsolete)pushopr*r+r3rFheadssum missingctxbranchesrr]e remotemaprr}r,knownunsyncedrnewmaprlrl futureheadsallfuturecommon remoteheads unsyncedheads placeholderrrs @r _headssummaryrs ; ! ! # #D ]FH BHJuuH  ##1gs SZZ\\""""    ! !=QMM,33::<< =============== I"** : :   ! !  # #Ay|| # Q""""!4;;9..  ! ! $b"~HV  (   !)!1!1   F MM$99j999:::"LLNN**!)AAA!))))   A} B5= } ">>>>)=>>> ????(*>???? .22;$2OO#H$6x$@$@AA  MFE@E =K=+)&/8LLFvay!!vay!!  HV   Os0)C%%C),C)c|jjtfd|D}|d||j}td|D}|rdg}ng}d|||gfiS)z;Compute branchmapsummary for repo without branchmap supportc32K|]}| |VdSrrrs rrz#_oldheadssummary...s0==A ! =a======rsheads(%ln + %ln)c3>K|]}|VdSrrZ)rcs rrz#_oldheadssummary..5s***1affhh******rN)r#r$rr>rR) r*rr3incoldheadsrrlrrs @r_oldheadssummaryr's &I=========H $h0@AAA*******H 6 8Xx4 55rc |j}|j}|j |5}|dddi}dddn #1swxYwYt} fd|j ddD} D]}| |}|rX||vrT| |||} } tj || | r'| | q||vr||vr| ||S)Nslistkeyss namespaces bookmarksc:g|]}|Sr) expandname)rblocalbookmarkss rr8z _nowarnheads..Os7  !!!$$rspushing)r*rr+ _bookmarksrrrr>r' configlistgetr validdestrr[) rr*r+rremotebookmarksbookmarkedheads newbookmarksbmrnodelctxrctxrs @r _nowarnheadsr>s ; ! ! # #D ]F_N    ! !Q-- l   &(( eeO%%lJ??L 88##B''  8Ud]]nR014;$D"4t44 1##DIIKK000\!!b&?&?##N2$6777 s+A44A8;A8c |j}|j}|j}|j}|j}t |j}||jgkrdS| drt|}nt||||}||_ d| D}|r|sdt|} t!} |D]\} } } }|r| | | t!|z} | r"t)d| t+| fz}nt)d| z}t)d}t-j||t1|}d}tt3j|D]\}} | \}}}}|t!}nt!|}||d}t!|}|||rd|vrd} nt9j||} | (|jt)d nY|+|jt)d | zn,|jt)d || fz|Ft+|d kr2tA|}|!t)d |z}t)d}n5t+|t+|krt||z |z }|rc||dvr(t)dtC|d|fz}n||d"rLt)dtC|d||d"dfz}n%t)dtC|dz}|rt)d}nt)d}|(|j#t)dn*|j#t)d|z|D],}|j#dtC|z-|rt-j||dS)zpCheck that a push won't add any outgoing head raise StateError error and display ui message as needed. Nrzc(g|]\}}|d |S)rrr|s rr8zcheckheads..}s, 65a8H8H8H8Hrs, s0push creates new remote branches: %s (%d closed)s$push creates new remote branches: %ss8use 'hg push --new-branch' to create new remote branches)hints,remote has heads that are not known locally s0remote has heads that are not known locally: %s s?remote has heads on branch '%s' that are not known locally: %s rs0push creates new branch '%s' with multiple headss?merge or see 'hg help push' for details about pushing new heads)sdefaultNs.push creates new remote head %s on branch '%s'rs2push creates new remote head %s with bookmark '%s'spush creates new remote head %ssHpull and merge or see 'hg help push' for details about pushing new headssnew remote heads: s!new remote heads on branch '%s': s %s )$r*rr+r3r newbranchboolincomingr6r!rr pushbranchmaprjoinrr>r iterbranchesrrrkr StateErrorrr rrr nodesummariesr'statusr)rrnote)rr*r+r3rrrr newbranches branchnamesclosedbranchestagr,tipisclosederrmsgr nowarnheadserrormsgr}rlrdiscardedheadsoldhsdhsnewhsrs r checkheadsrasb ; ! ! # #D ]FH$K I v  Ct{m## ~~l##F ((#D+xEE#F$,NN$4$4K292jj !4!455 )-)9)9)F)F)H)H ( ( %CX (""3''''#k*:*::  NJKKN##OFF >??+MFLMMvD1111v&&K H 28 < <==U2U2 ?D< X}n  EEEE $$E ]###H  ]###  }$$-dMBB}FGGJKK 3uo &  5zzA~~5kk#MNN !.D ZZ#e** $ $,u455C # 2!333 I  c!f  HH #a&\++-- .  s1vSV (>(>(@(@(CD EHH !!CDDuAHH H! .DD .D ~ Q5667777 QDEENOOO 2 2 Xa011114xd333344rc|j}|jjjt jjjfdfd}tj tj |j j }t}t}t}t} |D]r} | vr|| || ,d} |j| t'| z| | st)|dkr | t|ztfSt+jd} t/| z |rD|} | }| }|s|| vr|| ad| ||}g}|D]I}|}||kr'||Jt;fd|Ds7t;fd |Dst;fd |Dr|| n|| |D|| z}||fS) zpost process the list of new heads with obsolescence information Exists as a sub-function to contain the complexity and allow extensions to experiment with smarter logic. Returns (newheads, discarded_heads) tuple c$|kSrr)rgetphasepublicunfis rz&_postprocessobsolete.. s$**f4rc|vSrr)r futurecommonrs rrz&_postprocessobsolete.. sq\1rNs=checkheads: remote head unknown locally has local marker: %s rsobsoletesonly(%n, (%ln+%ln))c3.K|]}|VdSrr)rrispublics rrz'_postprocessobsolete..@s+00 000000rc32K|]}|vVdSrr)rrfuturenonobsoleters rrz'_postprocessobsolete..As1FFQ558800FFFFFFrc30K|]}| VdSrr)rr hasoutmarkers rrz'_postprocessobsolete..Bs.<<1||A&<<<<<rrr'debugrrkr getrevs frozensetpopr}revsrjr[r()rrcandidate_newhsr*ispushedsuccessorsmarkersr discardedlocalcandidate unknownheadsrmsgobsrevsnhrcurrent_branch branchrevs branchnodesrrrrrrrrs ` @@@@@@@rrrs ;D ??  D N (E ]F%H444444H11111H$%5t}hOOL 0 EEEIUUN55L     99   q ! ! ! ! $$Q''3+ cCFFl+++   Q     >ac/222CEE99t[11G!,//'9 $    ! ! E"IIb** 8A;; !7** IIbMMM YY "B    - -AQAxxzz^++""16688,,, 0000Z000 0 0 FFFFF+FFFFF <<<< <<<<<  IIbMMMM MM"   I $J \E ) rcF|j}|g}t|}|r|}||rdS||d}|D]I}|d} | s |dpd} | D]0} | |vr*|| || 1J|dS)atrue if some markers are to be pushed for node We cannot just look in to the pushed obsmarkers from the pushop because discovery might have filtered relevant markers. In addition listing all markers relevant to all changesets in the pushed set would be too expensive (O(len(repo))) (note: There are cache opportunity in this function. but it would requires a two dimensional stack.) TrrF)rr>rrrrj) rfrr[rstackseencurrentmarkersmnextsrs rrrOs!+ FE u::D  $))++ 8G   4#''44 $ $AaDE #!  $ $D==HHQKKKLLOOO $  $ 5r)NFN)NFNF)F)ri18nrr[rrrrr r r r r rrrr"r3rxrrrrrrrrrrs                        *;*;*;*;ZBBBBBBBBLHM====@SSSl6666.   FP4P4P4fXXXvr