-=[ Mr. Bumblebee ]=-
_Indonesia_

Path : /usr/lib/python2.7/dist-packages/bzrlib/
File Upload :
Current File : //usr/lib/python2.7/dist-packages/bzrlib/rename_map.pyc

ó
¦îNc@@svddlmZddlmZddlmZmZmZddlm	Z	ddl
mZdefd„ƒYZ
dS(	i(tabsolute_import(tStringIO(tosutilstprogressttrace(t
ui_factory(tgettextt	RenameMapcB@s˜eZdZd„Zed„ƒZd„Zd„Zd„Zd„Z	d„Z
ed„ƒZd	„Zd
„Z
d„Zeed„ƒZd
„ZRS(sDetermine a mapping of renames.cC@s||_i|_dS(N(ttreetedge_hashes(tselfR((s5/usr/lib/python2.7/dist-packages/bzrlib/rename_map.pyt__init__ s	cc@sGd}x:tt|ƒƒD]&}tt|||d!ƒƒ|VqWdS(s8Iterate through the hashes of line pairs (which make up an edge).

        The hash is truncated using a modulus to avoid excessive memory
        consumption by the hitscount dict.  A modulus of 10Mi means that the
        maximum number of keys is 10Mi.  (Keys are normally 32 bits, e.g.
        4 Gi)
        ii
iNii (trangetlenthashttuple(tlinestmodulustn((s5/usr/lib/python2.7/dist-packages/bzrlib/rename_map.pytiter_edge_hashes$s	cC@s=x6|j|ƒD]%}|jj|tƒƒj|ƒqWdS(sÀUpdate edge_hashes to include the given lines.

        :param lines: The lines to update the hashes for.
        :param tag: A tag uniquely associated with these lines (i.e. file-id)
        N(RR	t
setdefaulttsettadd(R
Rttagtmy_hash((s5/usr/lib/python2.7/dist-packages/bzrlib/rename_map.pytadd_edge_hashes1sc
C@sÅg|D]}||f^q}tjƒ}zˆxt|j|ƒƒD]j\}\}}|jtdƒ|t|ƒƒtƒ}	|	j|ƒ|	j	dƒ|j
|	jƒ|ƒqDWWd|jƒXdS(s¹Update to reflect the hashes for files in the tree.

        :param tree: The tree containing the files.
        :param file_ids: A list of file_ids to perform the updates for.
        sCalculating hashesiN(
Rtnested_progress_bart	enumeratetiter_files_bytestupdateRR
Rt
writelinestseekRt	readlinestfinished(
R
Rtfile_idstft
desired_filesttasktnumtfile_idtcontentsts((s5/usr/lib/python2.7/dist-packages/bzrlib/rename_map.pytadd_file_edge_hashes:s"	

cC@s’i}x…|j|ƒD]t}|jj|ƒ}|dkr@qnt|ƒ}x;|D]3}||krrd||<n||cd|7<qSWqW|S(s^Count the number of hash hits for each tag, for the given lines.

        Hits are weighted according to the number of tags the hash is
        associated with; more tags means that the hash is less rare and should
        tend to be ignored.
        :param lines: The lines to calculate hashes of.
        :return: a dict of {tag: hitcount}
        igð?N(RR	tgettNoneR
(R
RthitsRttagsttaglenR((s5/usr/lib/python2.7/dist-packages/bzrlib/rename_map.pyt	hitcountsMs	

c@s¨g}tjƒ}z„x}t|ƒD]o\}‰|jtdƒ|t|ƒƒ|j|jjddˆƒƒ}|j
‡fd†|jƒDƒƒq"WWd|jƒX|S(s~Find all the hit counts for the listed paths in the tree.

        :return: A list of tuples of count, path, file_id.
        sDetermining hash hitstpathc3@s$|]\}}|ˆ|fVqdS(N((t.0tktv(R1(s5/usr/lib/python2.7/dist-packages/bzrlib/rename_map.pys	<genexpr>nsN(
RRRRRR
R0Rtget_file_linesR,textendtitemsR!(R
tpathstall_hitsR%R&R-((R1s5/usr/lib/python2.7/dist-packages/bzrlib/rename_map.pytget_all_hitsbs+cC@s|j|j|ƒƒS(s5Return a mapping from file_ids to the supplied paths.(t_match_hitsR:(R
R8((s5/usr/lib/python2.7/dist-packages/bzrlib/rename_map.pyt
file_matchsscC@sntƒ}i}xXt|dtƒD]D\}}}||ks"||krOq"n|||<|j|ƒq"W|S(sàUsing a hit list, determine a path-to-fileid map.

        The hit list is a list of (count, path, file_id), where count is a
        (possibly float) number, with higher numbers indicating stronger
        matches.
        treverse(RtsortedtTrueR(thit_listt
seen_file_idstpath_maptcountR1R'((s5/usr/lib/python2.7/dist-packages/bzrlib/rename_map.pyR;ws	"
c
C@säi}xe|D]]}xTtri|}tj|ƒ}|jj|ƒdk	rMPn|j|gƒj|ƒqWq
Wi}xi|jƒD][\}}t	ƒ}x9|D]1}|j
|ƒ}	|	dk	r|j|	ƒqqW|||<qW|S(s Return a dict of all file parents that must be versioned.

        The keys are the required parents and the values are sets of their
        children.
        N(R?RtdirnameRtpath2idR,Rtappendt	iteritemsRR+R(
R
tmatchestrequired_parentsR1tchildtrequire_idstparenttchildrentchild_file_idsR'((s5/usr/lib/python2.7/dist-packages/bzrlib/rename_map.pytget_required_parentsˆs"
	!	
c	C@s‡g}xq|jƒD]c\}}xT|jƒD]F\}}t|j|ƒƒ}|dkr,|j|||fƒq,q,WqW|j|ƒS(säMap parent directories to file-ids.

        This is done by finding similarity between the file-ids of children of
        required parent directories and the file-ids of children of missing
        parent directories.
        i(RGR
tintersectionRFR;(	R
RItmissing_parentsR9R'tfile_id_childrenR1t
path_childrenR-((s5/usr/lib/python2.7/dist-packages/bzrlib/rename_map.pyt
match_parents s!c	C@s«tƒ}i}tƒ}tjƒ}|jj|dtd|ƒ}zNxG|D]?\}}}	}
}}}
}|
ddkrÇ|
drÇ|j|dtƒƒj|ƒ|
ddkrÇ|j|ƒqÇn|
t	t	fkrL|jj
|dƒrõqLn|
ddkr|j|dƒn|
ddkr‹x\|jj|dƒD]A\}}x2|D]*}|ddkrS|j|dƒqSqSWq@Wq‹qLqLWWd|jƒX|||fS(Ntwant_unversionedtpbiitfilet	directoryi(
RRRRtiter_changesR?R,RRtFalset
is_ignoredtwalkdirsR!(R
tbasist
missing_filesRQtcandidate_filesR%titeratorR'R8tchanged_contentt	versionedRLtnametkindt
executablet_dirRMRJ((s5/usr/lib/python2.7/dist-packages/bzrlib/rename_map.pyt_find_missing_files¯s4			" #
*cC@s‹i}tjƒ}zgtjdd|ƒ}|jƒ}|jƒzL||ƒ}|jƒ|j|ƒ\}}	}
|jƒ|j||ƒWd|j	ƒX|jƒ|j
|
ƒ}|}xDt|ƒdkrÿ|j|ƒ}|j
||	ƒ}|j|ƒq¼W|jƒ|j|ƒ}
x9|
D]1\}}}}tjtdƒj||ƒƒq W|sx|j|ƒ|j|
ƒnWd|jƒXdS(s÷Guess which files to rename, and perform the rename.

        We assume that unversioned files and missing files indicate that
        versioned files have been renamed outside of Bazaar.

        :param tree: A write-locked working tree.
        sGuessing renamesiNis
{0} => {1}(RRRt
ProgressPhaset
basis_treet	lock_readt
next_phaseRgR*tunlockR<R
RORTRt_make_inventory_deltaRtnoteRtformatRtapply_inventory_deltaR!(tklassRtdry_runRIR%tppR]trnR^RQR_RHtparents_matchestdeltatoldtnewR'tentry((s5/usr/lib/python2.7/dist-packages/bzrlib/rename_map.pyt
guess_renamesÎs<	



			
#
cC@sÿg}td„|jƒDƒƒ}xÖ|jj|jƒƒD]¼\}}||j}tj|ƒ\}}|j|ƒ}	|	dkr™|jj
|ƒ}	n|j|kr½|j|	kr½q;n|j
ƒ}
|	|
_||
_|j|||
j|
fƒq;W|S(Ncs@s!|]\}}||fVqdS(N((R2tpR#((s5/usr/lib/python2.7/dist-packages/bzrlib/rename_map.pys	<genexpr>ûs(tdictR7Rtiter_entries_by_dirtvaluesR'RtsplitR+R,RERct	parent_idtcopyRF(R
RHRvtfile_id_matchestold_pathRytnew_pathtparent_pathtnew_nameR€t	new_entry((s5/usr/lib/python2.7/dist-packages/bzrlib/rename_map.pyRmùs%
		 (t__name__t
__module__t__doc__RtstaticmethodRRR*R0R:R<R;RORTRgtclassmethodRZRzRm(((s5/usr/lib/python2.7/dist-packages/bzrlib/rename_map.pyRs	
									*N(t
__future__Rt	cStringIORtbzrlibRRRt	bzrlib.uiRtbzrlib.i18nRtobjectR(((s5/usr/lib/python2.7/dist-packages/bzrlib/rename_map.pyt<module>s


Copyright © 2017 || Recoded By Mr.Bumblebee