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/pvec.pyc
ó
ÛXc@@sdZddlmZddlmZddlmZmZdZedZ	dZ
e
dZe	eZedZ
e
d	d
Zd„Zd„Zd
„Zd„Zd„ZgedƒD]Zeeƒ^q¸Zd„Zd„Zd„Zd„Zdefd„ƒYZdS(s3
A "pvec" is a changeset property based on the theory of vector clocks
that can be compared to discover relatedness without consulting a
graph. This can be useful for tasks like determining how a
disconnected patch relates to a repository.

Currently a pvec consist of 448 bits, of which 24 are 'depth' and the
remainder are a bit vector. It is represented as a 70-character base85
string.

Construction:

- a root changeset has a depth of 0 and a bit vector based on its hash
- a normal commit has a changeset where depth is increased by one and
  one bit vector bit is flipped based on its hash
- a merge changeset pvec is constructed by copying changes from one pvec into
  the other to balance its depth

Properties:

- for linear changes, difference in depth is always <= hamming distance
- otherwise, changes are probably divergent
- when hamming distance is < 200, we can reliably detect when pvecs are near

Issues:

- hamming distance ceases to work over distances of ~ 200
- detecting divergence is less accurate when the common ancestor is very close
  to either revision or total distance is high
- this could probably be improved by modeling the relation between
  delta and hdist

Uses:

- a patch pvec can be used to locate the nearest available common ancestor for
  resolving conflicts
- ordering of patches can be established without a DAG
- two head pvecs can be compared to determine whether push/pull/merge is needed
  and approximately how many changesets are involved
- can be used to find a heuristic divergence measure between changesets on
  different branches
i(tabsolute_importi(tnullrev(tbase85tutiliÀiiiicC@s/d}x"|D]}|dt|ƒ}q
W|S(sconvert a bytestring to a longii(tord(tbstvtb((s2/usr/lib/python2.7/dist-packages/mercurial/pvec.pyt_binCs
cC@s?d}x2t|ƒD]$}t|d@ƒ|}|dL}qW|S(Ntiÿi(txrangetchr(RtlRtp((s2/usr/lib/python2.7/dist-packages/mercurial/pvec.pyt_strJs
cC@st|t ƒt|tƒfS(sdepth and bitvec(Rt_depthbytes(R((s2/usr/lib/python2.7/dist-packages/mercurial/pvec.pyt_splitQscC@st|tƒt|tƒS(N(RRt	_vecbytes(tdepthtbitvec((s2/usr/lib/python2.7/dist-packages/mercurial/pvec.pyt_joinUscC@s8d}x+|r3|d@r&|d7}n|dL}q	W|S(Nii((txtc((s2/usr/lib/python2.7/dist-packages/mercurial/pvec.pyt_hweightXs	

icC@s=||A}d}x&|r8|t|d@7}|dL}qW|S(s+find the hamming distance between two longsiiÿi(t_htab(taRtdR((s2/usr/lib/python2.7/dist-packages/mercurial/pvec.pyt_hammingas
	cC@sÿ|\}}|\}}||krE||||f\}}}}nt||ƒ}||}|}	||A}
d}||kr•||dd}nd}||}
|
ræxG|râ|
|@rÕ|	|N}	|d8}n|dK}q®Wnt|	|ƒ}	|
|	fS(Nii(Rt_flipbit(RtyRtd1tv1td2tv2thdisttddistRtmtitchangesR((s2/usr/lib/python2.7/dist-packages/mercurial/pvec.pyt	_mergevecjs*!


	


cC@s t|ƒd@t}|d|>AS(NIÿÿÿÿi(thasht_vecbits(Rtnodetbit((s2/usr/lib/python2.7/dist-packages/mercurial/pvec.pyRscC@sU|jƒ}tj|dƒs*i|_n|j}|jƒ|kr,|j}xÛt|jƒdƒD]À}||kre|j|ƒ}|j|ƒ\}}|t	krÈdt
|dt ƒf||<q%|t	kr||\}}	|dt|	|ƒf||<q%t
|||||ƒ||<qeqeWnt||jƒŒ}
ttj|
ƒƒS(s3construct a pvec for ctx while filling in the cachet
_pveccacheiii(trepoRtsafehasattrR,trevt	changelogR
R*t
parentrevsRRRRR'RtpvecRt	b85encode(tctxtrtpvctcltnR*tp1tp2RRR((s2/usr/lib/python2.7/dist-packages/mercurial/pvec.pytctxpvec”s$		! (R2cB@sYeZd„Zd„Zd„Zd„Zd„Zd„Zd„Zd„Z	d„Z
RS(	cC@sOt|tƒr<||_ttj|ƒƒ\|_|_nt|ƒ|_dS(N(	t
isinstancetstrt_bsRRt	b85decodet_deptht_vecR;(tselft	hashorctx((s2/usr/lib/python2.7/dist-packages/mercurial/pvec.pyt__init__¬s	$cC@s|jS(N(R>(RB((s2/usr/lib/python2.7/dist-packages/mercurial/pvec.pyt__str__³scC@s"|j|jko!|j|jkS(N(RAR@(RBR((s2/usr/lib/python2.7/dist-packages/mercurial/pvec.pyt__eq__¶scC@sC|j|j}|dkr tSt|j|jƒ|kr?tStS(Ni(R@tFalseRRAtTrue(RBRtdelta((s2/usr/lib/python2.7/dist-packages/mercurial/pvec.pyt__lt__¹scC@s
||kS(N((RBR((s2/usr/lib/python2.7/dist-packages/mercurial/pvec.pyt__gt__ÁscC@s9t|j|jƒ}t|j|jƒ|kr5tStS(N(tabsR@RRARGRH(RBRRI((s2/usr/lib/python2.7/dist-packages/mercurial/pvec.pyt__or__ÄscC@s'||Brtdƒ‚n|j|jS(Nsconcurrent pvecs(t
ValueErrorR@(RBR((s2/usr/lib/python2.7/dist-packages/mercurial/pvec.pyt__sub__Ês
cC@s8t|j|jƒ}t|j|jƒ}t||ƒS(N(RLR@RRAtmax(RBRRth((s2/usr/lib/python2.7/dist-packages/mercurial/pvec.pytdistanceÏscC@sEt|j|jƒ}|tks=t|j|jƒtkrAtSdS(N(RLRR@t_radiusRRARG(RBRtdist((s2/usr/lib/python2.7/dist-packages/mercurial/pvec.pytnearÔs'(t__name__t
__module__RDRERFRJRKRMRORRRU(((s2/usr/lib/python2.7/dist-packages/mercurial/pvec.pyR2«s								N(t__doc__t
__future__RR*RR	RRt_sizet_bytest
_depthbitsRRR)RSRRRRRR
RRRR'RR;tobjectR2(((s2/usr/lib/python2.7/dist-packages/mercurial/pvec.pyt<module>1s*



					%			%