-=[ Mr. Bumblebee ]=-
_Indonesia_

Path : /usr/lib/python2.7/dist-packages/mercurial/
File Upload :
Current File : //usr/lib/python2.7/dist-packages/mercurial/setdiscovery.pyc

ó
Ì\,Tc@s‡dZddlmZddlmZddlZddlZddlZdd„Zd„Z	d„Z
d	„Zd
ded„Z
dS(
s;
Algorithm works in the following way. You have two repository: local and
remote. They both contains a DAG of changelists.

The goal of the discovery protocol is to find one set of node *common*,
the set of nodes shared by local and remote.

One of the issue with the original protocol was latency, it could
potentially require lots of roundtrips to discover that the local repo was a
subset of remote (which is a very common case, you usually have few changes
compared to upstream, while upstream probably had lots of development).

The new protocol only requires one interface for the remote repo: `known()`,
which given a set of changelists tells you if they are present in the DAG.

The algorithm then works as follow:

 - We will be using three sets, `common`, `missing`, `unknown`. Originally
 all nodes are in `unknown`.
 - Take a sample from `unknown`, call `remote.known(sample)`
   - For each node that remote knows, move it and all its ancestors to `common`
   - For each node that remote doesn't know, move it and all its descendants
   to `missing`
 - Iterate until `unknown` is empty

There are a couple optimizations, first is instead of starting with a random
sample of missing, start by sending all heads, in the case where the local
repo is a subset, you computed the answer in one round trip.

Then you can do something similar to the bisecting strategy used when
finding faulty changesets. Instead of random samples, you can try picking
nodes that will maximize the number of nodes that will be
classified with it (since all ancestors or descendants will be marked as well).
iÿÿÿÿ(tnullid(t_Nic
CsG|r|j|ƒ}n|jƒ}i}tj|ƒ}tƒ}d}	xø|rB|jƒ}
|
|kroqKn|j|
dƒ}||	krš|	d9}	n||	krá|
|krá|j|
ƒ|rÞt|ƒ|krÞdSqán|j|
ƒxN|j	|
ƒD]=}|s||krþ|j||dƒ|j
|ƒqþqþWqKWdS(Nii(theadsetofconnectedstheadstutiltdequetsettpopleftt
setdefaulttaddtlentparentstappend(
tdagtnodestsampletalwaystquicksamplesizeRtdisttvisittseentfactortcurrtdtp((s:/usr/lib/python2.7/dist-packages/mercurial/setdiscovery.pyt
_updatesample0s0		



cCsmt|ƒ|kr%t|ƒddfS|j|ƒ}|t|ƒ}|dkr]|d|fS|tƒ|fS(Ni(R
RtNoneR(R
RtsizeRt
desiredlen((s:/usr/lib/python2.7/dist-packages/mercurial/setdiscovery.pyt_setupsampleLs
cCsjt|||ƒ\}}}|dkr+|S|r:d}n|}t||||d|ƒ|j|ƒ|S(NR(RRRtupdate(R
RRtinitialRRRtfromset((s:/usr/lib/python2.7/dist-packages/mercurial/setdiscovery.pyt_takequicksampleWs	
cCsít|||ƒ\}}}|dkr+|St||||ƒt|jƒ|||ƒ|sct‚t|ƒ|krttj||ƒƒ}nLt|ƒ|krÜ|t|ƒ}|j	tjt
|||ƒ|ƒƒn|j	|ƒ|S(N(RRRtinversetAssertionErrorR
RtrandomRRtlist(R
RRRRRtmore((s:/usr/lib/python2.7/dist-packages/mercurial/setdiscovery.pyt_takefullsamplecs*
idiÈcs…d}|j}tj|ƒ}|jdƒ|d7}|jƒ}	|	}
|jƒrz|jƒ}|j|j|
ƒƒ‰np|jdƒrØ|j	ƒ}|jƒ}
|j|j|
ƒƒ}|j
ƒ|
j}|j‰n|jƒ}g}
|jƒt
kr+|t
gkrt
gt|fSt
gtgfS|jtdƒƒ|j|dtƒ}t|ƒt|ƒkr…|jdƒ|t|fS|
rÉtjˆƒrÉ|jtdƒƒ|j|	ƒ}|t|fS|jƒ}tƒ}tƒ}|j|j|ƒƒ|j|ƒt}xº|rÌ|
r¿t‡fd	†t|
ƒDƒƒ}|j|j||ƒƒgt|
ƒD]\}}ˆ|sg|^qg}|j|j||ƒƒ|j|ƒ|j|ƒn|sÉPn|rú|jtd
ƒƒt||d|ƒ}
nS|r%|jdƒt||d|ƒ}
n(|jd
ƒt||d|dtƒ}
|d7}|j tdƒ|dtdƒƒ|jd|t|ƒt|
ƒfƒt!|
ƒ}
|j|j|
ƒƒ‰t}qW|j"|ƒ}|j tdƒdƒ|jd|ƒ|r`|t
gkr`|r7tj$tdƒƒ‚n|j%tdƒƒtt
gƒt|fS|t
gk}|j|ƒ||fS(slReturn a tuple (common, anyincoming, remoteheads) used to identify
    missing nodes from or in remote.
    isquery 1; heads
itbatchssearching for changes
t
filterunknownsall remote heads known locally
sall local heads known remotely
c3s%|]\}}ˆ|r|VqdS(N((t.0titn(tyesno(s:/usr/lib/python2.7/dist-packages/mercurial/setdiscovery.pys	<genexpr>ºsssampling from both directions
Rstaking initial sample
staking quick initial sample
Rt	searchingtunittqueriess2query %i; still undecided: %i, sample size is: %i
s%d total queries
srepository is unrelateds!warning: repository is unrelated
N(&t	changelogtdagutilt	revlogdagtdebugRtlocaltknowntexternalizealltcapableR(tsubmittvaluettipRtTruetFalsetstatusRtinternalizeallR
RtalltnotetnodesetRRtancestorsettdifference_updatet	enumeratet
descendantsetR'R!tprogressR%RRtAborttwarn(tuiR5tremotetinitialsamplesizetfullsamplesizetabortwhenunrelatedt
roundtripstclR
townheadsRt
srvheadhashesR(tsrvheadhashesreftyesnoreftsrvheadst
ownheadhashest	undecidedtcommontmissingtfulltcommoninsampleR+R,tmissinginsampletresulttanyincoming((R-s:/usr/lib/python2.7/dist-packages/mercurial/setdiscovery.pytfindcommonheadsts”	


	


		
	"/


	
"	
(t__doc__tnodeRti18nRR$RR2RRR!R'R<R_(((s:/usr/lib/python2.7/dist-packages/mercurial/setdiscovery.pyt<module>)s			

Copyright © 2017 || Recoded By Mr.Bumblebee