HEX

Warning: set_time_limit() [function.set-time-limit]: Cannot set time limit - prohibited by configuration in /home/u547966/brikov.ru/www/wp-content/plugins/admin-menu-editor/menu-editor.php on line 745
Server: Apache
System: Linux 4.19.0-0.bpo.9-amd64 x86_64 at red40
User: u547966 (5490)
PHP: 5.3.29-mh2
Disabled: syslog, dl, popen, proc_open, proc_nice, proc_get_status, proc_close, proc_terminate, posix_mkfifo, chown, chgrp, accelerator_reset, opcache_reset, accelerator_get_status, opcache_get_status, pcntl_alarm, pcntl_fork, pcntl_waitpid, pcntl_wait, pcntl_wifexited, pcntl_wifstopped, pcntl_wifsignaled, pcntl_wifcontinued, pcntl_wexitstatus, pcntl_wtermsig, pcntl_wstopsig, pcntl_signal, pcntl_signal_dispatch, pcntl_get_last_error, pcntl_strerror, pcntl_sigprocmask, pcntl_sigwaitinfo, pcntl_sigtimedwait, pcntl_exec, pcntl_getpriority, pcntl_setpriority
Upload Files
File: //usr/lib/python2.7/dist-packages/mercurial/setdiscovery.pyc
ó
ÛXc@@s§dZddlmZddlZddlZddlmZddlmZm	Z	ddl
mZmZdd„Z
d	„Zd
„Zd„Zdd
ed„ZdS(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(tabsolute_importNi(t_(tnullidtnullrev(tdagutilterrorcC@s8|r|j|ƒ}n|jƒ}i}tj|ƒ}tƒ}d}xé|r3|jƒ}	|	|kroqKn|j|	dƒ}
|
|krš|d9}n|
|krÒ|j|	ƒ|rÒt|ƒ|krÒdSn|j|	ƒxN|j	|	ƒD]=}|s||krï|j||
dƒ|j
|ƒqïqïWqKWdS(s'update an existing sample to match the expected size

    The sample is updated with nodes exponentially distant from each head of the
    <nodes> set. (H~1, H~2, H~4, H~8, etc).

    If a target size is specified, the sampling will stop once this size is
    reached. Otherwise sampling will happen until roots of the <nodes> set are
    reached.

    :dag: a dag object from dagutil
    :nodes:  set of nodes we want to discover (if None, assume the whole dag)
    :sample: a sample to update
    :quicksamplesize: optional target size of the sampleiiN(theadsetofconnectedstheadstcollectionstdequetsettpopleftt
setdefaulttaddtlentparentstappend(tdagtnodestsampletquicksamplesizeRtdisttvisittseentfactortcurrtdtp((s:/usr/lib/python2.7/dist-packages/mercurial/setdiscovery.pyt
_updatesample:s.		


cC@sH|j|ƒ}|t|ƒkr.t||ƒSt|d|d|ƒ|S(sðtakes a quick sample of size <size>

    It is meant for initial sampling and focuses on querying heads and close
    ancestors of heads.

    :dag: a dag object
    :nodes: set of nodes to discover
    :size: the maximum size of the sampleRN(RRt_limitsampleRtNone(RRtsizeR((s:/usr/lib/python2.7/dist-packages/mercurial/setdiscovery.pyt_takequicksamplebs
	
cC@sœ|j|ƒ}t|||ƒt|jƒ||ƒ|sAt‚t||ƒ}t|ƒ|kr˜|t|ƒ}|jtjt	||ƒ|ƒƒn|S(N(
RRtinversetAssertionErrorRRtupdatetrandomRtlist(RRRRtmore((s:/usr/lib/python2.7/dist-packages/mercurial/setdiscovery.pyt_takefullsampleqs&cC@s1t|ƒ|kr-ttj||ƒƒ}n|S(s;return a random subset of sample of at most desiredlen item(RR
R$R(Rt
desiredlen((s:/usr/lib/python2.7/dist-packages/mercurial/setdiscovery.pyR~sidiÈc@s—d}|j}tj|ƒ}|jdƒ|d7}|jƒ}	t|	|ƒ}
t|
ƒ}
|jƒ}|jƒ|j|j	|
ƒƒ|j
ƒ|jƒ\}‰|jƒt
krå|t
gkrÕt
gt|fSt
gtgfS|jtdƒƒ|j|dtƒ}
t|
ƒt|ƒkr?|jdƒ|t|fS|
r’t|	ƒ|kr’tˆƒr’|jtdƒƒ|j	|	ƒ}|t|fS|j|
ƒ}t‡fd†t|
ƒDƒƒ}|j|ƒt|j|	ƒƒ}tƒ}t}xØ|rÎ|
r[gt|
ƒD]\}}ˆ|s|^q}|j|j||ƒƒ|j|ƒn|sePn|sw|jƒr¯|r“|jtd	ƒƒn
|jd
ƒt}|}n|jdƒt }|}t|ƒ|krét|ƒ}
n!||||ƒ}
t|
|ƒ}
|d7}|j!tdƒ|d
tdƒƒ|jd|t|ƒt|
ƒfƒt|
ƒ}
|j|j	|
ƒƒ‰t}|
r÷t‡fd†t|
ƒDƒƒ}|j|ƒ|j"|ƒq÷q÷W|j#|j$ƒ}|j%t&ƒ|j!tdƒdƒ|jd|ƒ|rr|t
gkrr|rIt(j)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
issearching for changes
t
filterunknownsall remote heads known locally
sall local heads known remotely
c3@s%|]\}}ˆ|r|VqdS(N((t.0titn(tyesno(s:/usr/lib/python2.7/dist-packages/mercurial/setdiscovery.pys	<genexpr>µsssampling from both directions
staking initial sample
staking quick initial sample
t	searchingtunittqueriess2query %i; still undecided: %i, sample size is: %i
c3@s%|]\}}ˆ|r|VqdS(N((R*R+R,(R-(s:/usr/lib/python2.7/dist-packages/mercurial/setdiscovery.pys	<genexpr>äss%d total queries
srepository is unrelateds!warning: repository is unrelated
N(+t	changelogRt	revlogdagtdebugRRR%t	iterbatchtknowntexternalizealltsubmittresultsttipRtTruetFalsetstatusRtinternalizeallRtalltnotetincrementalmissingrevsR
t	enumeratetaddbasestmissingancestorsR#t
descendantsettdifference_updatethasbasesR'R tprogresstremoveancestorsfromRtbasestdiscardRRRtAborttwarn(tuitlocaltremotetinitialsamplesizetfullsamplesizetabortwhenunrelatedt
roundtripstclRtownheadsRtbatcht
srvheadhashestsrvheadst
ownheadhashestcommontcommoninsamplet	undecidedtmissingtfullR+R,tmissinginsamplet
samplefunct
targetsizetresulttanyincoming((R-s:/usr/lib/python2.7/dist-packages/mercurial/setdiscovery.pytfindcommonheads„s”	





$
"
		/
	

"	"

(t__doc__t
__future__RRR$ti18nRtnodeRRtRRRR R'RR:Rd(((s:/usr/lib/python2.7/dist-packages/mercurial/setdiscovery.pyt<module>)s(