-=[ Mr. Bumblebee ]=-
_Indonesia_

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


5Qc@@sdZddlmZddlZddlZddlZddlZddlmZddlZddl	Z	ddl
Z
ddlZddlm
Z
mZmZmZmZmZmZmZmZmZdZdZdefd	YZd
efdYZdefd
YZejdZdefdYZy>ddl m!Z!m"Z"m#Z#m$Z$m%Z%m&Z&m'Z(m)Z)WnZe*k
rZ+ej,e+ddl-m!Z!m"Z"m#Z#m$Z$m%Z%m&Z&eZ)eZ(nXdS(s#"DirState objects record the state of a directory and its bzr metadata.

Pseudo EBNF grammar for the state file. Fields are separated by NULLs, and
lines by NL. The field delimiters are ommitted in the grammar, line delimiters
are not - this is done for clarity of reading. All string data is in utf8.

::

    MINIKIND = "f" | "d" | "l" | "a" | "r" | "t";
    NL = "\n";
    NULL = "\0";
    WHOLE_NUMBER = {digit}, digit;
    BOOLEAN = "y" | "n";
    REVISION_ID = a non-empty utf8 string;
    
    dirstate format = header line, full checksum, row count, parent details,
     ghost_details, entries;
    header line = "#bazaar dirstate flat format 3", NL;
    full checksum = "crc32: ", ["-"], WHOLE_NUMBER, NL;
    row count = "num_entries: ", WHOLE_NUMBER, NL;
    parent_details = WHOLE NUMBER, {REVISION_ID}* NL;
    ghost_details = WHOLE NUMBER, {REVISION_ID}*, NL;
    entries = {entry};
    entry = entry_key, current_entry_details, {parent_entry_details};
    entry_key = dirname,  basename, fileid;
    current_entry_details = common_entry_details, working_entry_details;
    parent_entry_details = common_entry_details, history_entry_details;
    common_entry_details = MINIKIND, fingerprint, size, executable
    working_entry_details = packed_stat
    history_entry_details = REVISION_ID;
    executable = BOOLEAN;
    size = WHOLE_NUMBER;
    fingerprint = a nonempty utf8 sequence with meaning defined by minikind.

Given this definition, the following is useful to know::

    entry (aka row) - all the data for a given key.
    entry[0]: The key (dirname, basename, fileid)
    entry[0][0]: dirname
    entry[0][1]: basename
    entry[0][2]: fileid
    entry[1]: The tree(s) data for this path and id combination.
    entry[1][0]: The current tree
    entry[1][1]: The second tree

For an entry for a tree, we have (using tree 0 - current tree) to demonstrate::

    entry[1][0][0]: minikind
    entry[1][0][1]: fingerprint
    entry[1][0][2]: size
    entry[1][0][3]: executable
    entry[1][0][4]: packed_stat

OR (for non tree-0)::

    entry[1][1][4]: revision_id

There may be multiple rows at the root, one per id present in the root, so the
in memory root row is now::

    self._dirblocks[0] -> ('', [entry ...]),

and the entries in there are::

    entries[0][0]: ''
    entries[0][1]: ''
    entries[0][2]: file_id
    entries[1][0]: The tree data for the current tree for this fileid at /
    etc.

Kinds::

    'r' is a relocated entry: This path is not present in this tree with this
        id, but the id can be found at another location. The fingerprint is
        used to point to the target location.
    'a' is an absent entry: In that tree the id is not present at this path.
    'd' is a directory entry: This path in this tree is a directory with the
        current file id. There is no fingerprint for directories.
    'f' is a file entry: As for directory, but it's a file. The fingerprint is
        the sha1 value of the file's canonical form, i.e. after any read
        filters have been applied to the convenience form stored in the working
        tree.
    'l' is a symlink entry: As for directory, but a symlink. The fingerprint is
        the link target.
    't' is a reference to a nested subtree; the fingerprint is the referenced
        revision.

Ordering:

The entries on disk and in memory are ordered according to the following keys::

    directory, as a list of components
    filename
    file-id

--- Format 1 had the following different definition: ---

::

    rows = dirname, NULL, basename, NULL, MINIKIND, NULL, fileid_utf8, NULL,
        WHOLE NUMBER (* size *), NULL, packed stat, NULL, sha1|symlink target,
        {PARENT ROW}
    PARENT ROW = NULL, revision_utf8, NULL, MINIKIND, NULL, dirname, NULL,
        basename, NULL, WHOLE NUMBER (* size *), NULL, "y" | "n", NULL,
        SHA1

PARENT ROW's are emitted for every parent that is not in the ghosts details
line. That is, if the parents are foo, bar, baz, and the ghosts are bar, then
each row will have a PARENT ROW for foo and baz, but not for bar.


In any tree, a kind of 'moved' indicates that the fingerprint field
(which we treat as opaque data specific to the 'kind' anyway) has the
details for the id of this row in that tree.

I'm strongly tempted to add a id->path index as well, but I think that
where we need id->path mapping; we also usually read the whole file, so
I'm going to skip that for the moment, as we have the ability to locate
via bisect any path in any tree, and if we lookup things by path, we can
accumulate an id->path mapping as we go, which will tend to match what we
looked for.

I plan to implement this asap, so please speak up now to alter/tweak the
design - and once we stabilise on this, I'll update the wiki page for
it.

The rationale for all this is that we want fast operations for the
common case (diff/status/commit/merge on all files) and extremely fast
operations for the less common but still occurs a lot status/diff/commit
on specific files). Operations on specific files involve a scan for all
the children of a path, *in every involved tree*, which the current
format did not accommodate.
----

Design priorities:
 1. Fast end to end use for bzr's top 5 uses cases. (commmit/diff/status/merge/???)
 2. fall back current object model as needed.
 3. scale usably to the largest trees known today - say 50K entries. (mozilla
    is an example of this)


Locking:

 Eventually reuse dirstate objects across locks IFF the dirstate file has not
 been modified, but will require that we flush/ignore cached stat-hit data
 because we won't want to restat all files on disk just because a lock was
 acquired, yet we cannot trust the data after the previous lock was released.

Memory representation::

 vector of all directories, and vector of the childen ?
   i.e.
     root_entrie = (direntry for root, [parent_direntries_for_root]),
     dirblocks = [
     ('', ['data for achild', 'data for bchild', 'data for cchild'])
     ('dir', ['achild', 'cchild', 'echild'])
     ]
    - single bisect to find N subtrees from a path spec
    - in-order for serialisation - this is 'dirblock' grouping.
    - insertion of a file '/a' affects only the '/' child-vector, that is, to
      insert 10K elements from scratch does not generates O(N^2) memoves of a
      single vector, rather each individual, which tends to be limited to a
      manageable number. Will scale badly on trees with 10K entries in a
      single directory. compare with Inventory.InventoryDirectory which has
      a dictionary for the children. No bisect capability, can only probe for
      exact matches, or grab all elements and sort.
    - What's the risk of error here? Once we have the base format being processed
      we should have a net win regardless of optimality. So we are going to
      go with what seems reasonable.

open questions:

Maybe we should do a test profile of the core structure - 10K simulated
searches/lookups/etc?

Objects for each row?
The lifetime of Dirstate objects is current per lock, but see above for
possible extensions. The lifetime of a row from a dirstate is expected to be
very short in the optimistic case: which we are optimising for. For instance,
subtree status will determine from analysis of the disk data what rows need to
be examined at all, and will be able to determine from a single row whether
that file has altered or not, so we are aiming to process tens of thousands of
entries each second within the dirstate context, before exposing anything to
the larger codebase. This suggests we want the time for a single file
comparison to be < 0.1 milliseconds. That would give us 10000 paths per second
processed, and to scale to 100 thousand we'll another order of magnitude to do
that. Now, as the lifetime for all unchanged entries is the time to parse, stat
the file on disk, and then immediately discard, the overhead of object creation
becomes a significant cost.

Figures: Creating a tuple from 3 elements was profiled at 0.0625
microseconds, whereas creating a object which is subclassed from tuple was
0.500 microseconds, and creating an object with 3 elements and slots was 3
microseconds long. 0.1 milliseconds is 100 microseconds, and ideally we'll get
down to 10 microseconds for the total processing - having 33% of that be object
creation is a huge overhead. There is a potential cost in using tuples within
each row which is that the conditional code to do comparisons may be slower
than method invocation, but method invocation is known to be slow due to stack
frame creation, so avoiding methods in these tight inner loops in unfortunately
desirable. We can consider a pyrex version of this with objects in future if
desired.

i(tabsolute_importN(tS_IEXEC(
t
cache_utf8tconfigtdebugterrorst	inventorytlocktosutilststatic_tuplettraceturlutilsiitSHA1ProvidercB@s eZdZdZdZRS(s)An interface for getting sha1s of a file.cC@st|jdS(sReturn the sha1 of a file given its absolute path.

        :param abspath:  May be a filesystem encoded absolute path
             or a unicode path.
        N(tNotImplementedErrortsha1(tselftabspath((s3/usr/lib/python2.7/dist-packages/bzrlib/dirstate.pyRscC@st|jdS(s/Return the stat and sha1 of a file given its absolute path.
        
        :param abspath:  May be a filesystem encoded absolute path
             or a unicode path.

        Note: the stat should be the stat of the physical file
        while the sha may be the sha of its canonical content.
        N(R
t
stat_and_sha1(RR((s3/usr/lib/python2.7/dist-packages/bzrlib/dirstate.pyR	s	(t__name__t
__module__t__doc__RR(((s3/usr/lib/python2.7/dist-packages/bzrlib/dirstate.pyRs	tDefaultSHA1ProvidercB@s eZdZdZdZRS(s7A SHA1Provider that reads directly from the filesystem.cC@s
tj|S(s2Return the sha1 of a file given its absolute path.(Rtsha_file_by_name(RR((s3/usr/lib/python2.7/dist-packages/bzrlib/dirstate.pyRscC@sOt|d}z(tj|j}tj|}Wd|jX||fS(s;Return the stat and sha1 of a file given its absolute path.trbN(tfiletostfstattfilenoRtsha_filetclose(RRtfile_objt	statvalueR((s3/usr/lib/python2.7/dist-packages/bzrlib/dirstate.pyRs(RRRRR(((s3/usr/lib/python2.7/dist-packages/bzrlib/dirstate.pyRs	tDirStatecB@s=eZdZidd6dd6dd6dd6d	d
6dd6Zidd6dd6dd6d
d	6dd6dd6Zidej6dej6d	ej6Z	id
e
6de6ZdZ
dZdZdZdZddZejdddedZdZdZddZdZdledZdZdZdZdZd Z d!Z!d"Z"d#Z#d$Z$d%Z%d&Z&d'Z'd(Z(ed)Z)d*Z*d+Z+e,dld,Z-d-Z.d.Z/d/Z0d0Z1d1Z2d2Z3d3Z4d4Z5d5Z6d6Z7d7Z8e	d8Z9d9Z:d:Z;d;Z<d<Z=d=Z>e?j@d>krpe>Z=nd?ZAd@ZBdAZCdBZDdCZEdDZFdEZGdFZHdGZIdldledHZJeKdldIZLe,dJZMdKZNdLZOdMZPdNZQdOZRdPZSdQZTdRZUeKdlddSZVdTZWdUZXdVZYdWZZdXZ[dYZ\dZZ]d[Z^d\Z_d]Z`d^Zad_Zbd`ZcdaZddbZedcZfeddlddleddZgdeZhdfZidgZjdhZkdiZldjZmdkZnRS(msRecord directory and metadata state for fast access.

    A dirstate is a specialised data structure for managing local working
    tree state information. Its not yet well defined whether it is platform
    specific, and if it is how we detect/parameterize that.

    Dirstates use the usual lock_write, lock_read and unlock mechanisms.
    Unlike most bzr disk formats, DirStates must be locked for reading, using
    lock_read.  (This is an os file lock internally.)  This is necessary
    because the file can be rewritten in place.

    DirStates must be explicitly written with save() to commit changes; just
    unlocking them does not write the changes to disk.
    tatabsenttfRtdt	directorytrt	relocatedtltsymlinkttstree-referencetytniiiiitxi ts#bazaar dirstate flat format 2
s#bazaar dirstate flat format 3
cC@stj|_tj|_t|_g|_g|_g|_d|_
||_d|_d|_
d|_d|_d|_d|_i|_tj|_||_dtjkr|j|_n|jj|_d|_d|_t|_||_t j!t"j#||_$dS(sCreate a  DirState object.

        :param path: The path at which the dirstate file on disk should live.
        :param sha1_provider: an object meeting the SHA1Provider interface.
        :param worth_saving_limit: when the exact number of hash changed
            entries is known, only bother saving the dirstate if more than
            this count of entries have changed.
            -1 means never save hash changes, 0 means always save hash changes.
        t	hashcacheN(%R t
NOT_IN_MEMORYt
_header_statet_dirblock_statetFalset_changes_abortedt
_dirblockst_ghostst_parentstNonet_state_filet	_filenamet_lock_tokent_lock_statet	_id_indext_packed_stat_indext_end_of_headert_cutoff_timet_split_path_cachetBISECT_PAGE_SIZEt_bisect_page_sizet_sha1_providerRtdebug_flagst_sha1_file_and_muttert
_sha1_fileRt_last_block_indext_last_entry_indextsett_known_hash_changest_worth_saving_limitRt
LocationStackRtlocal_path_to_urlt
_config_stack(Rtpatht
sha1_providertworth_saving_limit((s3/usr/lib/python2.7/dist-packages/bzrlib/dirstate.pyt__init__bs4																	cC@sd|jj|jfS(Ns%s(%r)(t	__class__RR:(R((s3/usr/lib/python2.7/dist-packages/bzrlib/dirstate.pyt__repr__scC@s|rZ|jjg|D]}|d^q|jtjtjfkrftj|_qfntj|_|r{tj|_ndS(sMark this dirstate as modified.

        :param hash_changed_entries: if non-None, mark just these entries as
            having their hash modified.
        :param header_modified: mark the header modified as well, not just the
            dirblocks.
        iN(	RKtupdateR2R R0tIN_MEMORY_UNMODIFIEDtIN_MEMORY_HASH_MODIFIEDtIN_MEMORY_MODIFIEDR1(Rthash_changed_entriestheader_modifiedte((s3/usr/lib/python2.7/dist-packages/bzrlib/dirstate.pyt_mark_modifieds	'cC@s(tj|_tj|_t|_dS(s!Mark this dirstate as unmodified.N(R RWR1R2RJRK(R((s3/usr/lib/python2.7/dist-packages/bzrlib/dirstate.pyt_mark_unmodifiedsc 	C@sdtj|\}}tj|\}}	||krW|	rE|}qWtj|n|dkso|dkrtj|n|d|jdjd}
tj|
\}}|jt	k	rt
dt|fnd}|j
dd|dt}|dkr|d	ddd
kr||d|||fkr|j|dddd
dd
d|
|ddd!}qqtj|dd|dd	}tj|d	dd}d||f}
tj||
n||d
f}|j|\}}|r|j|d	}|j||\}}x|t|kr||ddd!|dd!kr||d	dddkrtdn|d	7}q2Wnjtj|\}}|j||d\}}}}|stj|t	|n|j||||j|d	}|||f}|dkrGd}tj}n|j}t|}|j}tj |}|dk	r|drd|}n
|d	}d|dt!d
f|d<n|dkr||||t!|fg|f}n|dkr ||d
dt!|fg|f}nu|dkrQ||||t!|fg|f}nD|dkr|||dt!|fg|f}ntj"d||j||\}}|s|j#||nO||d	ddd
krt
d||fn|d	d||d	d<|dkr7|j|||
n|j$|j%r`|j&|j%|ndS(sAdd a path to be tracked.

        :param path: The path within the dirstate - '' is the root, 'foo' is the
            path foo within the root, 'foo/bar' is the path bar within foo
            within the root.
        :param file_id: The file id of the path being added.
        :param kind: The kind of the path, as a string like 'file',
            'directory', etc.
        :param stat: The output of os.lstat for the path.
        :param fingerprint: The sha value of the file's canonical form (i.e.
            after any read filters have been applied),
            or the target of a symlink,
            or the referenced revision id for tree-references,
            or '' for directories.
        t.s..t/tutf8smust be a utf8 file_id not %sitfileid_utf8tinclude_deletediR!R&t	path_utf8R.tpacked_stattfingerprintis%s:%starsadding already added path!s%s/%sRR%R)stree-referencesunknown kind %rs %r(%r) already addedN(NN('Rtsplittnormalized_filenameRtInvalidNormalizationtInvalidEntryNametstriptencodeRTtstrtAssertionErrorttypeR8t
_get_entrytTruetupdate_minimaltpathjoinR t_minikind_to_kindtDuplicateFileIdt_find_block_index_from_keyR5t_find_entry_indextlent	Exceptiont_get_block_entry_indextNotVersionedErrort
_ensure_blocktNULLSTATtst_sizet	pack_statt_empty_parent_infot_kind_to_minikindR3tBzrErrortinsertR]R=t_add_to_id_index( RRPtfile_idtkindtstatRftdirnametbasenamet	norm_namet
can_accesstutf8pathtrename_fromt
file_id_entrytinfot	first_keytblock_indextpresenttblocktentry_indext_t
parent_dirtparent_basetparent_block_idxtparent_entry_idxtparent_presentt	entry_keytsizeRetparent_infotminikindt
old_path_utf8t
entry_data((s3/usr/lib/python2.7/dist-packages/bzrlib/dirstate.pytadds	 
""!	








	c#C@s4|j|j|jtjkr<td|jn|j}tj|j	j
}|jd}|j}|d}i}dt
|}d}	|||fg}
|j}|j}xj|
r/|
j\}}}
|
s||krqn|	d7}	|	|kr"tjdnt||||d}|j|t|||d}|j|}|}|jd}t
|dkr|d9}|
j|||
fqnd}|djd}t
||kr|t
|dd7}|djd}d}nt
|dkrT|d9}|
j|||
fqnV|}|dr}|dd	|d}n
|d}t|
|}|
| }|
|}|rt
||krt
|d}||jd}t
||kr5|t
|t
|d
}|d8}||jd}n|t
|}|drh|dd	|d}n
|d}t||}|| }||}|r|d|kr|j|n|d
|kr|jd|ni|g|6}||kr|j|gj|nxtt|d|D]_}||jd} | drf| dd	| d}!n
| d}!|j|!gj| q*WxW|D]L}!xC|j|!gD]/} || d}"|j|!gj|"qWqWqn|r	|
j|||fn|r|
j||d|fqqW|S(s^Bisect through the disk structure for specific rows.

        :param paths: A list of paths to find
        :return: A dict mapping path => entries for found entries. Missing
                 entries will not be in the map.
                 The list is not sorted, and entries will be populated
                 based on when they were read.
        sbad dirblock state %riiis"Too many seeks, most likely a bug.is
tR`i(t_requires_lockt_read_header_if_neededR2R R0RoR9RRRRt_fields_per_entryR?RyRCt_get_fields_to_entrytpopRRtmaxtseektmintreadRhtappendt_bisect_path_leftt_bisect_path_rightRt
setdefaulttxrangetget(#Rtpathst
state_filet	file_sizetentry_field_counttlowthightfoundt	max_counttcounttpendingt	page_sizetfields_to_entryt	cur_filestmidt	read_sizeRtstarttentriestfirst_entry_numtfirst_fieldstaftert
first_patht	first_loctpretposttlast_entry_numtlast_fieldst	last_pathtlast_loctmiddle_filestnumtfieldsRPtentry((s3/usr/lib/python2.7/dist-packages/bzrlib/dirstate.pyt_bisectFs	

		
		


	












'!c$C@s|j|j|jtjkr<td|jn|j}tj|j	j
}|jd}|j}|d}i}dt
|}d}	|||fg}
|j}|j}x|
r|
j\}}}
|
s||krqn|	d7}	|	|kr"tjdnt||||d}|j|t|||d}|j|}|}|jd}t
|dkr|d9}|
j|||
fqnd}|djd}t
||kr|t
|dd7}|djd}d}nt
|dkrT|d9}|
j|||
fqn6|}|d}tj|
|}|
| }|
|}|rt
||krt
|d}||jd}t
||kr|t
|t
|d	}|d8}||jd}n|t
|}|d}tj||}|| }||}|r|d|kr{|j|n|d	|kr|jd|ni|g|6}||kr|j|gj|nxKt|d|D]6} || jd}!|j|!dgj|!qWxW|D]L}"xC|j|"gD]/}!||!d}#|j|"gj|#qDWq+Wqn|r|
j|||fn|r|
j||d|fqqW|S(
s]Bisect through the disk structure to find entries in given dirs.

        _bisect_dirblocks is meant to find the contents of directories, which
        differs from _bisect, which only finds individual entries.

        :param dir_list: A sorted list of directory names ['', 'dir', 'foo'].
        :return: A map from dir => entries_for_dir
        sbad dirblock state %riiis"Too many seeks, most likely a bug.is
Ri( RRR2R R0RoR9RRRRRR?RyRCRRRRRRRRRhRtbisecttbisect_lefttbisect_rightRRRR($Rtdir_listRRRRRRRRRRRtcur_dirsRRRRRRRRt	first_dirRRRRRtlast_dirRRRRRtcur_dirR((s3/usr/lib/python2.7/dist-packages/bzrlib/dirstate.pyt_bisect_dirblockss

		
		


	







!
'!cC@si}t}t}|j|}xz|rt}t}x|jD]}x|D]\}	}
|
||	<|j|	d t}x|
D]}|d}
|
dkr|rqn|	\}}}tj||}t}||krV|j|qVq|
dkrtj|d}|d|kr3qn||krV|j|dqVqqWq\WqOW|jt	|}|j
|jt	||j
|q*W|S(sBisect for entries for all paths and their children.

        This will use bisect to find all records for the supplied paths. It
        will then continue to bisect for any records which are marked as
        directories. (and renames?)

        :param paths: A sorted list of (dir, name) pairs
             eg: [('', 'a'), ('', 'f'), ('a/b', 'c')]
        :return: A dictionary mapping (dir, name, file_id) => [tree_info]
        iiR$R&i(RJRt
itervaluesRR3RRtRrRhtsortedRVR(RRRtfound_dir_namestprocessed_dirstnewly_foundtpending_dirstpaths_to_searcht
entry_listtdir_name_idt
trees_infotis_dirt	tree_infoRtsubdirtnameRRPtdir_name((s3/usr/lib/python2.7/dist-packages/bzrlib/dirstate.pyt_bisect_recursives@					


#c@sjj}t|dkr,dSjtd	d
ddgfd}|djkrtjg}xA|D]}||dd)qWnx|D]}|dd3qWg_|dg_	j
dtdS(
sDiscard any parents trees beyond the first.

        Note that if this fails the dirstate is corrupted.

        After this function returns the dirstate contains 2 trees, neither of
        which are ghosted.
        iNR!R&c3@sxjD]}g}x]t|dD]K\}}|V|ddd|dddfkr'|j|q'q'W|r
t|t|dkr|d2qx"t|D]}|d|=qWq
q
WdS(Nii(R5t	enumerateRRytreversed(Rtdeleted_positionstposR(t
dead_patternsR(s3/usr/lib/python2.7/dist-packages/bzrlib/dirstate.pytiter_entries_removables*iiR[(R!R&(R!R!(R&R&(R&R!(Rtget_parent_idsRyt_read_dirblocks_if_neededRJt
get_ghostsR tNULL_PARENT_DETAILSR6R7R]Rr(RtparentsRtempty_parentR((RRs3/usr/lib/python2.7/dist-packages/bzrlib/dirstate.pyt_discard_merge_parentss 

	cC@s$tjgt|jt|jS(N(R RRyR7R6(R((s3/usr/lib/python2.7/dist-packages/bzrlib/dirstate.pyRscC@s|dkr(|dkr(|dkr(dS|dkoI|dkoI|dks|j|j|d|ddstd|qn|j|ddf\}}|s|jj||gfn|S(sEnsure a block for dirname exists.

        This function exists to let callers which know that there is a
        directory dirname ensure that the block for it exists. This block can
        fail to exist because of demand loading, or because a directory had no
        children. In either case it is not an error. It is however an error to
        call this if there is no parent entry for the directory, and thus the
        function requires the coordinates of such an entry to be provided.

        The root row is special cased and can be indicated with a parent block
        and row index of -1

        :param parent_block_index: The index of the block in which dirname's row
            exists.
        :param parent_row_index: The index in the parent block where the row
            exists.
        :param dirname: The utf8 dirname to ensure there is a block for.
        :return: The index for the block.
        R.iiisbad dirname %r(tendswithR5RoRwR(Rtparent_block_indextparent_row_indexRRR((s3/usr/lib/python2.7/dist-packages/bzrlib/dirstate.pyR} s$ cC@s|dddd!dkr9td|ddfndgfdgfg|_|jdd}d}d}|j}xb|D]Z}|dd|krg}|dd}|jj||f|j}n||qW|jdS(	sLoad new_entries into self.dirblocks.

        Process new_entries into the current state object, making them the active
        state.  The entries are grouped together by directory to form dirblocks.

        :param new_entries: A sorted list of entries. This function does not sort
            to prevent unneeded overhead when callers have a sorted list already.
        :return: Nothing.
        iiR.sMissing root row %riN(R.R.(R.R.(RoR5Rt"_split_root_dirblock_into_contents(Rtnew_entriest
current_blocktcurrent_dirnametroot_keytappend_entryR((s3/usr/lib/python2.7/dist-packages/bzrlib/dirstate.pyt_entries_to_current_stateEs 
	
cC@s|jddgfkr6td|jdfng}g}xD|jddD]1}|ddsx|j|qT|j|qTWd|f|jd<d|f|jd<dS(sSplit the root dirblocks into root and contents-of-root.

        After parsing by path, we end up with root entries and contents-of-root
        entries in the same block. This loop splits them out again.
        iR.sbad dirblock start %riN(R5t
ValueErrorR(Rt
root_blocktcontents_of_root_blockR((s3/usr/lib/python2.7/dist-packages/bzrlib/dirstate.pyRds	cC@stjj|\}}||df}|j|\}}|sFgSg}|j|d}|j||\}	}
xS|	t|kr||	ddd!|dd!kr|j||	|	d7}	qxW|S(s?Return a list with all the entries that match path for all ids.R.iii(RRPRhRwR5RxRyR(RRPRRtkeyRRtresultRRR((s3/usr/lib/python2.7/dist-packages/bzrlib/dirstate.pyt_entries_for_pathys"cC@st|d}x|t|dD]j\}}|j|d|d}|d||d<t|d||d<tj|d||d<q!Wdj|S(sSerialize entry to a NULL delimited line ready for _get_output_lines.

        :param entry: An entry_tuple as defined in the module docstring.
        iiiiiR(tlistRtextendRnR t	_to_yesnotjoin(RRtentire_entryttree_numbert	tree_datattree_offset((s3/usr/lib/python2.7/dist-packages/bzrlib/dirstate.pyt_entry_to_lines
cC@s d|j}dd|dS(s1How many null separated fields should be in each entry row.

        Each line now has an extra '\n' field which is not used
        so we just skip over it

        entry size::
            3 fields for the key
            + number of fields per tree_data (5) * tree count
            + newline
         iii(t_num_present_parents(Rt
tree_count((s3/usr/lib/python2.7/dist-packages/bzrlib/dirstate.pyRscC@s|j|\}}|s|sxtj|d\}}|j||ddsxtj|dd!t|qxn|jj||dgfn|j|S(sReturn the block that key should be present in.

        :param key: A dirstate entry key.
        :return: The block tuple.
        iii(	RwRRhR{RR|RnR5R(RRtadd_if_missingRRRtparent_name((s3/usr/lib/python2.7/dist-packages/bzrlib/dirstate.pyt_find_blocks% cC@s|dd!dkrdtfSy>|jdk	rZ|j|jd|dkrZ|jtfSWntk
rnnXt|j|ddd|j}|t|jko|j|d|dk}||_d|_||fS(	sxFind the dirblock index for a key.

        :return: The block index, True if the block for the key is present.
        iiR.itcachei(R.R.N(	RrRHR8R5t
IndexErrortbisect_dirblockRARyRI(RRRR((s3/usr/lib/python2.7/dist-packages/bzrlib/dirstate.pyRws

		cC@st|}y|jdk	r|jd}|dkr||dd|kr|||dkr||_||d|k}||fSnWntk
rnXtj||gf}||ko||d|k}||_||fS(sFind the entry index for a key in a block.

        :return: The entry index, True if the entry for the key is present.
        iiN(RyRIR8RRR(RRRt	len_blockRR((s3/usr/lib/python2.7/dist-packages/bzrlib/dirstate.pyRxs 
$	
	c
C@stj|d|}y|jz|j}t|}g}x@|D]8}|jjj|}|j||f|jqJW|j	|g|j
|jWdx|D]\}	}|jqW|jXWn|jnX|S(sCreate a dirstate from a bzr Tree.

        :param tree: The tree which should provide parent information and
            inventory ids.
        :param sha1_provider: an object meeting the SHA1Provider interface.
            If None, a DefaultSHA1Provider is used.
        :return: a DirState object which is currently locked for writing.
            (it was locked by DirState.initialize)
        RQN(
R t
initializet	lock_readRRytbrancht
repositoryt
revision_treeRtset_parent_treestset_state_from_inventorytroot_inventorytunlock(
ttreetdir_state_filenameRQRt
parent_idstnum_parentstparent_treest	parent_idtparent_treetrevid((s3/usr/lib/python2.7/dist-packages/bzrlib/dirstate.pyt	from_trees*	


cC@s@ttjtjtjtjtjtj|S(N(R
Rt_check_delta_unique_idst_check_delta_unique_old_pathst_check_delta_unique_new_pathst_check_delta_ids_match_entryt_check_delta_ids_are_validt(_check_delta_new_path_entry_both_or_None(Rtdelta((s3/usr/lib/python2.7/dist-packages/bzrlib/dirstate.pyt_check_delta_is_valids	cC@s|jtj}i}i}t}t}t|j|dt}x|D]\}}}	}
|	|ks}|	|kr|j|p||	dn|dk	r|jd}|||	<n
|j	|	|dk	r|
dkr|j||	dn|jd}t
j|\}}|r?|j	||
jfn|||	f}
t
j|
j}|dkr||
jpvd}nd}|
||
j||f||	<nd||fkrSx%|jd|D]}|dd|ks|dd|krqn|dd}|dd	}|d	dd}|d	dd
}|d	dd}t
j||}|||dd<|t|}||}|||ddf}
t
j||}|
||||f||dd<qWqSqSW|j||dy:|j|j|j|j|j|dWnPtjk
r~}t|_dt|krbntj|d
|fnXdS(sApply an inventory delta to the dirstate for tree 0

        This is the workhorse for apply_inventory_delta in dirstate based
        trees.

        :param delta: An inventory delta.  See Inventory.apply_delta for
            details.
        treversesrepeated file_idsutf-8snew_path with no entryR*R.iiiiisintegrity errorserror from _get_entry. %sN( RRRmRJRR5Rrt_raise_invalidR8RRRhR*R RRtreference_revisiont
executablet_iter_child_entriesRtRyt_check_delta_ids_absentt_apply_removalst	iteritemst_apply_insertionstvaluest_after_delta_check_parentsRRR4RntInconsistentDeltaDelta(RR4Rmt
insertionstremovalsRtnew_idstold_pathtnew_pathRt	inv_entrytdirname_utf8RRRRftchildt
child_dirnametchild_basenameR9told_child_pathtchild_suffixtnew_child_dirnametnew_child_pathR\((s3/usr/lib/python2.7/dist-packages/bzrlib/dirstate.pytupdate_by_delta#sx	
			



(		
			#		cC@sxt|dtdtjdD]v\}}tj|\}}|j||d\}}}}	y|j|d|}
Wn$tk
r|j	||dnX|	s|
ddddkr|j	||dn||
ddkr|j	||d|
ddn|j
|
|j|d	d\}}}}	|r"xR|j|dD]<}|dddd
krU|j	||
dddqUqUWq"q"WdS(NR6RiisWrong path for old path.Rgis/Attempt to remove path has wrong id - found %r.R.R&R!s:The file id was deleted but its children were not deleted.(R&R!(RRrtoperatort
itemgetterRRhR{R5RR7t_make_absent(RRCRRPRRtblock_itentry_it	d_presentt	f_presentRtchild_entry((s3/usr/lib/python2.7/dist-packages/bzrlib/dirstate.pyR<xs.!


!cC@syFx?t|D]1\}}}}}|j||||d|qWWn4tjk
r||j|jd|ddnXdS(NRdRaisMissing parent(RRsRR|R7tdecode(RtaddsRRR9RfRd((s3/usr/lib/python2.7/dist-packages/bzrlib/dirstate.pyR>s"cC@s|j|j|jgkr5t|jnt|jdkrtj}x%|j	D]}|dj
|q`W|jj
|n||jd<t|j|dt
}g}g}g}tj}|j}	d}
t}t}x|D]\}
}}}|d
k	r@||jkr@|j||d|n|d
krUd
}nb|d
krw|j||dn||}tj|\}}|r|j||jfn|
d
krd
}n||
}|
d
kr|j
d
|||	|t
f|j|q|d
krA|j
|d
|d
t
fq|
|f|
kru|j
||||	|fq|j|g}|j
||||	|tftt|jd|}x|D]}|d\}}}|r|d|}n|}|r"||t|}n/|dkr=tdn|t|d}|j
d
||dd	|ddtf|j
|||dd	d
tfqW|j
|||d
tfqW|j||dy;|j||j ||j!||j"|dWnPt#j$k
re}t
|_%d
t&|krInt#j'|d|fnX|j(dt
d
|_)d
S(sUpdate the parents of this tree after a commit.

        This gives the tree one parent, with revision id new_revid. The
        inventory delta is applied to the current basis tree to generate the
        inventory for the parent new_revid, and all other parent trees are
        discarded.

        Note that an exception during the operation of this method will leave
        the dirstate in a corrupt state where it should not be saved.

        :param new_revid: The new revision id for the trees parent.
        :param delta: An inventory delta (see apply_inventory_delta) describing
            the changes from the current left most parent revision to new_revid.
        iiR6R.smismatched entry file_id %rsnew_path with no entryR`s!cannot rename directory to itselfisintegrity errorserror from _get_entry. %sR[N(R.R.(*RRR6R
tupdate_basis_by_deltaRyR7R Rt
_iter_entriesRRR5RrRRmt_inv_entry_to_detailsRJR8RR7RRhRR*t_update_basis_apply_deletesR3RR
R:RoR;t_update_basis_apply_addst_update_basis_apply_changesR@RRR4RnRAR]R=(RR4t	new_revidRRRZtchangestdeletesRmtinv_to_entryt	root_onlyRRDRERFRRGt
new_path_utf8RHt
basename_utf8Rtnew_deletesRJRKt
child_file_idtsource_pathttarget_pathR\((s3/usr/lib/python2.7/dist-packages/bzrlib/dirstate.pyR[s

	
						
		

,"


			cC@s|s
dS|j}x|D]}x|j|dD]}|j|d|d|\}}}	}
|
sqq6n|j|d|}|dd|krq6n|jd|dd!jd|dq6WqWdS(	sACheck that none of the file_ids in new_ids are present in a tree.Niiis%s/%sRasBThis file_id is new in the delta but already present in the target((t
_get_id_indexRR{R5R7RY(RRDR4t
tree_indextid_indexRRRTRURVRWR((s3/usr/lib/python2.7/dist-packages/bzrlib/dirstate.pyR;As
) cC@s"t|_tj|||dS(N(RrR4RtInconsistentDelta(RRPRtreason((s3/usr/lib/python2.7/dist-packages/bzrlib/dirstate.pyR7Us	c(C@sW|jddd}tj}x.|D]&\}}}}}tj|\}	}
||	|
|}|j|\}}
|
stj|	\}}|j||d\}}}}|s|j||dn|j|||	n|j	|d}|j
||\}}
|rC|dk	rC|j||d|fqCn|
r||}|ddd}|dkr||dd<q|d	krtq|j||d
nxt
|d|dD]}|dks|t|krqn||}|dd |	|
fkrqn|dd|krFtd|fn|ddd}|dkr|j||d
|ddfqqW|tj|gf}|j|||ddd}|dkr|j}|j|d}x2|D]}|j|d|dd\}}} }!|!s0qn|j	|d|}"|"dd|kr_qn|"ddd}#|#dkr|j||dn|"dd \}$}%|$r|$d|%}&n|%}&|d	|dtd|"dd<|d	|&dtd|dd<qWn|d	kr#tn|d}'|'dkr)|j|||q)q)WdS(sApply a sequence of adds to tree 1 during update_basis_by_delta.

        They may be adds, or renames that have been split into add/delete
        pairs.

        :param adds: A sequence of adds. Each add is a tuple:
            (None, new_path_utf8, file_id, (entry_details), real_add). real_add
            is False when the add is the second half of a remove-and-reinsert
            pair created to handle renames and deletes.
        RcS@s|dS(Ni((R-((s3/usr/lib/python2.7/dist-packages/bzrlib/dirstate.pyt<lambda>isRgis;Unable to find block for this record. Was the parent added?s2considered a real add but still had old_path at %siR!R&sEAn entry was marked as a new add but the basis target already existedisI_find_entry_index didnt find a key match but walking the data did, for %ssWwe have an add record for path, but the path is already present with another file_id %ss-We found a tree0 entry that doesnt make senseR`R.R$N((tsortR	tStaticTupleRRhRwR{R7R}R5RxR8R
trangeRyRoR RRRlRR3((RRZR"tstRERFRtnew_detailstreal_addRRRRRRRRRRRRRRt
basis_kindtmaybe_indextmaybe_entrytactive_kindRntkeysRRTRURVRWtactive_entrytreal_active_kindt
active_dirtactive_nametactive_pathtnew_kind((s3/usr/lib/python2.7/dist-packages/bzrlib/dirstate.pyR_Ys	!



	
)
 '
cC@sd}x{|D]s\}}}}|jd||}|ddks\|ddddkrr|j||dn||dd<q
WdS(sApply a sequence of changes to tree 1 during update_basis_by_delta.

        :param adds: A sequence of changes. Each change is a tuple:
            (path_utf8, path_utf8, file_id, (entry_details))
        Rgiis$changed entry considered not presentN(RqR8R7(RRbR"RERFRRvR((s3/usr/lib/python2.7/dist-packages/bzrlib/dirstate.pyR`s(
cC@stj}x|D]\}}}}}||dkkrM|j||dntj|\}}	|j||	d\}
}}}
|
s|j||dn|j|
d|}|ddd}|dd|kr|j||dnd}|ddd}|dkr#|dkr|ddd}|jd||}|ddddkru|j||d	n.|ddddkr|j||d
n||dd<n|j|
d|=|dkrl|j	|ddf\}}|r |j|d}|s|j|=qq qlnI||dd<|j|dd\}}}}|rl|j|d}nxB|D]:}|ddd}|dkrs|j||d
qsqsWqWdS(sApply a sequence of deletes to tree 1 during update_basis_by_delta.

        They may be deletes, or renames that have been split into add/delete
        pairs.

        :param deletes: A sequence of deletes. Each delete is a tuple:
            (old_path_utf8, new_path_utf8, file_id, None, real_delete).
            real_delete is True when the desired outcome is an actual deletion
            rather than the rename handling logic temporarily deleting a path
            during the replacement of a parent.
        sbad delete deltais)basis tree does not contain removed entryiismismatched file_id in tree 1RgR&s-Dirstate did not have matching rename entriess3Dirstate had a rename pointing at an inactive tree0R$R.s:The file id was deleted but its children were not deleted.N((
R RR8R7RRhR{R5RqRw(RRctnullRERFRRtreal_deleteRRRRtdir_presenttfile_presentRR{t	dir_blocktold_kindRR}tdir_block_indexRRTRURVRWRXtchild_basis_kind((s3/usr/lib/python2.7/dist-packages/bzrlib/dirstate.pyR^sX	!



!
cC@sx|D]\}}|j|||}|ddkrW|j|jd|dn|d|ddkr|j|jd|dqqWdS(sQCheck that parents required by the delta are all intact.
        
        :param parents: An iterable of (path_utf8, file_id) tuples which are
            required to be present in tree 'index' at path_utf8 with id file_id
            and be a directory.
        :param index: The column in the dirstate to check for parents in.
        iRasThis parent is not present.iR$sThis parent is not a directory.N(RqR8R7RY(RRtindexRHRR((s3/usr/lib/python2.7/dist-packages/bzrlib/dirstate.pyR@6s
cC@sy||jd@}Wntk
r)dSX|dkr|jdkrR|jn|j|jkr|j|jkrd||j|dddt|f|dd<|j	|gqndS(sNote the sha1 of a file.

        :param entry: The entry the sha1 is for.
        :param sha1: The observed sha1.
        :param stat_value: The os.lstat for the file.
        iR#iiiN(
tst_modetKeyErrorR8R@t_sha_cutoff_timetst_mtimetst_ctimeRRR](RRRt
stat_valuet_stat_to_minikindR((s3/usr/lib/python2.7/dist-packages/bzrlib/dirstate.pyt_observed_sha1Js

cC@s ttjd|_|jS(sReturn cutoff time.

        Files modified more recently than this time are at risk of being
        undetectably modified and so can't be cached.
        i(tintttimeR@(R((s3/usr/lib/python2.7/dist-packages/bzrlib/dirstate.pyR`s
cC@s
tj|S(s(Return the os.lstat value for this path.(Rtlstat(RRR((s3/usr/lib/python2.7/dist-packages/bzrlib/dirstate.pyt_lstatmscC@s!tjd||jj|S(Nsdirstate sha1 (R
tmutterRDR(RR((s3/usr/lib/python2.7/dist-packages/bzrlib/dirstate.pyRFqscC@stt|@S(sIs this file executable?(tboolR(Rtmodetold_executable((s3/usr/lib/python2.7/dist-packages/bzrlib/dirstate.pyt_is_executablewscC@s|S(s6On win32 the executable bit is stored in the dirstate.((RRR((s3/usr/lib/python2.7/dist-packages/bzrlib/dirstate.pyt_is_executable_win32{stwin32cC@sdtj}t|tr*|j|}ntj|}|dkr`|j|jd}n|S(sRead the target of a symlinksutf-8tasciisUTF-8(sutf-8sascii(Rt_fs_enct
isinstancetunicodeRmRtreadlinkRY(RRtold_linktfs_encodingttarget((s3/usr/lib/python2.7/dist-packages/bzrlib/dirstate.pyt
_read_links	cC@s|j|jS(s>Return a list of the parent tree revision ids that are ghosts.(RR6(R((s3/usr/lib/python2.7/dist-packages/bzrlib/dirstate.pyRs
cC@s|jtjkrA|jtjkrA|jjd|jjSg}|j|j|j	|j|j
|j|j|j
|j|S(s5Serialise the entire dirstate to a sequence of lines.i(R1R RWR2R9Rt	readlinesRt_get_parents_lineRt_get_ghosts_lineR6Rt_get_entry_linest_get_output_lines(Rtlines((s3/usr/lib/python2.7/dist-packages/bzrlib/dirstate.pyt	get_liness
cC@s djtt|g|S(s7Create a line for the state file for ghost information.R(R
RnRy(Rt	ghost_ids((s3/usr/lib/python2.7/dist-packages/bzrlib/dirstate.pyRscC@s djtt|g|S(s9Create a line for the state file for parents information.R(R
RnRy(RR'((s3/usr/lib/python2.7/dist-packages/bzrlib/dirstate.pyRscC@st|j|jS(sCreate lines for entries.(tmapRR\(R((s3/usr/lib/python2.7/dist-packages/bzrlib/dirstate.pyRscC@st|j}|dkr(td}|S|dkrDtd}|S|dkr`td}|Std}|SdS(	sGet a function which converts entry fields into a entry record.

        This handles size and executable, as well as parent records.

        :return: A function which takes a list of fields, and returns an
            appropriate record for storing in memory.
        icS@sW|d|d|df}||d|d||d|ddk|d	fgfS(
NiiiiiiiR+i((Rt_inttpath_name_file_id_key((s3/usr/lib/python2.7/dist-packages/bzrlib/dirstate.pytfields_to_entry_0_parentss

icS@s|d|d|df}||d|d||d|ddk|d	f|d
|d||d|d
dk|dfgfS(NiiiiiiiR+iii	i
ii((RRR((s3/usr/lib/python2.7/dist-packages/bzrlib/dirstate.pytfields_to_entry_1_parents




ic	S@s|d|d|df}||d|d||d|ddk|d	f|d
|d||d|d
dk|df|d|d||d|ddk|dfgfS(NiiiiiiiR+iii	i
iii
iiii((RRR((s3/usr/lib/python2.7/dist-packages/bzrlib/dirstate.pytfields_to_entry_2_parentss"







c	S@s|d|d|df}gtdt|ddD]K}||||d|||d||ddk||df^q8}||fS(NiiiiiR+i(RRy(RRRtcurttrees((s3/usr/lib/python2.7/dist-packages/bzrlib/dirstate.pytfields_to_entry_n_parentsskN(RR(Rtnum_present_parentsRRRR((s3/usr/lib/python2.7/dist-packages/bzrlib/dirstate.pyRs	
	cC@s|jt|jS(s=Return a list of the parent tree ids for the directory state.(RR
R7(R((s3/usr/lib/python2.7/dist-packages/bzrlib/dirstate.pyRs
c	C@s|j||df}|j|\}}|sD|dttfS|j|d}|j||\}}xd|t|kr||dd|kr||d|ddkr||ttfS|d7}qpW||ttfS(swGet the coordinates for a path in the state structure.

        :param dirname: The utf8 dirname to lookup.
        :param basename: The utf8 basename to lookup.
        :param tree_index: The index of the tree for which this lookup should
            be attempted.
        :return: A tuple describing where the path is located, or should be
            inserted. The tuple contains four fields: the block index, the row
            index, the directory is present (boolean), the entire path is
            present (boolean).  There is no guarantee that either
            coordinate is currently reachable unless the found field for it is
            True. For instance, a directory not present in the searched tree
            may be returned with a value one greater than the current highest
            block offset. The directory present field will always be True when
            the path present field is True. The directory present field does
            NOT indicate that the directory is present in the searched tree,
            rather it indicates that there are at least some files in some
            tree present there.
        R.iiRg(RRwR3R5RxRyRr(	RRRRmRRRRR((s3/usr/lib/python2.7/dist-packages/bzrlib/dirstate.pyR{	s
-cC@s]|j|d
k	rt|tk	rJtjdt||fntj|\}}|j|||\}}}	}
|
sdS|j	|d|}|ddo|d|ddkst
dn|r|dd|krt|_tjdqn|S|j
j|d}|s2dSx |D]}
|j|
\}}|s`q9n|j	|d}|j|
|\}}|r9|j	|d|}|d|dd	kr|S|d|ddkr|r|SdS|d|ddkr&t
d
||d|d|fn|d|d}|j|d|d|Sq9WdSd
S(sGet the dirstate entry for path in tree tree_index.

        If either file_id or path is supplied, it is used as the key to lookup.
        If both are supplied, the fastest lookup is used, and an error is
        raised if they do not both point at the same row.

        :param tree_index: The index of the tree we wish to locate this path
            in. If the path is present in that tree, the entry containing its
            details is returned, otherwise (None, None) is returned
            0 is the working tree, higher indexes are successive parent
            trees.
        :param fileid_utf8: A utf8 file_id to look up.
        :param path_utf8: An utf8 path to be looked up.
        :param include_deleted: If True, and performing a lookup via
            fileid_utf8 rather than path_utf8, return an entry for deleted
            (absent) paths.
        :return: The dirstate entry tuple for path, or (None, None)
        spath_utf8 is not a str: %s %riiiR!R&sunversioned entry?s<integrity error ? : mismatching tree_index, file_id and pathtfdlts,entry %r has invalid minikind %r for tree %rRbRdN(NN(R!R&((NN(NN(NN(RR8RpRnRRRRhR{R5RoRrR4RlRRwRxRq(RRmRbRdRcRRRRRRRt
possible_keysRRRt	real_path((s3/usr/lib/python2.7/dist-packages/bzrlib/dirstate.pyRq.sX
	!&	
cC@s|dkrt}n|||}dgfdgfg}|ddjddtjfdddttjfgf|jy|j	g||j
Wn|jnX|S(sCreate a new dirstate on path.

        The new dirstate will be an empty tree - that is it has no parents,
        and only a root node - which has id ROOT_ID.

        :param path: The name of the file for the dirstate.
        :param sha1_provider: an object meeting the SHA1Provider interface.
            If None, a DefaultSHA1Provider is used.
        :return: A write-locked DirState object.
        R.iiR$N(R8RRRtROOT_IDR3R R~t
lock_writet	_set_datatsaveR$(tclsRPRQRtempty_tree_dirblocks((s3/usr/lib/python2.7/dist-packages/bzrlib/dirstate.pyR~s

cC@s|j}tj|}|j}|dkr@d}d}t}n|dkr|jd	krdd}n|jjd}d}t}np|dkr|jpd}|j	pd}|j
}n:|dkr|jpd}d}t}ntd|t
j|||||S(
s1Convert an inventory entry (from a revision tree) to state details.

        :param inv_entry: An inventory entry whose sha1 and link targets can be
            relied upon, and which has a revision set.
        :return: A details tuple - the details for a single tree at a path +
            id.
        R%R.iR)RaRstree-references
can't pack %sN(RR RtrevisionR3tsymlink_targetR8Rmt	text_sha1t	text_sizeR9R8RzR	Rs(RGRRRRfRR9((s3/usr/lib/python2.7/dist-packages/bzrlib/dirstate.pyR]s0		
					cc@s<g}|g}d}x |r7|}g}x|D]}|j|ddf\}}|dkrd}t|jdkrdSn|sq1n|j|}	x|	dD]}
|
d|d}||kr|
Vn|dkr|
ddr|
ddd|
dd}n|
dd}|j|qqWq1WqWdS(sIterate over all the entries that are children of path_utf.

        This only returns entries that are present (not in 'a', 'r') in
        tree_index. tree_index data is not refreshed, so if tree 0 is used,
        results may differ from that obtained if paths were statted to
        determine what ones were directories.

        Asking for the children of a non-directory will return an empty
        iterator.
        RgR.iiNR$R`(RwRyR5R(RRmRdRtnext_pending_dirsR"RPRRRRR((s3/usr/lib/python2.7/dist-packages/bzrlib/dirstate.pyR:s2		

!cc@s<|jx+|jD] }x|dD]}|Vq%WqWdS(sIterate over all the entries in the dirstate.

        Each yelt item is an entry in the standard format described in the
        docstring of bzrlib.dirstate.
        iN(RR5(RR%R((s3/usr/lib/python2.7/dist-packages/bzrlib/dirstate.pyR\s
cC@sU|jdkrNi}x*|jD]\}}|j||q"W||_n|jS(sGet an id index of self._dirblocks.

        This maps from file_id => [(directory, name, file_id)] entries where
        that file_id appears in one of the trees.
        N(R=R8R\R(RRnRttree_details((s3/usr/lib/python2.7/dist-packages/bzrlib/dirstate.pyRlscC@sl|d}tjj|}||kr>tj|||<n*||}||krh||f||<ndS(s(Add this entry to the _id_index mapping.iN(R	Rst
from_sequence(RRnRRt
entry_keys((s3/usr/lib/python2.7/dist-packages/bzrlib/dirstate.pyR	s	

cC@sA|d}t||}|j|tjj|||<dS(sRemove this entry from the _id_index mapping.

        It is an programming error to call this when the entry_key is not
        already present.
        iN(R
tremoveR	RsR(RRnRRR((s3/usr/lib/python2.7/dist-packages/bzrlib/dirstate.pyt_remove_from_id_index	s

cC@sztjg}|jddj|}|jdtj|ft|d}|jd|f|j||S(sFormat lines for final output.

        :param lines: A sequence of lines containing the parents list and the
            path lines.
        R.t
s
crc32: %s
isnum_entries: %s
(R tHEADER_FORMAT_3RR
tzlibtcrc32Ry(RRtoutput_linestinventory_texttnum_entries((s3/usr/lib/python2.7/dist-packages/bzrlib/dirstate.pyR$	s

cC@s"ddd|dtjdf|fS(s%Return a deleted row for fileid_utf8.R`sRECYCLED.BINRiR.(R R~(RRbR((s3/usr/lib/python2.7/dist-packages/bzrlib/dirstate.pyt_make_deleted_row4	scC@st|jt|jS(s0The number of parent entries in each record row.(RyR7R6(R((s3/usr/lib/python2.7/dist-packages/bzrlib/dirstate.pyR9	scC@s1|dkrt}n|||d|}|S(s/Construct a DirState on the file at path "path".

        :param path: The path at which the dirstate file on disk should live.
        :param sha1_provider: an object meeting the SHA1Provider interface.
            If None, a DefaultSHA1Provider is used.
        :param worth_saving_limit: when the exact number of hash changed
            entries is known, only bother saving the dirstate if more than
            this count of entries have changed. -1 means never save.
        :return: An unlocked DirState object, associated with the given path.
        RRN(R8R(RRPRQRRR((s3/usr/lib/python2.7/dist-packages/bzrlib/dirstate.pyton_file=	s
	cC@s-|j|jtjkr)t|ndS(sRead in all the dirblocks from the file if they are not in memory.

        This populates self._dirblocks, and sets self._dirblock_state to
        IN_MEMORY_UNMODIFIED. It is not currently ready for incremental block
        loading.
        N(RR2R R0t_read_dirblocks(R((s3/usr/lib/python2.7/dist-packages/bzrlib/dirstate.pyRO	s
cC@s|j|jj}|jd}t|d}|dd!|_|jj}|jd}t|d}|dd!|_tj|_	|jj
|_dS(s
This reads in the metadata header, and the parent ids.

        After reading in, the file should be positioned at the null
        just before the start of the first record in the file.

        :return: (expected crc checksum, number of entries, parent list)
        RiiiiN(t
_read_preludeR9treadlineRhRR7R6R RWR1ttellR?(Rtparent_lineRR(t
ghost_linet
num_ghosts((s3/usr/lib/python2.7/dist-packages/bzrlib/dirstate.pyt_read_headerZ	s
cC@s>|jstj|n|jtjkr:|jndS(s/Read the header of the dirstate file if needed.N(R;RtObjectNotLockedR1R R0R(R((s3/usr/lib/python2.7/dist-packages/bzrlib/dirstate.pyRn	s	cC@s|jj}|tjkr7tjd|fn|jj}|jdsktjd|nt|tdd!|_	|jj}|jdstjdnt|tdd!|_
dS(srRead in the prelude header of the dirstate file.

        This only reads in the stuff that is not connected to the crc
        checksum. The position will be correct to read in the rest of
        the file and check the checksum after this point.
        The next entry in the file should be the number of parents,
        and their ids. Followed by a newline.
        sinvalid header line: %rscrc32: smissing crc32 checksum: %ris
num_entries: smissing num_entries lineN(R9RR RRRt
startswithRRytcrc_expectedt_num_entries(Rtheadertcrc_linetnum_entries_line((s3/usr/lib/python2.7/dist-packages/bzrlib/dirstate.pyRv	s	cC@s|jjt|dS(s Find a sha1 given a stat lookup.N(t_get_packed_stat_indexRRR8(RRPtstat_result((s3/usr/lib/python2.7/dist-packages/bzrlib/dirstate.pytsha1_from_stat	scC@sv|jdkroi}xK|jD]=\}}|dddkr"|dd||dd<q"q"W||_n|jS(s+Get a packed_stat index of self._dirblocks.iR#iiN(R>R8R\(RRRR((s3/usr/lib/python2.7/dist-packages/bzrlib/dirstate.pyR	s!cC@s|jrtjddS|js*dSt}|jdkrv|jj\}}||_|j|_	|svdSnz^|j
}|j	jd|j	j||j	j
|j	j|j|jWd|r|jj|_|jj|_	nXdS(sSave any pending changes created during this session.

        We reuse the existing file, because that prevents race conditions with
        file creation, and use oslocks on it to prevent concurrent modification
        and reads - because dirstate's incremental data aggregation is not
        compatible with reading a modified file, and replacing a file in use by
        another process is impossible on Windows.

        A dirstate in read only mode should be smart enough though to validate
        that the file has not changed, and otherwise discard its cache and
        start over, to allow for fine grained read lock duration, so 'status'
        wont block 'commit' - for example.
        s4Not saving DirState because _changes_aborted is set.Ntwi(R4R
Rt
_worth_savingR3R<R;ttemporary_write_lockR#R9RRt
writelinesttruncatetflusht_maybe_fdatasyncR^trestore_read_lock(Rtgrabbed_write_locktnew_lockR((s3/usr/lib/python2.7/dist-packages/bzrlib/dirstate.pyR	s.	
	


cC@s/|jjdr+tj|jjndS(s4Flush to disk if possible and if not configured off.sdirstate.fdatasyncN(RORRt	fdatasyncR9R(R((s3/usr/lib/python2.7/dist-packages/bzrlib/dirstate.pyR	scC@sp|jtjks$|jtjkr(tS|jtjkrl|jdkrMtSt|j	|jkrltSntS(s'Is it worth saving the dirstate or not?i(
R1R RYR2RrRXRLR3RyRK(R((s3/usr/lib/python2.7/dist-packages/bzrlib/dirstate.pyR	scC@s>||_|jdtt||_d|_d|_dS(sSet the full dirstate data in memory.

        This is an internal function used to completely replace the objects
        in memory state. It puts the dirstate into state 'full-dirty'.

        :param parent_ids: A list of parent tree revision ids.
        :param dirblocks: A list containing one tuple for each directory in the
            tree. Each tuple contains the directory path and a list of entries
            found in that directory.
        R[N(R5R]RrR
R7R8R=R>(RR't	dirblocks((s3/usr/lib/python2.7/dist-packages/bzrlib/dirstate.pyR	s
		cC@s|jt|r(t|jn|jdd|}|dd|krUdS|j||jdd|fdddd|ddd	|jdS(
s:Change the id of path to new_id in the current working tree.

        :param path: The path inside the tree to set - '' is the root, 'foo'
            is the path foo in the root.
        :param new_id: The new id to assign to the path. This must be a utf8
            file id (not unicode, and not None).
        iRdiNR.R$Reii(RRyR
tset_path_idRqRSRsR](RRPtnew_idR((s3/usr/lib/python2.7/dist-packages/bzrlib/dirstate.pyR	s

c
C@s_|ji}i}g|D]\}}||kr|^q}t|}tj}	xm|jD]_}
|
ddddkrqcn|
ddgtjg|||
d<|j||
dqcWx&t|D]\}}|d}tjg||}d}
x|j
D]\}}
|
j}|jd}t
j|\}}||
kr^|
}n|}
|	|||}|j|d}x=|D]5}||kr|	d|dtd|||<qqW||kr|j|
|||<qg}xt|D]}t|s&|jtjqt|j}|||dd
krh|j|||qdj|dd	!jd}|j|	d|dtdqW|j|j|
|j||||<|j||qWqW|j|j}|j|g|D]\}}|^q|_t||_|jd
t ||_!dS(sLSet the parent trees for the dirstate.

        :param trees: A list of revision_id, tree tuples. tree must be provided
            even if the revision_id refers to a ghost: supply an empty tree in
            this case.
        :param ghosts: A list of the revision_ids that are ghosts at the time
            of setting.
        iiRgRaR&R.R!R`iR[N((R&R!("RRyR	RsR\R RRRR8titer_entries_by_dirRRmRRhRR3R]RRtitertnextR
RlRt
_sort_entriestitemsRR7R
R6R]RrR=(RRtghoststby_pathRntrev_idR%R)tparent_countRuRRmtnew_location_suffixtlast_dirnameRPRRdRRt
new_entry_keyRRRvtlookup_indexta_keyRR((s3/usr/lib/python2.7/dist-packages/bzrlib/dirstate.pyR!
sf
+	

		



"cC@s(i}|tjd}t|d|S(s	Given a list of entries, sort them into the right order.

        This is done when constructing a new dirstate from trees - normally we
        try to keep everything in sorted blocks all the time, but sometimes
        it's easier to sort after the fact.
        cS@sg|d\}}}y||}Wn3tk
rV|j|jd}|||<nX||||S(NiR`(RRRh(Rt_split_dirst_sttdirpathtfnameRRh((s3/usr/lib/python2.7/dist-packages/bzrlib/dirstate.pyt_key
s
R(R	RsR(RRt
split_dirsR((s3/usr/lib/python2.7/dist-packages/bzrlib/dirstate.pyR
s	cC@s.dtjkr"tjddndtjk}|rGtjdn|j|j}tt|j	}|j
}|j
}d}x_|s|r|r|ddddkr||}qn|r^|djd	}tj
|\}	}
|dj}|	|
|f}tj|dj}
|
d
krU|djpOd}qtd}nd}}	}
}}|s|rtjd|jd	n|j||
d
|djd|d|dt||}q|s:|rtjd|ddjd	|ddjd	n|j|||}q||dkr|ddd|djks|ddd|
kr|rtjd|jd	n|j|d|
d
|djd|d|dtn||}||}qt|	|dddks=|	|ddkr|d|ddkr|r_tjd|jd	n|j||
d
|djd|d|dt||}q|rtjd|ddjd	|ddjd	n|j|||}qW|jd|_d|_|r*tjdndS(sSet new_inv as the current state.

        This API is called by tree transform, and will usually occur with
        existing parent trees.

        :param new_inv: The inventory object to set current state from.
        tevilis?set_state_from_inventory called; please mutate the tree insteadtdirstatesset_state_from_inventory trace:cS@s'y|jSWntk
r"dSXdS(N(Rt
StopIterationR8(titerator((s3/usr/lib/python2.7/dist-packages/bzrlib/dirstate.pytadvance
s
iRgRaR*R.sAppending from new '%s'.R9RdRftfullscansTruncating from old '%s/%s'.isUpdating in-place change '%s'.sInserting from new '%s'.sDeleting from old '%s/%s'.s"set_state_from_inventory complete.N(RRER
tmutter_callsiteRRRRR
R\RRmRRhRR RRR8R8RYRsR9RrRStcmp_by_dirsR]R=R>(Rtnew_invttracingtnew_iteratortold_iteratortcurrent_newtcurrent_oldRRftnew_dirnametnew_basenameRRtcurrent_new_minikindRf((s3/usr/lib/python2.7/dist-packages/bzrlib/dirstate.pyR"
s	

	
		
	
	

	
	

		cC@s|jddtjfdddttjfgf}d|gfdgfg}|jg||j||j||dS(sWipe the currently stored state and set it to something new.

        This is a hard-reset for the data we are working with.
        R.R$iN(	RRRR3R R~RR"R!(Rtworking_invR)t
parent_ghostst
empty_rootR((s3/usr/lib/python2.7/dist-packages/bzrlib/dirstate.pytset_state_from_scratchGs

cC@s	t}x||ddD]l}|ddkrB|j|dq|ddkr|jttj|d|ddfqqW|d|k}|r*|j|d}|j|d|d\}}|std|fn|dj||j	d
k	r*|j|j	|dq*nx|D]}|j|\}	}|shtd|fn|j||j
|	d\}
}|std|fn|j
|	d|
d}|dddkrtd	|fntj|d<q1W|j|S(sMark current_old - an entry - as absent for tree 0.

        :return: True if this was the last details entry for the entry key:
            that is, if the underlying block has had the entry removed, thus
            shrinking in length.
        iiRgR&iscould not find entry for %sscould not find block for %sR!s
bad row %rN(RJRttupleRRhRRxRoRR=R8RRwR5R RR](RRtall_remaining_keystdetailstlast_referenceRRRt
update_keytupdate_block_indextupdate_entry_indextupdate_tree_details((s3/usr/lib/python2.7/dist-packages/bzrlib/dirstate.pyRSXs8		6 
#
c	!C@sa|j|d}	|dkr+tj}n|j||	\}
}|||||f}|j}
|s|s7|j|dd!d|	\}}x|t|	kr3|	|}|ddd!|dd!kr/|ddddkr"|jd|dd!jd|dd|ddn|d7}qPqWn|
j	|dd}|so||g|j
f}n8||gf}xt|D]}|j|\}}|st
d	|fn|j|d}|j||\}}|st
d
|fn|dkr"t
dn||}d|dtdf|dd<|j|||
r|j||	\}
}qqW|j}|rt|d}nxtd|dD]}|j|\}}|st
d	|fn|j||j|d\}}|s,t
d
|fn|j|d|d|}|ddkrm|dj|qtj|dd!}|djd|dtdfqW|	j|
||j|
|n||	|
dd<|dkrt
dn|
j	|dd}||kr2t
d||fnx|D]}||kr9|j|\}}|sxt
d|n|j||j|d\}
}|st
d|nd|dtdf|j|d|
dd<q9q9W|ddkrStj|dd!ddf} |j| \}}|sS|jj|| dgfqSn|jdS(sUpdate an entry to the state in tree 0.

        This will either create a new entry at 'key' or update an existing one.
        It also makes sure that any other records which might mention this are
        updated as well.

        :param key: (dir, name, file_id) for the new entry
        :param minikind: The type for the entry ('f' == 'file', 'd' ==
                'directory'), etc.
        :param executable: Should the executable bit be set?
        :param fingerprint: Simple fingerprint for new entry: canonical-form
            sha1 for files, referenced revision id for subtrees, etc.
        :param packed_stat: Packed stat value for new entry.
        :param size: Size information for new entry
        :param path_utf8: key[0] + '/' + key[1], just passed in to avoid doing
                extra computation.
        :param fullscan: If True then a complete scan of the dirstate is being
            done and checking for duplicate rows should not be done. This
            should only be set by set_state_from_inventory and similar methods.

        If packed_stat and fingerprint are not given, they're invalidated in
        the entry.
        iiiR.Rgs%s/%sRas5Attempt to add item at path already occupied by id %rscould not find block for %ss1update_minimal: could not find other entry for %ssno pathR&s+update_minimal: could not find entry for %ss`We found the entry in the blocks, but the key is not in the id_index. key: %s, existing_keys: %ssnot present: %rR$N(R.(((RR8R R~RxRlRyR7RYRRRRwRoR5R3t_maybe_remove_rowRR
RRRRtRRR](!RRRR9RfReRRdRRRRRvRnt	low_indexRRt
existing_keyst	new_entryt	other_keytother_block_indextother_blocktother_entry_indextother_entryRRR$R%tupdate_detailstpointer_pathRRt
subdir_key((s3/usr/lib/python2.7/dist-packages/bzrlib/dirstate.pyRss#


	#$

#3#cC@snt}||}x,|dD] }|ddkrt}PqqW|sj|j||j||dtStS(sRemove index if it is absent or relocated across the row.
        
        id_index is updated accordingly.
        :return: True if we removed the row, False otherwise
        iiRg(R3RrRR(RRRRntpresent_in_rowRtcolumn((s3/usr/lib/python2.7/dist-packages/bzrlib/dirstate.pyR':s

c@sddlm}jtjdkrejdddksetd|jqentjdkrjdddkstd|jqngjdD]}|djd^q}|t|krtd|jd	||nxjD]}xI|dD]=|dddkr4td
||fq4q4W|dt|dkr#td|d||fq#q#Wfd}jd}gt	|D]}t
^q}xjD]dd
}	tj
ddddtd|krxtd||fnd}
xjtdD]X\}|}|d}
|
dkr|
d7}
n|	|kr||	\}}|
dkr|dk	rtd|	|fqq|
dkr\|d}||krtd|	|fqq|krtd||fn|q|
dkrdf||	<q|
dkr|df||	<qf||	<|qW|
|kr
tdfq
q
Wjdk	rxjjD]\}	}x|D]}|d
|	krrtd|	|fnj|\}}|std|nj|j|d\}}|sCtd|qCqCWt|tt|kr0td|fq0q0WndS(sCheck that invariants on the dirblock are correct.

        This can be useful in debugging; it shouldn't be necessary in
        normal code.

        This must be called with a lock held.
        i(tpformatR.s'dirblocks don't start with root block:
is"dirblocks missing root directory:
R`s#dir names are not in sorted order:
s
keys:
s2entry key for %rdoesn't match directory name in
%rs!dirblock for %r is not sorted:
%sc@sddd!d
krdSjddd}|dkr]tdfn|dddkrtd	|fndS(s Check that the current entry has a valid parent.

            This makes sure that the parent has a record,
            and that the parent isn't marked as "absent" in the
            current tree. (It is invalid to have a non-absent file in an absent
            directory.)
            iiR.NRds"no parent entry for: %s in tree %siR$s:Parent entry for %s is not marked as a valid directory. %s(R.R.(NN(RqR8Ro(tparent_entry(RRt	this_pathRm(s3/usr/lib/python2.7/dist-packages/bzrlib/dirstate.pytcheck_valid_parentsis5wrong number of entry details for row
%s,
expected %dRgR!s2file %s is absent in row %r but also present at %rR&s+file %s relocation in row %r but also at %rs6entry %r inconsistent with previous path %r seen at %rs"entry %r has no data for any tree.s%file_id %r did not match entry key %ssmissing block for entry key: %rsmissing entry for key: %rs)id_index contained non-unique data for %sN(tpprintR5RRyR5RoRhRRRttdictR\RRtRR8R=R=RwRxRJ(RR5R$t	dir_namestdirblockR8Rtitid_path_mapsRtabsent_positionst
tree_statet
this_tree_mapRt
previous_pathtprevious_locttarget_locationRRRRR((RRR7Rms3/usr/lib/python2.7/dist-packages/bzrlib/dirstate.pyt	_validateLs
*!""





#cC@smtj|_tj|_t|_g|_g|_g|_d|_
d|_d|_d|_
i|_dS(s0Forget all state information about the dirstate.N(R R0R1R2R3R4R7R6R5R8R=R>R?R@RA(R((s3/usr/lib/python2.7/dist-packages/bzrlib/dirstate.pyt_wipe_states								cC@s_|jdk	r$tj|jntj|j|_d|_|jj|_	|j
dS(s$Acquire a read lock on the dirstate.R&N(R;R8RtLockContentionRtReadLockR:R<R#R9RF(R((s3/usr/lib/python2.7/dist-packages/bzrlib/dirstate.pyRs	cC@s_|jdk	r$tj|jntj|j|_d|_|jj|_	|j
dS(s%Acquire a write lock on the dirstate.RN(R;R8RRGRt	WriteLockR:R<R#R9RF(R((s3/usr/lib/python2.7/dist-packages/bzrlib/dirstate.pyR
s	cC@sV|jdkr!tj|nd|_d|_|jjd|_i|_dS(s$Drop any locks held on the dirstate.N(R;R8RtLockNotHeldR9R<R$RA(R((s3/usr/lib/python2.7/dist-packages/bzrlib/dirstate.pyR$
s		
	cC@s|jstj|ndS(s?Check that a lock is currently held by someone on the dirstate.N(R;RR(R((s3/usr/lib/python2.7/dist-packages/bzrlib/dirstate.pyR#
s	N(oRRRRRuRtS_IFDIRtS_IFREGtS_IFLNKRRrR3RRBR0RWRYRXR~R	RsRtHEADER_FORMAT_2RRSRUR8R]R^RRRRRRR}RRR	RRRRwRxtstaticmethodR-R5RPR<R>R[R;R7R_R`R^R@RRRRFRRtsystplatformRRRRRRRRR{RqtclassmethodRR]R:R\RlRRRRRRRRRRRRRRRRRR!RR"RRSRsR'RERFRRR$R(((s3/usr/lib/python2.7/dist-packages/bzrlib/dirstate.pyR 's





:						=	)		%							#		U	#								M		
								
				Q		%O#$	)		
											
	7									4				
	
	cC@s+y||jd@}Wntk
r)d
SXt|}|dd\}}}	}
}|dkrt|dkrtd}n||kr||kr|dkrd
S|	|jkr|Snd
}t}
|dkr|j|j|
}|jd
kr|jn|j	|jkr|j
|jkrt|ddkr|ddddkr|j|}d||j||f|dd<qdd|j|t
jf|dd<t}
nc|dkrRd
}dddt|f|dd<|dkrI|j|dd|ddd\}}}}|j||tj|dd|ddqt}
n|d	kr|d	krst}
n|j||}|jd
kr|jn|j	|jkr|j
|jkrd	||jt|f|dd<qd	d|jtt
jf|dd<n|
r'|j|gn|S(s@Update the entry based on what is actually on disk.

    This function only calculates the sha if it needs to - if the entry is
    uncachable, or clearly different to the first parent's entry, no sha
    is calculated, and None is returned.

    :param state: The dirstate this entry is in.
    :param entry: This is the dirblock entry for the file in question.
    :param abspath: The path on disk for this file.
    :param stat_value: The stat value done on the path.
    :return: None, or The sha1 hexdigest of the file (40 bytes) or link
        target of a symlink.
    iiiR$R*R#R!R.R(N(RRR8RRRrRR@RRRRyRGR R~R3R{R}RRtRR](tstateRRRRRRetsaved_minikindtsaved_link_or_sha1tsaved_file_sizetsaved_executabletsaved_packed_stattlink_or_sha1tworth_savingR9RRRR((s3/usr/lib/python2.7/dist-packages/bzrlib/dirstate.pytpy_update_entry)
sl
		
	1&		
tProcessEntryPythoncB@seZdddddddddd	d
ddd
ddddgZdZejdZdZdZdZ	dZ
dZRS(told_dirname_to_file_idtnew_dirname_to_file_idtlast_source_parenttlast_target_parenttinclude_unchangedtpartialtuse_filesystem_for_exectutf8_decodetsearched_specific_filestsearch_specific_filestsearched_exact_pathstsearch_specific_file_parentstseen_idsRStsource_indexttarget_indextwant_unversionedR%c		C@si|_i|_|tdgk|_ddg|_ddg|_||_||_t	j
|_t|_t|_
||_t|_t|_||_||_||_|dkrtjdn||_||_dS(NR.isunsupported target index(R]R^RJRbR8R_R`RaRcRt_utf8_decodeRdReRgRfRhRiRSRjRkRRRlR%(	RRaRcRfRSRjRkRlR%((s3/usr/lib/python2.7/dist-packages/bzrlib/dirstate.pyRS
s(									c	C@s5
|jdkrtj}n|d|j}|d|j}|d}|dk	r|dkr|jdksztnt|j|d|dd|d}|d|j}|d}nd}|dd}|d}	|	d	kr	|dkr	|	d
krtj	|j
|ds0|jj|dn|d}
t
jj|
\}}||dd|dd}
|jj|jd|
}|dkrtj|jjd|dd|dd|
|fn|d|j}|d}	n&|dd}|dd}d}
}
|dkr8t}d}t}n|d}|d
kr|
dkrp|||}
}
n||j|
<|	dkrt}nt}t}nF|dkrI|	dkrt}nT|dkr|jjj|d\}}|jj|||n||dk}|jr<ttj|dj@}q|d}n|dkr|	dkrjt}n||dk}t}nd|dkr|	dkrt}nt}t}n4|
dkr|||}
ntj|
|d|	dkr%|
dkr|||}
}
n||j |
<n|rN||j!dkrN|j!d}ny|j |}Wn:t"k
r|jj|jd|}|dd}nX||ddkrd}n||j!d<||j!d<|dd}|ddr||j#dkr|j#d}ny|j|}Wn_t"k
r|jj|jd|}|dkrstd||fn|dd}nX||ddkrd}n||j#d<||j#d<|d}|p||kp||ddkp||k}|r|j$rdtfS|
dkrN|||}
}
|j%|
d}|}n;|j%|
d}|
|
krv|}n|j%|
d}tj&|	}|dd||f|ttf||f|j%|d|j%|dddf||f||ff|fSn(|	dkr|dkr||dd|dd}
|jj|jd|dddd}||ddkrd}n|dk	rN|jrttj'|djotj|dj@}n
|d}|ddd|j%|
dftttfd|fd|j%|dddfd|dfd|fftfS|ddd|j%|
dftttfd|fd|j%|dddfddtfftfSnv|	dkr	|dkr	||dd|dd}
|jj|jd|dddd}||ddkr:	d}n|dd|j%|
ddftttf|df|j%|ddddftj&|	df|ddfftfS|	dkr
|d
kr
tj	|j
|ds1
|jj|dq1
n1|	dkr
|dkr
ntd|	|fdS(sCompare an entry and real disk to generate delta information.

        :param path_info: top_relpath, basename, kind, lstat, abspath for
            the path of entry. If None, then the path is considered absent in 
            the target (Perhaps we should pass in a concrete entry for this ?)
            Basename is returned as a utf8 string because we expect this
            tuple will be ignored, and don't want to take the time to
            decode.
        :return: (iter_changes_result, changed). If the entry has not been
            handled then changed is None. Otherwise it is False if no content
            or metadata changes have occurred, and True if any content or
            metadata change has occurred. If self.include_unchanged is True then
            if changed is not None, iter_changes_result will always be a result
            tuple. Otherwise, iter_changes_result is None unless changed is
            True.
        iiRRiRiitfdltrR&RdsOentry '%s/%s' is considered renamed from %r but source does not exist
entry: %sR%R$RR#R)R(stree-referenceR*s4Could not find target parent in wt: %s
parent of: %sR!tras@don't know how to compare source_minikind=%r, target_minikind=%rN(NN(NN(NN(NN((RjR8R RRkRotupdate_entryRSRt
is_inside_anyReRfRRRPRhRqRtCorruptDirstateR:RrR3R^RDRRRcRRRRtBadFileKindErrorR]R_RR`RaRdRutS_ISREG(RRt	path_infoRttsource_detailsttarget_detailsttarget_minikindRYRtsource_minikindREtold_dirnametold_basenameRPt	old_entrytcontent_changettarget_kindttarget_execRtsource_parent_idtsource_parent_entryRttarget_parent_idttarget_parent_entrytsource_exectchangedt
old_path_utpath_utsource_kindR*((s3/usr/lib/python2.7/dist-packages/bzrlib/dirstate.pyt_process_entry
sd




	)

	

			
	
				
		

!
		



		
			+			
		
		+			cC@s|S(N((R((s3/usr/lib/python2.7/dist-packages/bzrlib/dirstate.pyt__iter__scC@sz|js|drdS|jj|d|dd}|rv|jjtj|jd|jjdndS(sCheck a result we will yield to make sure we are consistent later.
        
        This gathers result's parents into a set to output later.

        :param result: A result tuple.
        iNiRaR.(RbRiRRhRVRtparent_directoriesRm(RRRF((s3/usr/lib/python2.7/dist-packages/bzrlib/dirstate.pyt_gather_result_for_consistencys	c#	c@stj}t}|j}|j}|j}tj}x|r|j}|j	d}|j
||jj|}	|j
j|}
ytj|
}Wn1tk
r}|jtjkrd}
q7niXd|tj|j||
f}
|
ddkr7|j
j|j	dr7|
d d|
d}
q7n|	rK|
rKq6nt}xe|	D]]}|||
\}}|dk	rXt}|r|j|n|s|jr|VqqXqXW|jrK|rK|
rKttj|
djotj |
dj@}dd|ftttfdd||dfd|
dfd|ffVn|ddf}|jj!|\}}|dkr|d	7}n|
r|
ddkrd}ntj"|
d
|}y|j#}Wntk
rb}t$|dd}t%t&f}|jtjtj'tj(fkr)d}qt)j*dkr\|j|ksS||kr\d}qn]X|dddkrt+j,|d	d}|d	|dd
krt-n|d	|=n|t.|jj/kr
tj0||jj/|dr
|jj/|}nd}x|dk	s+|dk	r|r|r|dd|dkr||dd|ddkrd}x<|t.|d	kr|d	|}|jr|ddkr|j
j|dj	dr|d d|d}qnttj|djotj |dj@}dd||ddftttfdd||d	dfd|dfd|ffVn|ddkr|d	|=|d	8}n|d	7}qyWy|j#}Wqt1k
rd}qXqxc|d	D]W}||d\}}|dk	r|r*|j|n|s9|jrD|VqDqqW|d	7}|t.|jj/krtj0||jj/|dr|jj/|}qd}qnd}|r|t.|d	kr|d	|}nd}t} d}|rf|t.|d	krf|d	|}|ddkrl|j
j|dj	drc|d d|d}qcqlnd}t}!t}x|dk	s|dk	r&|dkrne|dkr|||\}}|dk	r	|r|j|n|s|jr|Vqq	n|dd	|d	ks5|d	|j2ddkr|d	|dd	krVt} q	||d\}}|dk	r|r|j|n|s|jr|Vqnt}!nW|||\}}|dk	r	t}|r|j|n|s|jr	|Vq	n| rS	|dk	rS	|d	7}|t.|d	krJ	|d	|}qY	d}nt} |!r|dk	r|sj
|jr?
ttj|djo	tj |dj@}y||dd}"Wn*t3k
r	t4j5|dtj6nXdd|"ftttfdd||d	dfd|dfd|ffVn|ddkrj
|d	|=|d	8}qj
n|ddkr
|d	|=|d	8}n|d	7}|t.|d	kr|d	|}|ddkr|j
j|dj	dr|d d|d}qqnd}t}q{t}!q{W|dk	r|d	7}|t.|jj/krtj0||jj/|dr|jj/|}qd}n|dk	ry|j#}Wqt1k
rd}qXqqWq6Wx|j7D]}|VqWdS(sIterate over the changes.RaR.iR%stree-referenceiiiitprefixtwinerrorRs.bzrRgN(stree-reference(NN(s.bzr(stree-reference(NN(s	directorystree-reference(stree-reference(NN(stree-reference(8RRmRRRfReRt	splitpathRRYRRSR	R%RRRtOSErrorterrnotENOENTR8tfile_kind_from_stat_modeRt_directory_is_tree_referenceR3RrRRaRlRRRtRRwt_walkdirs_utf8RtgetattrtERROR_DIRECTORYtERROR_PATH_NOT_FOUNDtENOTDIRtEINVALRPRQRRRoRyR5t	is_insideRRktUnicodeDecodeErrorRtBadFilenameEncodingRt_iter_specific_file_parents(#RRdt_cmp_by_dirsRRfReRtcurrent_roottcurrent_root_unicodetroot_entriestroot_abspatht	root_statR\t
root_dir_infotpath_handledRRRtnew_executabletinitial_keyRRtcurrent_dir_infotdir_iteratort
e_winerrort
win_errorst	bzr_indexRt
path_indextcurrent_path_infot
current_entryRt
advance_entrytadvance_pathtrelpath_unicode((s3/usr/lib/python2.7/dist-packages/bzrlib/dirstate.pytiter_changess					'	
			
		

	!		 !
			
	


	
					
		
		


		

 	
cc@soxh|jrj|jj}tj|j|r6qn||jkrKqn|jj|}g}t}x|D]}|d|j	ddkrt
}|j|qp|jd
k	rp|d|jddkrpt
}|d|j	ddkr|j|q$|jj|d|j	dqpqpW|sGtd||fn|j||jd}x|D]}|dd|jkrqin|j||\}}	|	d
krtd|||fn|	r<|j||d	dd
kr<|d	dd
kr<|d|jddkr:|d|jd}
n|}
|
ddf}|jj|\}}
|dkr|d7}nd
}|t|jjkr|jj|}tj|
|dsd
}qn|d
k	r9xW|dD]H}|d|jddkrqn|jjtj|dd qWq9q<n|	sK|jri|VqiqiW|jj|qWd
S(s$Iter over the specific file parents.iiRgR!s-Missing entry for specific path parent %r, %rRaisEGot entry<->path mismatch for specific path %r entry %r path_info %r iR%R&R.N(RhRRRqReRgRSR	R3RkRrRRjR8RRot
_path_infoRYRiRRRwRyR5RRtRa(RRdtpath_entriestselected_entriest
found_itemtcandidate_entryRuRRRtentry_path_utf8RRRR((s3/usr/lib/python2.7/dist-packages/bzrlib/dirstate.pyR/sx
	

	
	%cC@s|jj|}ytj|}Wn,tk
rS}|jtjkrMdSnX|jddd}||t	j
|j||f}|ddkr|jj|r|j
d d	|j
d|_
qn|S(
szGenerate path_info for unicode_path.

        :return: None if unicode_path does not exist, or a path_info tuple.
        R`iiiR%stree-referenceiN(stree-reference(R%RRRRRRR8trsplitRRRRR(Rt	utf8_pathtunicode_pathRRR\t
utf8_basenametdir_info((s3/usr/lib/python2.7/dist-packages/bzrlib/dirstate.pyRs 			%(RRt	__slots__RSRRtRRRRRR(((s3/usr/lib/python2.7/dist-packages/bzrlib/dirstate.pyR\
s				%			Z	[(RRRRRRt
ProcessEntryCRp(RRRRRR(.Rt
__future__RRRRQRRRRPRRtbzrlibRRRRRRRR	R
RRRtobjectRRR RR[R\tbzrlib._dirstate_helpers_pyxRRRRRRRRRptImportErrorR\tfailed_to_load_extensiontbzrlib._dirstate_helpers_py(((s3/usr/lib/python2.7/dist-packages/bzrlib/dirstate.pyt<module>sPF]!>

.

Copyright © 2017 || Recoded By Mr.Bumblebee