-=[ Mr. Bumblebee ]=-
_Indonesia_

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


X`Oc@@sddlmZdZddlmZeedddlmZmZddl	m
Z
ddlmZm
Z
defd	YZd
efdYZdefd
YZdefdYZdefdYZdefdYZdefdYZdefdYZdefdYZied6ed6ed6ed6ZedZdZejd Zd!Zd"Zd#Z d$Z!d%Z"d&Z#d'Z$d(Z%d)S(*i(tabsolute_importt	TREE_ROOT(tlazy_imports
import collections
import copy
import re
import tarfile

from bzrlib import (
    chk_map,
    errors,
    generate_ids,
    osutils,
    )
(t
lazy_regexttrace(tStaticTuple(t
deprecated_intdeprecated_methodtInventoryEntrycB@seZdZdZdZddddgZeZdZ	dZ
dZdZdZ
dZedZd	Zd
ZdZdZdZdZedZdZdZdZedZdZdZdZdZdZ dZ!dZ"RS(sDescription of a versioned file.

    An InventoryEntry has the following fields, which are also
    present in the XML inventory-entry element:

    file_id

    name
        (within the parent directory)

    parent_id
        file_id of the parent directory, or ROOT_ID

    revision
        the revision_id in which this variation of this file was
        introduced.

    executable
        Indicates that this file should be executable on systems
        that support it.

    text_sha1
        sha-1 of the text of the file

    text_size
        size in bytes of the text of the file

    (reading a version 4 tree created a text_id field.)

    >>> i = Inventory()
    >>> i.path2id('')
    'TREE_ROOT'
    >>> i.add(InventoryDirectory('123', 'src', ROOT_ID))
    InventoryDirectory('123', 'src', parent_id='TREE_ROOT', revision=None)
    >>> i.add(InventoryFile('2323', 'hello.c', parent_id='123'))
    InventoryFile('2323', 'hello.c', parent_id='123', sha1=None, len=None, revision=None)
    >>> shouldbe = {0: '', 1: 'src', 2: 'src/hello.c'}
    >>> for ix, j in enumerate(i.iter_entries()):
    ...   print (j[0] == shouldbe[ix], j[1])
    ...
    (True, InventoryDirectory('TREE_ROOT', u'', parent_id=None, revision=None))
    (True, InventoryDirectory('123', 'src', parent_id='TREE_ROOT', revision=None))
    (True, InventoryFile('2323', 'hello.c', parent_id='123', sha1=None, len=None, revision=None))
    >>> i.add(InventoryFile('2324', 'bye.c', '123'))
    InventoryFile('2324', 'bye.c', parent_id='123', sha1=None, len=None, revision=None)
    >>> i.add(InventoryDirectory('2325', 'wibble', '123'))
    InventoryDirectory('2325', 'wibble', parent_id='123', revision=None)
    >>> i.path2id('src/wibble')
    '2325'
    >>> i.add(InventoryFile('2326', 'wibble.c', '2325'))
    InventoryFile('2326', 'wibble.c', parent_id='2325', sha1=None, len=None, revision=None)
    >>> i['2326']
    InventoryFile('2326', 'wibble.c', parent_id='2325', sha1=None, len=None, revision=None)
    >>> for path, entry in i.iter_entries():
    ...     print path
    ...
    <BLANKLINE>
    src
    src/bye.c
    src/hello.c
    src/wibble
    src/wibble/wibble.c
    >>> i.id2path('2326')
    'src/wibble/wibble.c'
    trenamedsmodified and renamedtfile_idtrevisiont	parent_idtnamecC@s
ttfS(sReturn a (text_modified, meta_modified) from this to old_entry.

        _read_tree_state must have been called on self and old_entry prior to
        calling detect_changes.
        (tFalse(tselft	old_entry((s4/usr/lib/python2.7/dist-packages/bzrlib/inventory.pytdetect_changessc		C@sdS(s4Perform a diff between two entries of the same kind.N((	Rt	text_difft
from_labelttreetto_labeltto_entrytto_treet	output_totreverse((s4/usr/lib/python2.7/dist-packages/bzrlib/inventory.pyt_diffscC@si}x|D]}|j|jr
||j}|j|kry9||jj|jkryt||j_t|_nWqtk
rqXq|||j<q
q
W|S(sTFind possible per-file graph parents.

        This is currently defined by:
         - Select the last changed revision in the parent inventory.
         - Do deal with a short lived bug in bzr 0.8's development two entries
           that have the same last changed but different 'x' bit settings are
           changed in-place.
        (thas_idR
Rt
executableRtAttributeError(Rtprevious_inventoriest
candidatestinvtie((s4/usr/lib/python2.7/dist-packages/bzrlib/inventory.pytparent_candidatess



cC@stS(sUReturn true if the object this entry represents has textual data.

        Note that textual data includes binary content.

        Also note that all entries get weave files created for them.
        This attribute is primarily used when upgrading from old trees that
        did not have the weave index for all inventory entries.
        (R(R((s4/usr/lib/python2.7/dist-packages/bzrlib/inventory.pythas_texts	cC@sUd|ksd|kr-tjd|n||_d|_||_||_dS(sCreate an InventoryEntry

        The filename must be a single component, relative to the
        parent directory; it cannot be a whole path or relative name.

        >>> e = InventoryFile('123', 'hello.c', ROOT_ID)
        >>> e.name
        'hello.c'
        >>> e.file_id
        '123'
        >>> e = InventoryFile('123', 'src/hello.c', ROOT_ID)
        Traceback (most recent call last):
        InvalidEntryName: Invalid entry name: src/hello.c
        t/s\R
N(terrorstInvalidEntryNameR
tNoneRR
R(RR
R
R((s4/usr/lib/python2.7/dist-packages/bzrlib/inventory.pyt__init__s			cC@stjd|jdS(s<Return a short kind indicator useful for appending to names.sunknown kind %rN(R%tBzrErrortkind(R((s4/usr/lib/python2.7/dist-packages/bzrlib/inventory.pytkind_characterstfilet	directorytsymlinkcC@st|jjS(N(tsortedtchildrentitems(R((s4/usr/lib/python2.7/dist-packages/bzrlib/inventory.pytsorted_childrenscC@s
|dkS(NR,R-R.stree-reference(sfileR-ssymlinkstree-reference((R*((s4/usr/lib/python2.7/dist-packages/bzrlib/inventory.pytversionable_kindscC@sg|jdk	rC|j|jsCtjd|j|fqCn|j|||j||dS(sCheck this inventory entry is intact.

        This is a template method, override _check for kind specific
        tests.

        :param checker: Check object providing context for the checks;
             can be used to find out what parts of the repository have already
             been checked.
        :param rev_id: Revision id from which this InventoryEntry was loaded.
             Not necessarily the last-changed revision for this file.
        :param inv: Inventory from which the entry was loaded.
        s2missing parent {%s} in inventory for revision {%s}N(RR'RR%t
BzrCheckErrort!_add_entry_to_text_key_referencest_check(Rtcheckertrev_idR ((s4/usr/lib/python2.7/dist-packages/bzrlib/inventory.pytchecks
cC@s!|jjd|j|fdS(s4Check this inventory entry for kind specific errors.s&unknown entry kind %r in revision {%s}N(t
_report_itemstappendR*(RR7R8((s4/usr/lib/python2.7/dist-packages/bzrlib/inventory.pyR6s	cC@s
tdS(sClone this inventory entry.N(tNotImplementedError(R((s4/usr/lib/python2.7/dist-packages/bzrlib/inventory.pytcopyscC@s||krdS|dkr dS|dkr0dS|j|jkrFdS|j|\}}|sg|rpt}nt}|j|jkrt}n!|j|jkrt}nt}|r|rtjS|r|rdS|r|rtj	SdS(sDescribe the change between old_entry and this.

        This smells of being an InterInventoryEntry situation, but as its
        the first one, we're making it a static method for now.

        An entry with a different parent, or different name is considered
        to be renamed. Reparenting is an internal detail.
        Note that renaming the parent does not trigger a rename for the
        child entry itself.
        t	unchangedtaddedtremovedtmodifiedN(
R'R*RtTrueRRR
RtRENAMEDtMODIFIED_AND_RENAMED(Rt	new_entryt
text_modifiedt
meta_modifiedRAR	((s4/usr/lib/python2.7/dist-packages/bzrlib/inventory.pytdescribe_changes0
			

cC@s)d|jj|j|j|j|jfS(Ns%%s(%r, %r, parent_id=%r, revision=%r)(t	__class__t__name__R
R
RR(R((s4/usr/lib/python2.7/dist-packages/bzrlib/inventory.pyt__repr__9s	cC@s||krtSt|ts#tS|j|jko|j|jko|j|jko|j|jko|j|jko|j	|j	ko|j
|j
ko|j|jko|j|jko|j
|j
ko|j|jkS(N(RBt
isinstanceRtNotImplementedR
R
tsymlink_targett	text_sha1t	text_sizettext_idRR*RRtreference_revision(Rtother((s4/usr/lib/python2.7/dist-packages/bzrlib/inventory.pyt__eq__AscC@s||kS(N((RRS((s4/usr/lib/python2.7/dist-packages/bzrlib/inventory.pyt__ne__UscC@stddS(Nsnot hashable(t
ValueError(R((s4/usr/lib/python2.7/dist-packages/bzrlib/inventory.pyt__hash__XscC@s[t}|j|jkr!t}n6|j|jkr<t}n|j|jkrWt}n|S(stHas this entry changed relative to previous_ie.

        This method should be overridden in child classes.
        (RBRRR
R*(Rtprevious_iet
compatible((s4/usr/lib/python2.7/dist-packages/bzrlib/inventory.pyt
_unchanged[s			cC@sdS(sPopulate fields in the inventory entry from the given tree.

        Note that this should be modified to be a noop on virtual trees
        as all entries created there are prepopulated.
        N((Rtpatht	work_tree((s4/usr/lib/python2.7/dist-packages/bzrlib/inventory.pyt_read_tree_stateks	cC@sdS(N((R((s4/usr/lib/python2.7/dist-packages/bzrlib/inventory.pyt_forget_tree_statevsN(sfiles	directoryssymlink(#RJt
__module__t__doc__RCRDt	__slots__RRR'RORPRQRNRRRRR"R#R(R+tknown_kindsR2tstaticmethodR3R9R6R=RHRKRTRURWRZR]R^(((s4/usr/lib/python2.7/dist-packages/bzrlib/inventory.pyR;s<A										*						tInventoryDirectorycB@sAeZdZdgZdZdZdZdZdZRS(sA directory in an inventory.R0R-cC@sF|jdkr|jrdS|j|d|j|jfdddS(sSee InventoryEntry._checktNttextsttextt(da39a3ee5e6b4b0d3255bfef95601890afd80709(R
t
rich_rootstadd_pending_itemR
R(RR7R8((s4/usr/lib/python2.7/dist-packages/bzrlib/inventory.pyR6s
	cC@s+t|j|j|j}|j|_|S(N(RdR
R
RR(RRS((s4/usr/lib/python2.7/dist-packages/bzrlib/inventory.pyR=scC@s)tt|j|||i|_dS(N(tsuperRdR(R0(RR
R
R((s4/usr/lib/python2.7/dist-packages/bzrlib/inventory.pyR(scC@sdS(s"See InventoryEntry.kind_character.R$((R((s4/usr/lib/python2.7/dist-packages/bzrlib/inventory.pyR+s(	RJR_R`RaR*R6R=R(R+(((s4/usr/lib/python2.7/dist-packages/bzrlib/inventory.pyRdzs		
		t
InventoryFilecB@seZdZddddgZdZdZdZdZd	Ze	d
Z
dZdZd
Z
dZdZdZRS(sA file in an inventory.RORPRQRR,cC@sDtt|j|||d|_d|_d|_t|_dS(N(	RkRlR(R'RORPRQRR(RR
R
R((s4/usr/lib/python2.7/dist-packages/bzrlib/inventory.pyR(s
			cC@s[|j|d|j|jfd|j|jdkrW|jjd|j|fndS(sSee InventoryEntry._checkRfRgs*fileid {%s} in {%s} has None for text_sizeN(RjR
RRORPR'R:R;(RR7ttree_revision_id((s4/usr/lib/python2.7/dist-packages/bzrlib/inventory.pyR6s	
		cC@s[t|j|j|j}|j|_|j|_|j|_|j|_|j|_|S(N(	RlR
R
RRRQRORPR(RRS((s4/usr/lib/python2.7/dist-packages/bzrlib/inventory.pyR=scC@s.|j|jk}|j|jk}||fS(s"See InventoryEntry.detect_changes.(ROR(RRRFRG((s4/usr/lib/python2.7/dist-packages/bzrlib/inventory.pyRsc	
C@sddlm}	|j}
|r+|j}nd}|ra|
|}}
||}}||}}n|	|||ddd|}|j|
|||S(sSee InventoryEntry._diff.i(tDiffTextsutf-8ReN(tbzrlib.diffRnR
R't	diff_text(
RRRRRRRRRRntfrom_file_idt
to_file_idtdiffer((s4/usr/lib/python2.7/dist-packages/bzrlib/inventory.pyRs	

	cC@stS(sSee InventoryEntry.has_text.(RB(R((s4/usr/lib/python2.7/dist-packages/bzrlib/inventory.pyR#scC@sdS(s"See InventoryEntry.kind_character.Re((R((s4/usr/lib/python2.7/dist-packages/bzrlib/inventory.pyR+scC@s:|j|jd||_|j|jd||_dS(s$See InventoryEntry._read_tree_state.R[N(t
get_file_sha1R
ROt
is_executableR(RR[R\((s4/usr/lib/python2.7/dist-packages/bzrlib/inventory.pyR]scC@s5d|jj|j|j|j|j|j|jfS(Ns6%s(%r, %r, parent_id=%r, sha1=%r, len=%s, revision=%s)(RIRJR
R
RRORPR(R((s4/usr/lib/python2.7/dist-packages/bzrlib/inventory.pyRKs	cC@s
d|_dS(N(R'RO(R((s4/usr/lib/python2.7/dist-packages/bzrlib/inventory.pyR^scC@s^tt|j|}|j|jkr3t}n|j|_|j|jkrZt}n|S(sSee InventoryEntry._unchanged.(RkRlRZRORRPR(RRXRY((s4/usr/lib/python2.7/dist-packages/bzrlib/inventory.pyRZs		(RJR_R`RaR*R(R6R=RRRR#R+R]RKR^RZ(((s4/usr/lib/python2.7/dist-packages/bzrlib/inventory.pyRls									
	t
InventoryLinkcB@sqeZdZdgZdZdZdZdZdZe	dZ
dZd	Zd
Z
dZRS(sA file in an inventory.RNR.cC@s)tt|j|||d|_dS(N(RkRvR(R'RN(RR
R
R((s4/usr/lib/python2.7/dist-packages/bzrlib/inventory.pyR(scC@sX|jdkr/|jjd|j|fn|j|d|j|jfdddS(sSee InventoryEntry._checks+symlink {%s} has no target in revision {%s}RfRgRhN(RNR'R:R;R
RjR(RR7Rm((s4/usr/lib/python2.7/dist-packages/bzrlib/inventory.pyR6s		cC@s7t|j|j|j}|j|_|j|_|S(N(RvR
R
RRNR(RRS((s4/usr/lib/python2.7/dist-packages/bzrlib/inventory.pyR=scC@s8|j|jk}|r(tjdnt}||fS(s"See InventoryEntry.detect_changes.s    symlink target changed(RNRtmutterR(RRRFRG((s4/usr/lib/python2.7/dist-packages/bzrlib/inventory.pyRs
c	C@sddlm}	|j}
|dk	r1|j}nd}|sL|}|}
n|}|}
|
|}}
|	||
|}|j|
|S(sSee InventoryEntry._diff.i(tDiffSymlinkN(RoRxRNR'tdiff_symlink(RRRRRRRRRRxt
old_targett
new_targettold_treetnew_treeRs((s4/usr/lib/python2.7/dist-packages/bzrlib/inventory.pyR&s		
cC@sdS(s"See InventoryEntry.kind_character.Re((R((s4/usr/lib/python2.7/dist-packages/bzrlib/inventory.pyR+9scC@s|j|j|_dS(s$See InventoryEntry._read_tree_state.N(tget_symlink_targetR
RN(RR[R\((s4/usr/lib/python2.7/dist-packages/bzrlib/inventory.pyR]=scC@s
d|_dS(N(R'RN(R((s4/usr/lib/python2.7/dist-packages/bzrlib/inventory.pyR^AscC@s7tt|j|}|j|jkr3t}n|S(sSee InventoryEntry._unchanged.(RkRvRZRNR(RRXRY((s4/usr/lib/python2.7/dist-packages/bzrlib/inventory.pyRZDs	(RJR_R`RaR*R(R6R=RRRR+R]R^RZ(((s4/usr/lib/python2.7/dist-packages/bzrlib/inventory.pyRvs					
			t
TreeReferencecB@sJeZdgZdZdddZdZdZdZdZ	RS(RRstree-referencecC@s,tj||||||_||_dS(N(RR(RRR(RR
R
RRRR((s4/usr/lib/python2.7/dist-packages/bzrlib/inventory.pyR(Rs	cC@s%t|j|j|j|j|jS(N(RR
R
RRRR(R((s4/usr/lib/python2.7/dist-packages/bzrlib/inventory.pyR=XscC@s|j|j||_dS(sDPopulate fields in the inventory entry from the given tree.
        N(tget_reference_revisionR
RR(RR[R\((s4/usr/lib/python2.7/dist-packages/bzrlib/inventory.pyR]\scC@s
d|_dS(N(R'RR(R((s4/usr/lib/python2.7/dist-packages/bzrlib/inventory.pyR^bscC@s7tt|j|}|j|jkr3t}n|S(sSee InventoryEntry._unchanged.(RkRRZRRR(RRXRY((s4/usr/lib/python2.7/dist-packages/bzrlib/inventory.pyRZes	N(
RJR_RaR*R'R(R=R]R^RZ(((s4/usr/lib/python2.7/dist-packages/bzrlib/inventory.pyRLs				tCommonInventorycB@seZdZdZdZdedZdZdde	dZ
dZddZdZ
d	Zd
ZdZRS(
sBasic inventory logic, defined in terms of primitives like has_id.

    An inventory is the metadata about the contents of a tree.

    This is broadly a map from file_id to entries such as directories, files,
    symlinks and tree references. Each entry maintains its own metadata like
    SHA1 and length for files, or children for a directory.

    Entries can be looked up either by path or by file_id.

    InventoryEntry objects must not be modified after they are
    inserted, other than through the Inventory API.
    cC@st|j|S(N(tbooltpath2id(Rtfilename((s4/usr/lib/python2.7/dist-packages/bzrlib/inventory.pythas_filename|scC@s6djtg|j|D]}|j^qd S(s\Return as a string the path to file_id.

        >>> i = Inventory()
        >>> e = i.add(InventoryDirectory('src-id', 'src', ROOT_ID))
        >>> e = i.add(InventoryFile('foo-id', 'foo.c', parent_id='src-id'))
        >>> print i.id2path('foo-id')
        src/foo.c

        :raises NoSuchId: If file_id is not present in the inventory.
        R$i(tjointreversedt_iter_file_id_parentsR
(RR
tparent((s4/usr/lib/python2.7/dist-packages/bzrlib/inventory.pytid2paths	c
c@sp|dkr9|jdkrdS|j}d|jfVnt|trU||}n|jj}|j|sx|D]\}}||fVq{WdStj|}d|fg}x|rk|d\}}x|r]|j	\}}|d|}|d|fV|j
dkrqn|jj}	|	jtj|	}	|j||	fPqW|jqWdS(sReturn (path, entry) pairs, in order by name.
        
        :param from_dir: if None, start from the root,
          otherwise start from this directory (either file-id or entry)
        :param recursive: recurse into directories or not
        NReuiR$iR-(
R'trootRLt
basestringR0R1tsorttcollectionstdequetpopleftR*R;tpop(
Rtfrom_dirt	recursiveR0R
R!tstacktfrom_dir_relpathR[tnew_children((s4/usr/lib/python2.7/dist-packages/bzrlib/inventory.pytiter_entriess:	

		
cC@sdS(sPopulate any caches, we are about to access all items.
        
        The default implementation does nothing, because CommonInventory doesn't
        have a cache.
        N((R((s4/usr/lib/python2.7/dist-packages/bzrlib/inventory.pyt_preload_cachesc#@s}|r%t|tr%t|}n|dkrJ|dkrJ|jn|dkr
|jdkridS|r|dk	rt|dkrt|d}|j|r|j|||fVndS|j}|dks|s|jj	|kr)d|jfVq)nt|t
r)||}n|dk	rwt|fdx!|D]}|q`Wndd|fg}x|rx|j\}}g}xt|j
jD]\}	}
||	}|dks	|
j	|ks	|r|
j	kr||
fVn|
jdkrdksA|
j	kr^|j|d|
fq^qqW|jt|qWdS(s"Iterate over the entries in a directory first order.

        This returns all entries for a directory before returning
        the entries for children of a directory. This is not
        lexicographically sorted order, and is a hybrid between
        depth-first and breadth-first.

        :param yield_parents: If True, yield the parents from the root leading
            down to specific_file_ids that have been requested. This has no
            impact if specific_file_ids is None.
        :return: This yields (path, entry) pairs
        Niiuc@sZj|sdS|j}|dkr0dS|krVj||ndS(N(RRR'tadd(R
R(t
add_ancestorstbyidtparents(s4/usr/lib/python2.7/dist-packages/bzrlib/inventory.pyRs

R-R$(RLtsetR'RRtlentlistRRR
RRR/R0t	iteritemsR*R;textendR(RRtspecific_file_idst
yield_parentsR
Rtcur_relpathtcur_dirt
child_dirst
child_nametchild_iet
child_relpath((RRRs4/usr/lib/python2.7/dist-packages/bzrlib/inventory.pytiter_entries_by_dirsP
	
		
	"
!c	C@st|}t|}||}||}|j|}g}x0|D](}|j|j|d|dfqHWx4|D],}|jd|j||||fq{WxT|D]L}||||kr|j|j||j||||fqqW|S(s-Make an inventory delta from two inventories.N(RtintersectionR;RR'(	Rtoldtold_idstnew_idstaddstdeletestcommontdeltaR
((s4/usr/lib/python2.7/dist-packages/bzrlib/inventory.pyt_make_deltas


&
*
cC@st||||S(s,Simple thunk to bzrlib.inventory.make_entry.(t
make_entry(RR*R
RR
((s4/usr/lib/python2.7/dist-packages/bzrlib/inventory.pyR,sc@s>gfd|jdk	r:|jdnS(srReturn list of (path, ie) for all entries except the root.

        This may be faster than iter_entries.
        c@sx|jj}|jxX|D]P\}}tj||}j||f|jdkr ||q q WdS(NR-(R0R1RtosutilstpathjoinR;R*(tdir_ietdir_pathtkidsR
R!t
child_path(taccumtdescend(s4/usr/lib/python2.7/dist-packages/bzrlib/inventory.pyR6s
uN(RR'(R((RRs4/usr/lib/python2.7/dist-packages/bzrlib/inventory.pytentries0s
	cC@st|tr!tj|}n|}y
|j}Wntjk
rKdSX|dkr\dSxY|D]Q}y6t|dd}|dkrdS||}|}Wqct	k
rdSXqcW|j
S(s{Walk down through directories to return entry of last component.

        :param relpath: may be either a list of path components, or a single
            string, in which case it is automatically split.

        This returns the entry of the last component in the path,
        which may be either a file or a directory.

        Returns None IFF the path is not found.
        R0N(RLRRt	splitpathRR%tNoSuchIdR'tgetattrtKeyErrorR
(RtrelpathtnamesRtfR0tcie((s4/usr/lib/python2.7/dist-packages/bzrlib/inventory.pyRCs&




	c
C@s9t}x?|D]7}y|j|j|Wqtjk
rFqXqW|j}|jdkrstddSt|j	dj
}|jj|j_|j|_t}x|D]w\}}|j
}	|	|ks|j
|kr|jdkr|j|	qn|	|krqn|j|jqW|S(sGet an inventory view filtered against a set of file-ids.

        Children of directories and parents are included.

        The result may or may not reference the underlying inventory
        so it should be treated as immutable.
        troot_idiR-N(Rtupdatet
get_idpathR%RRRR't	InventorytnextR
Rtrevision_idRR*RR=(
Rtspecific_fileidstinteresting_parentstfileidRRStdirectories_to_expandR[tentryR
((s4/usr/lib/python2.7/dist-packages/bzrlib/inventory.pytfiltergs.	

		cC@s7g}x*|j|D]}|jd|jqW|S(s0Return a list of file_ids for the path to an entry.

        The list contains one element for each directory followed by
        the id of the file itself.  So the length of the returned list
        is equal to the depth of the file in the tree, counting the
        root directory as depth 1.
        i(RtinsertR
(RR
tpR((s4/usr/lib/python2.7/dist-packages/bzrlib/inventory.pyRsN(RJR_R`RRR'RBRRRRRRRRRR(((s4/usr/lib/python2.7/dist-packages/bzrlib/inventory.pyRms
		5	M			$	!RcB@seZdZeddZdZdZedZ	dZ
dZdZdZ
d	Zd
ZdZdZd
ZdZdddZdZdZdZdZdZdZdZdZdZdZRS(sMutable dict based in-memory inventory.

    We never store the full path to a file, because renaming a directory
    implicitly moves all of its contents.  This class internally maintains a
    lookup tree that allows the children under a directory to be
    returned quickly.

    >>> inv = Inventory()
    >>> inv.add(InventoryFile('123-123', 'hello.c', ROOT_ID))
    InventoryFile('123-123', 'hello.c', parent_id='TREE_ROOT', sha1=None, len=None, revision=None)
    >>> inv['123-123'].name
    'hello.c'

    Id's may be looked up from paths:

    >>> inv.path2id('hello.c')
    '123-123'
    >>> inv.has_id('123-123')
    True

    There are iterators over the contents:

    >>> [entry[0] for entry in inv.iter_entries()]
    ['', u'hello.c']
    cC@sG|dk	r(|jt|ddnd|_i|_||_dS(s5Create or read an inventory.

        If a working directory is specified, the inventory is read
        from there.  If the file is specified, read from that. If not,
        the inventory is created empty.

        The inventory is created with a default root directory, with
        an id of None.
        uN(R't	_set_rootRdRt_byidR(RRR((s4/usr/lib/python2.7/dist-packages/bzrlib/inventory.pyR(s

		cC@s\d}d}t|j}t||krH||t| |}ndt||fS(Nis...}s%<Inventory object at %x, contents=%r>(treprRRtid(Rtmax_lentclosingtcontents((s4/usr/lib/python2.7/dist-packages/bzrlib/inventory.pyRKscC@s-ttttttt|i}xtd|DdtD]\}}t	||di}t
|r|||<n|j||krtj
||d|j|n|j|qQWxtd|DD]\}}}|jdkrTt|j|j|j}	|j|	_|j|	ji|	_|	}ny|j|WnTtjk
rtj
||jdn)tk
rtj
||jdnX|j|j|krtj
||jd	qqWt
|r)|j\}
}tj
d
|
dndS(
s-Apply a delta to this inventory.

        See the inventory developers documentation for the theory behind
        inventory deltas.

        If delta application fails the inventory is left in an indeterminate
        state and must not be used.

        :param delta: A list of changes to apply. After all the changes are
            applied the final inventory must be internally consistent, but it
            is ok to supply changes which, if only half-applied would have an
            invalid result - such as supplying two changes which rename two
            files, 'A' and 'B' with each other : [('A', 'B', 'A-id', a_entry),
            ('B', 'A', 'B-id', b_entry)].

            Each change is a tuple, of the form (old_path, new_path, file_id,
            new_entry).

            When new_path is None, the change indicates the removal of an entry
            from the inventory and new_entry will be ignored (using None is
            appropriate). If new_path is not None, then new_entry must be an
            InventoryEntry instance, which will be incorporated into the
            inventory (and replace any existing entry with the same file id).

            When old_path is None, the change indicates the addition of
            a new entry to the inventory.

            When neither new_path nor old_path are None, the change is a
            modification to an entry, such as a rename, reparent, kind change
            etc.

            The children attribute of new_entry is ignored. This is because
            this method preserves children automatically across alterations to
            the parent of the children, and cases where the parent id of a
            child is changing require the child to be passed in as a separate
            change regardless. E.g. in the recursive deletion of a directory -
            the directory's children must be included in the delta, or the
            final inventory will be invalid.

            Note that a file_id must only appear once within a given delta.
            An AssertionError is raised otherwise.
        cs@s3|])\}}}}|dk	r||fVqdS(N(R'(t.0toptnpRte((s4/usr/lib/python2.7/dist-packages/bzrlib/inventory.pys	<genexpr>sRR0s!Entry was at wrong other path %r.cs@s6|],\}}}}|dk	r|||fVqdS(N(R'(RRRRR((s4/usr/lib/python2.7/dist-packages/bzrlib/inventory.pys	<genexpr>sR-s$New id is already present in target.sParent is not a directory.s,New path is not consistent with parent path.s	<deleted>s:The file id was deleted but its children were not deleted.N(Rt_check_delta_unique_idst_check_delta_unique_new_pathst_check_delta_unique_old_pathst_check_delta_ids_match_entryt_check_delta_ids_are_validt(_check_delta_new_path_entry_both_or_NoneR/RBRRRR%tInconsistentDeltatremove_recursive_idR*RdR
R
RRRR0RtDuplicateFileIdRtpopitem(RRR0told_pathR
tfile_id_childrentnew_pathRREtreplacementR((s4/usr/lib/python2.7/dist-packages/bzrlib/inventory.pytapply_deltasL/	
		

cC@s&|j}|j|||_|S(s(See CHKInventory.create_by_apply_delta()(R=RR(Rtinventory_deltatnew_revision_idtpropagate_cachestnew_inv((s4/usr/lib/python2.7/dist-packages/bzrlib/inventory.pytcreate_by_apply_delta2s
	cC@s&||_i|j|jj6|_dS(N(RR
R(RR!((s4/usr/lib/python2.7/dist-packages/bzrlib/inventory.pyR:s	cC@s|j}|jdkr(tddSt|jdj}|jj|j_x'|D]\}}|j|jqZW|S(NRi(	RRR'RRR
RRR=(RRRSR[R((s4/usr/lib/python2.7/dist-packages/bzrlib/inventory.pyR=>s
cC@s
t|jS(sIterate over all file-ids.(titerR(R((s4/usr/lib/python2.7/dist-packages/bzrlib/inventory.pyt__iter__Kscc@s<|jdkrdSx"|jjD]\}}|Vq#WdS(sIterate over all entries.
        
        Unlike iter_entries(), just the entries are returned (not (path, ie))
        and the order of entries is undefined.

        XXX: We may not want to merge this into bzr.dev.
        N(RR'RR(Rt_R!((s4/usr/lib/python2.7/dist-packages/bzrlib/inventory.pytiter_just_entriesOscC@s
t|jS(sReturns number of entries.(RR(R((s4/usr/lib/python2.7/dist-packages/bzrlib/inventory.pyt__len__\scC@s9y|j|SWn#tk
r4tj||nXdS(s#Return the entry for given file_id.

        >>> inv = Inventory()
        >>> inv.add(InventoryFile('123123', 'hello.c', ROOT_ID))
        InventoryFile('123123', 'hello.c', parent_id='TREE_ROOT', sha1=None, len=None, revision=None)
        >>> inv['123123'].name
        'hello.c'
        N(RRR%R(RR
((s4/usr/lib/python2.7/dist-packages/bzrlib/inventory.pyt__getitem__`s	
cC@s|j|jS(N(RR*(RR
((s4/usr/lib/python2.7/dist-packages/bzrlib/inventory.pyt
get_file_kindoscC@s||jj|S(N(R0tget(RRR((s4/usr/lib/python2.7/dist-packages/bzrlib/inventory.pyt	get_childrscC@so|j|jkr+tjd|jn||j|j<x-t|dijD]}|j|qTW|S(s>Add an entry to the inventory, without adding it to its parents-inventory already contains entry with id {%s}R0(R
RR%R)Rt
itervaluest
_add_child(RRtchild((s4/usr/lib/python2.7/dist-packages/bzrlib/inventory.pyRuscC@s|j|jkr4tj|j|j|jn|jdkrO||_ny|j|j}Wn)tk
rtjd|jdnX|j	|j
krtj|j|j
|j	j|jdn||j
|j	<|j|S(s8Add entry to inventory.

        :return: entry
        s	<unknown>sParent not in inventory.sPath already versionedN(
R
RR%RRR'RRRR
R0RR(RRR((s4/usr/lib/python2.7/dist-packages/bzrlib/inventory.pyRs"

cC@stj|}t|dkrq|dkr<tj}nt|dd|_i|j|jj6|_	|jS|d }|j
|}|dkrtjd|nt
||d||}|j|S(svAdd entry from a path.

        The immediate parent must already be versioned.

        Returns the new entry object.iReiR[N(RRRR'tgenerate_idstgen_root_idRdRR
RRR%tNotVersionedErrorRR(RRR*R
Rtpartstparent_pathR!((s4/usr/lib/python2.7/dist-packages/bzrlib/inventory.pytadd_paths
cC@s>||}|j|=|jdk	r:||jj|j=ndS(sJRemove entry by id.

        >>> inv = Inventory()
        >>> inv.add(InventoryFile('123', 'foo.c', ROOT_ID))
        InventoryFile('123', 'foo.c', parent_id='TREE_ROOT', sha1=None, len=None, revision=None)
        >>> inv.has_id('123')
        True
        >>> del inv['123']
        >>> inv.has_id('123')
        False
        N(RRR'R0R
(RR
R!((s4/usr/lib/python2.7/dist-packages/bzrlib/inventory.pyt__delitem__s

cC@s#t|tstS|j|jkS(sCompare two sets by comparing their contents.

        >>> i1 = Inventory()
        >>> i2 = Inventory()
        >>> i1 == i2
        True
        >>> i1.add(InventoryFile('123', 'foo', ROOT_ID))
        InventoryFile('123', 'foo', parent_id='TREE_ROOT', sha1=None, len=None, revision=None)
        >>> i1 == i2
        False
        >>> i2.add(InventoryFile('123', 'foo', ROOT_ID))
        InventoryFile('123', 'foo', parent_id='TREE_ROOT', sha1=None, len=None, revision=None)
        >>> i1 == i2
        True
        (RLRRMR(RRS((s4/usr/lib/python2.7/dist-packages/bzrlib/inventory.pyRTscC@s|j|S(N(RT(RRS((s4/usr/lib/python2.7/dist-packages/bzrlib/inventory.pyRUscC@stddS(Nsnot hashable(RV(R((s4/usr/lib/python2.7/dist-packages/bzrlib/inventory.pyRWscc@sbx[|dk	r]y|j|}Wn)tk
rKtjddd|nX|V|j}qWdS(s,Yield the parents of file_id up to the root.RR
N(R'RRR%RR(RR
R!((s4/usr/lib/python2.7/dist-packages/bzrlib/inventory.pyRs
cC@s
||jkS(N(R(RR
((s4/usr/lib/python2.7/dist-packages/bzrlib/inventory.pyRsc
C@sOt|d|}|j}t|}t|}||}||}|r^|r^|}n|j|}g}	x0|D](}
|	j|j|
d|
dfqzWx4|D],}
|	jd|j|
|
||
fqWxk|D]c}
||
}||
}||ks||krqq|	j|j|
|j|
|
|fqW|	S(s-Make an inventory delta from two inventories.RN(RRRRR;RR'(
RRt
old_gettert
new_getterRRRRRRR
tnew_ietold_ie((s4/usr/lib/python2.7/dist-packages/bzrlib/inventory.pyRs,	

	
&
*


cC@s|j|g}g}xN|rf|j}|j|j|jdkr|j|jjqqWx(t|D]}||}|j|=qtW|j	dk	r||j	j|j=n	d|_dS(shRemove file_id, and children, from the inventory.

        :param file_id: A file_id to remove.
        R-N(
RRR;R
R*RR0tvaluesRRR'R
R(RR
tto_find_deletet	to_deleteR!((s4/usr/lib/python2.7/dist-packages/bzrlib/inventory.pyRs	
cC@st|}t|s.tjd|n|j|}||jkrotjd||j|fn|j|}||krtjd|j||j|fn|j|}|j|j}|j|j	=||j|<||_	||_dS(sMove a file within the inventory.

        This can change either the name, or the parent, or both.

        This does not move the working file.
        snot an acceptable filename: %rs%r already exists in %rs:cannot move directory %r into a subdirectory of itself, %rN(
tensure_normalized_namet
is_valid_nameR%R)RR0RRRR
(RR
t
new_parent_idtnew_namet
new_parenttnew_parent_idpathtfile_iet
old_parent((s4/usr/lib/python2.7/dist-packages/bzrlib/inventory.pytrenames$
	%


	cC@s|jdk	o||jjkS(N(RR'R
(RR
((s4/usr/lib/python2.7/dist-packages/bzrlib/inventory.pytis_root<sN(RJR_R`tROOT_IDR'R(RKRRRRR=RRRRRRRRRRRTRURWRRRRRR(((s4/usr/lib/python2.7/dist-packages/bzrlib/inventory.pyRs4			h		
		
											
				!tCHKInventorycB@seZdZdZdZdZdZdZedZ	dZ
edZe
d	Ze
d
ddZd
ZdZdZdZdZdZdZdZdZdZdZdZdZdZdZedZ RS(sAn inventory persisted in a CHK store.

    By design, a CHKInventory is immutable so many of the methods
    supported by Inventory - add, rename, apply_delta, etc - are *not*
    supported. To create a new CHKInventory, use create_by_apply_delta()
    or from_inventory(), say.

    Internally, a CHKInventory has one or two CHKMaps:

    * id_to_entry - a map from (file_id,) => InventoryEntry as bytes
    * parent_id_basename_to_file_id - a map from (parent_id, basename_utf8)
        => file_id as bytes

    The second map is optional and not present in early CHkRepository's.

    No caching is performed: every method call or item access will perform
    requests to the storage layer. As such, keep references to objects you
    want to reuse.
    cC@s>tj|i|_t|_i|_||_d|_dS(N(	RR(t_fileid_to_entry_cacheRt
_fully_cachedt_path_to_fileid_cachet_search_key_nameR'R(Rtsearch_key_name((s4/usr/lib/python2.7/dist-packages/bzrlib/inventory.pyR(Us
				cC@st|tstS|jj}|jj}|jj}|jj}d||||fkrktS||ko||kS(s-Compare two sets by comparing their contents.N(RLRRMtid_to_entrytkeytparent_id_basename_to_file_idR'R(RRStthis_keyt	other_keytthis_pid_keyt
other_pid_key((s4/usr/lib/python2.7/dist-packages/bzrlib/inventory.pyRT]scC@s*|jdk	r|j}nd}|jjd}|jdkr|jrTd}nd}d|j|||j|j|j	|fS|jdkrd|j|||jfS|jd	krd
|j|||j|j
jdfS|jdkrd|j|||j|jfStd
|jdS(sSerialise entry as a single bytestring.

        :param Entry: An inventory entry.
        :return: A bytestring for the entry.

        The BNF:
        ENTRY ::= FILE | DIR | SYMLINK | TREE
        FILE ::= "file: " COMMON SEP SHA SEP SIZE SEP EXECUTABLE
        DIR ::= "dir: " COMMON
        SYMLINK ::= "symlink: " COMMON SEP TARGET_UTF8
        TREE ::= "tree: " COMMON REFERENCE_REVISION
        COMMON ::= FILE_ID SEP PARENT_ID SEP NAME_UTF8 SEP REVISION
        SEP ::= "
"
        Retutf8R,tYtNsfile: %s
%s
%s
%s
%s
%d
%sR-sdir: %s
%s
%s
%sR.ssymlink: %s
%s
%s
%s
%sstree-referencestree: %s
%s
%s
%s
%ssunknown kind %rN(
RR'R
tencodeR*RR
RRORPRNRRRV(RRt
parent_strtname_strtexec_str((s4/usr/lib/python2.7/dist-packages/bzrlib/inventory.pyt_entry_to_bytesjs.		c
C@s;t}t}i}xk|j|D]Z}|jdkrP|j|jn|j|j|j|jtj|jq(W|j|}|jd|j	dx{|r,t}xI|j|D]8}|j|j|j|jtj|jqW|j|}|j
|qW|j
||j	dx|r0g|D]}t|j^qW}	t}|j
j|	}
tg|
D]}|d^q}|j|}|j
|x[|j|D]J}|jdkr|j|jn|j|jtj|jqWqJW||fS(sGive a more wholistic view starting with the given file_ids.

        For any file_id which maps to a directory, we will include all children
        of that directory. We will also include all directories which are
        parents of the given file_ids, but we will not include their children.

        eg:
          /     # TREE_ROOT
          foo/  # foo-id
            baz # baz-id
            frob/ # frob-id
              fringle # fringle-id
          bar/  # bar-id
            bing # bing-id

        if given [foo-id] we will include
            TREE_ROOT as interesting parents
        and 
            foo-id, baz-id, frob-id, fringle-id
        As interesting ids.
        R-iN(Rt	_getitemsR*RR
Rt
setdefaultt
differenceR'tdiscardRRtinternR R(
Rtfile_idstinterestingRtchildren_of_parent_idRtremaining_parentstnext_parentsRtkeysR1titemt
next_file_ids((s4/usr/lib/python2.7/dist-packages/bzrlib/inventory.pyt'_expand_fileids_to_parents_and_childrensF		

		

	%	#
c	C@s|j|\}}t|j}|jj|j_|j|_|sP|rT|S|j}tj||j}xk|r|j	}||}|j
dkr|j}n|j|||krv|j
||qvqvW|S(sGet an inventory view filtered against a set of file-ids.

        Children of directories and parents are included.

        The result may or may not reference the underlying inventory
        so it should be treated as immutable.
        R-(R:RRRRRRRRRR*R=RR(	RRR3tparent_to_childrenRStcachetremaining_childrenR
R!((s4/usr/lib/python2.7/dist-packages/bzrlib/inventory.pyRs$			

cC@sI|jd}|djd\}}|dt|t|dfS(s.Get the file_id, revision_id key out of bytes.s
is: ii(tsplitR1(tbytestsectionsR*R
((s4/usr/lib/python2.7/dist-packages/bzrlib/inventory.pyt_bytes_to_utf8name_keyscC@s|jd}|djdrt|dd|djd|d}|d|_t|d	|_|dd
k|_n|djdrt|dd	|djd|d|}n|djdrt	|dd
|djd|d}|djd|_
n^|djdrlt|dd|djd|d}|d|_nt
d|t|j|_t|d|_|jdkrd|_n||j|j<|S(sDeserialise a serialised entry.s
isfile: iiR%iiiR&sdir: s	symlink: i	stree: sNot a serialised entry %riReN(R>t
startswithRltdecodeROtintRPRtCHKInventoryDirectoryRvRNRRRRVR1R
RRR'R(RR?R@tresult((s4/usr/lib/python2.7/dist-packages/bzrlib/inventory.pyt_bytes_to_entrys:



cC@stj}t|j}|r9t|jj|_ntjj	|j}|j
j|j
jj
}||_tj|j
j|j
jd||_
|j
j|j
jj|i}|jdk	rMtj|jj|jjd||_|jj|jj|jj}	|jj}
|	j|
j
|
j|	_n	d|_|j|_g}t|}t|}t|}t|}t|}t|}t}t}
t}x#|D]\}}}}|dkr||_n|dkrOd}d}|r?y|j|=Wq?tk
r;q?Xn|
j|nHt |}|j!|}||j|<|j||d|j"f|dkrd}nSt |}|j#||krt$j%||d|j#|n|j||j&t ||||jdk	r|dkr<d}n||}|j'|}|dkrpd}d}n|j'|}|}||kr|dk	r||j(|ddgd<n|dk	r||j(|ddgd<qqqqWx}|
D]u}||}|j)dkrqnxM|j*j+D]<}|j,|kr-t$j%|j#|j,|j,dq-q-WqW|j
j-||rg}x[|jD]M\}\}}|dk	r|j&|||fq|j&|ddfqW|jj-|n|j.d
x|D]\}}y8||j)dkrUt$j%|j#||dnWn)t$j/k
rt$j%d	|d
nX|j0||krt$j%||d|j0|qqW|S(sCreate a new CHKInventory by applying inventory_delta to this one.

        See the inventory developers documentation for the theory behind
        inventory deltas.

        :param inventory_delta: The inventory delta to apply. See
            Inventory.apply_delta for details.
        :param new_revision_id: The revision id of the resulting CHKInventory.
        :param propagate_caches: If True, the caches for this inventory are
          copied to and updated for the result.
        :return: The new CHKInventory.
        tsearch_key_funcReis!Entry was at wrong other path %r.iR-s4Child not deleted or reparented when parent deleted.s#Not a directory, but given childrens	<unknown>s-Parent is not present in resulting inventory.sParent has wrong path %r.N(ReN(1RR>RRtdictRRtchk_maptsearch_key_registryRRt_ensure_roott
_root_nodetmaximum_sizeRtCHKMapt_storeRtset_maximum_sizeR R't
_key_widthRRRRRRRRRRRR,RRR%RR;t_parent_id_basename_keyR.R*R0R
R
RR0RR(RRRRR>RFRHRNtparent_id_basename_deltatresult_p_id_roott	p_id_roottid_to_entry_deltaRRtalteredRRR
Rtnew_keyt	new_valuetold_keyRRt
delta_listRtvalueRR((s4/usr/lib/python2.7/dist-packages/bzrlib/inventory.pyR-s	
		
	

					

 	
	
	)



cC@sf|jd}|ddkr.tdn|j|ddkr[td|ni}tdd	d
ddg}x|d
D]x}|jdd
\}}	||krtjd||fn||krtjd||fn|	||<qWt|d	}
t|d}t|jd
d}t|jdd}
|
j
dsxtd|
fn|d}|j
dstd|fnt|}|
|_||_
tjj|j}|
dk	r
tj|t|
d||_n	d|_tj|t|d||_|jf|krbtd|j|fn|S(sDeserialise a CHKInventory.

        :param chk_store: A CHK capable VersionedFiles instance.
        :param bytes: The serialised bytes.
        :param expected_revision_id: The revision ID we think this inventory is
            for.
        :return: A CHKInventory
        s
iRes)bytes to deserialize must end with an eolis
chkinventory:s!not a serialised CHKInventory: %rRRRR Ris: sUnknown key in inventory: %r
%rs!Duplicate key in inventory: %r
%rtplainssha1:s9parent_id_basename_to_file_id should be a sha1 key not %rs'id_to_entry should be a sha1 key not %rRHs+Mismatched revision id and expected: %r, %rN(R>tAssertionErrorRRVt	frozensetR%R)R1RR'RBRRRRJRKRRORR R(tklasst	chk_storeR?texpected_revision_idtlinestinfotallowed_keystlineRR]RRRR RRFRH((s4/usr/lib/python2.7/dist-packages/bzrlib/inventory.pytdeserialises`

			
					iR^cC@s||}|j|_|jj|_|j}|j}i}i}	xX|jD]J\}
}t|jj}||||<||}
|j|	|
<qRW|j	|||	d||S(sCreate a CHKInventory from an existing inventory.

        The content of inventory is copied into the chk_store, and a
        CHKInventory referencing that is returned.

        :param chk_store: A CHK capable VersionedFiles instance.
        :param inventory: The inventory to copy.
        :param maximum_size: The CHKMap node size limit.
        :param search_key_name: The identifier for the search key function
        RN(
RRR
RR,RSRRR1t_populate_from_dicts(RaRbt	inventoryRNRRFtentry_to_bytestparent_id_basename_keytid_to_entry_dicttparent_id_basename_dictR[RRtp_id_key((s4/usr/lib/python2.7/dist-packages/bzrlib/inventory.pytfrom_inventorys		
c	C@stjj|j}tjj||d|ddd|}tj||||_tjj||d|ddd|}tj||||_dS(NRNt	key_widthiRHi(RJRKRRROt	from_dictRR (RRbRmRnRNRHtroot_key((s4/usr/lib/python2.7/dist-packages/bzrlib/inventory.pyRi2s			cC@s@|jdk	r|j}nd}t||jjdjS(sBCreate a key for a entry in a parent_id_basename_to_file_id index.ReR%N(RR'RR
R(R1(RRR((s4/usr/lib/python2.7/dist-packages/bzrlib/inventory.pyRSAscC@s|dkr!tj||n|jj|d}|dk	rF|Sy0|j|jjt|gj	dSWn#t
k
rtj||nXdS(s'map a single file_id -> InventoryEntry.iN(R'R%RRRRGRRRRt
StopIteration(RR
RF((s4/usr/lib/python2.7/dist-packages/bzrlib/inventory.pyRIs*
c
C@sg}g}xL|D]D}|jj|d}|dkrJ|j|q|j|qWg|D]}t|j^qb}xL|jj|D]8\}}	|j|	}|j|||j|j	<qW|S(sSimilar to __getitem__, but lets you query for multiple.
        
        The returned order is undefined. And currently if an item doesn't
        exist, it isn't included in the output.
        N(
RRR'R;RR1RRRGR
(
RR2RFt	remainingR
RRt	file_keystfile_keyR]((s4/usr/lib/python2.7/dist-packages/bzrlib/inventory.pyR-Ws
%
cC@sJ|jj|ddk	rtStt|jjt|gdkS(Ni(	RRR'RBRRRRR(RR
((s4/usr/lib/python2.7/dist-packages/bzrlib/inventory.pyRlscC@s
||jkS(N(R(RR
((s4/usr/lib/python2.7/dist-packages/bzrlib/inventory.pyRsscc@s_xX|dk	rZy||}Wn)tk
rHtjd|d|nX|V|j}qWdS(s,Yield the parents of file_id up to the root.RR
N(R'RR%RR(RR
R!((s4/usr/lib/python2.7/dist-packages/bzrlib/inventory.pyRvs
cc@s-x&|jjD]\}}|dVqWdS(sIterate over all file-ids.iN(RR(RRR((s4/usr/lib/python2.7/dist-packages/bzrlib/inventory.pyRscc@ssxl|jjD][\}}|d}|jj|d}|dkrf|j|}||j|<n|VqWdS(sIterate over all entries.

        Unlike iter_entries(), just the entries are returned (not (path, ie))
        and the order of entries is undefined.

        XXX: We may not want to merge this into bzr.dev.
        iN(RRRRR'RG(RRRR
R!((s4/usr/lib/python2.7/dist-packages/bzrlib/inventory.pyRs
cC@s|jr
dS|j}xY|jjD]H\}}|d}||krd|j|}|||<q&||}q&Wd}}|jj}xZ|D]R\}}	|d
kr|	|jkrtd|	|jfqqn|\}
}||	}|
|kr|}n
||
}|j	dkr;td|
|j	fn|j
dkrVi|_
n|jd}||j
kr|j
|}
|
|krtd||
fqn||jkrtd	|	||jfn||j
|<qWt
|_dS(s4Make sure all file-ids are in _fileid_to_entry_cacheNiResaData inconsistency detected. We expected data with key ("","") to match the root id, but %s != %sR-sData inconsistency detected. An entry in the parent_id_basename_to_file_id map has parent_id {%s} but the kind of that object is %r not "directory"sutf-8s]Data inconsistency detected. Two entries with basename %r were found in the parent entry {%s}sData inconsistency detected. In the parent_id_basename_to_file_id map, file_id {%s} is listed as having basename %r, but in the id_to_entry map it is %r(ReRe(RRRRRGR'R RRVR*t	_childrenRCR
RB(RR<RRR
R!tlast_parent_idtlast_parent_iet	pid_itemst
child_file_idRtbasenamet	parent_ietexisting_ie((s4/usr/lib/python2.7/dist-packages/bzrlib/inventory.pyRsL		



	

c	c@sx|jj|jD]\}}}|d}|dk	rw|j|}|j|}|j}|j}	|j}
nd}d}d}	d}
|dk	r|j|}|j|}|j}
|j}|j}nd}d}
d}d}|dkrd|jf}t	t
f}nH|dkrC|jdf}t
t	f}n|j|jf}t
t
f}t	}|d|dkrt
}n|ddkr|j|jks|j|jkr t
}q n\|ddkr|j
|j
kr t
}q n.|ddkr |j|jkr t
}q n||
f}|	|f}|
|f}|r|d|dkr|d|dkr|d|dkrqn|||f||||||fVqWdS(sGenerate a Tree.iter_changes change list between this and basis.

        :param basis: Another CHKInventory.
        :return: An iterator over the changes between self and basis, as per
            tree.iter_changes().
        iiR,R.stree-referenceN(Rtiter_changesR'RGRRR
RR*RRBRPRORNRR(RtbasisRtbasis_valuet
self_valueR
tbasis_entrytpath_in_sourcetbasis_parentt
basis_nametbasis_executablet
self_entrytpath_in_targettself_parentt	self_nametself_executableR*t	versionedtchanged_contentRR
R((s4/usr/lib/python2.7/dist-packages/bzrlib/inventory.pyRsn
"
					cC@s
t|jS(s.Return the number of entries in the inventory.(RR(R((s4/usr/lib/python2.7/dist-packages/bzrlib/inventory.pyRsc
C@st|tkr"tj||Sg}x|jj|jD]\}}}|d}|dk	ru|j|}nd}|dk	r|j|}||j	|<|j|}	nd}d}	|j
||	||fq>W|S(s-Make an inventory delta from two inventories.iN(ttypeRRRRRR'RRGRR;(
RRRRt	old_valueRR
RRR((s4/usr/lib/python2.7/dist-packages/bzrlib/inventory.pyRs""

cC@st|tr!tj|}n-|}|gkr?dg}ntj|}|jj|d}|dk	rs|S|j}|dkrdS|j	}d}x|D]}|dkr|}n|d|}|j
d}|jj|d}	|	dkrt||g}
|j|
}xT|D]L\\}}
}	||ksM|
|kr#t
jd|||
|fq#q#W|	dkrdS|	|j|<n|	}qW|S(sSee CommonInventory.path2id().ReR$R%s%corrupt inventory lookup! %r %r %r %rN(RLRRRRRRR'RR R(RRR%R)(RRRRFt
current_idtparent_id_indextcur_pathR}t
basename_utf8R
t
key_filterR1Rt	name_utf8((s4/usr/lib/python2.7/dist-packages/bzrlib/inventory.pyR-sB		
			
cC@sdg}|jdkr|jd|jf|jd|j|jd|jjdf|jd|j|jd|jjdfn||jd|j|jd|j|jd	k	r|jd|jjdfn|jd|jjdf|S(
s!Serialise the inventory to lines.schkinventory:
R^ssearch_key_name: %s
sroot_id: %s
s"parent_id_basename_to_file_id: %s
isrevision_id: %s
sid_to_entry: %s
N(RR;RR RRRR'(RRd((s4/usr/lib/python2.7/dist-packages/bzrlib/inventory.pytto_linesUs		$	!cC@s||jS(sGet the root entry.(R(R((s4/usr/lib/python2.7/dist-packages/bzrlib/inventory.pyRis(!RJR_R`R(RTR,R:RRcRARGRRtclassmethodRhRpRiRSRR-RRRRRRRRRRRtpropertyR(((s4/usr/lib/python2.7/dist-packages/bzrlib/inventory.pyR@s8		
	*	H	'		">							
			5	I			(	REcB@s2eZdZddgZdZedZRS(sA directory in an inventory.Rxt_chk_inventorycC@s,tj||||d|_||_dS(N(RR(R'RxR(RR
R
Rt
chk_inventory((s4/usr/lib/python2.7/dist-packages/bzrlib/inventory.pyR(ts	cC@sr|jdk	r|jS|jjdkr7tdni}|jj}t}xE|jdt|jgD]%\\}}}|j	t|qqWt}xS|D]K}|jj
j|dd}	|	dk	r|	||	j<|j	|qqW|j
||jj}
xP|
j|D]?\}}|jj|}	|	||	j<|	|jj
|d<q"W||_|S(sAccess the list of children of this directory.

        With a parent_id_basename_to_file_id index, loads all the children,
        without loads the entire index. Without is bad. A more sophisticated
        proxy object might be nice, to allow partial loading of children as
        well when specific names are accessed. (So path traversal can be
        written in the obvious way but not examine siblings.).
        sIInventories without parent_id_basename_to_file_id are no longer supportedRiN(RxR'RR R_RRRR
RRRR
tdifference_updateRRG(RRFRt
child_keysRRR
tcachedtfile_id_keyRRR?((s4/usr/lib/python2.7/dist-packages/bzrlib/inventory.pyR0{s2
	%	



	(RJR_R`RaR(RR0(((s4/usr/lib/python2.7/dist-packages/bzrlib/inventory.pyREos	R-R,R.stree-referencecC@sn|dkrtj|}nt|}yt|}Wn#tk
r]tj||nX||||S(sCreate an inventory entry.

    :param kind: the type of inventory entry to create.
    :param name: the basename of the entry.
    :param parent_id: the parent_id of the entry.
    :param file_id: the file_id to use. if None, one will be created.
    N(R'Rtgen_file_idR
t
entry_factoryRR%tBadFileKindError(R*R
RR
tfactory((s4/usr/lib/python2.7/dist-packages/bzrlib/inventory.pyRs
cC@sAtj|\}}||kr=|r+|Stj|n|S(sNormalize name.

    :raises InvalidNormalization: When name is not normalized, and cannot be
        accessed on this platform by the normalized path.
    :return: The NFC normalised version of name.
    (Rtnormalized_filenameR%tInvalidNormalization(R
t	norm_namet
can_access((s4/usr/lib/python2.7/dist-packages/bzrlib/inventory.pyR
ss	^[^/\\]+$cC@sttj|S(N(Rt_NAME_REtmatch(R
((s4/usr/lib/python2.7/dist-packages/bzrlib/inventory.pyRscc@st}xp|D]h}t|d}|j|dt||krstj|dp`|d|ddn|VqWdS(siDecorate a delta and check that the file ids in it are unique.

    :return: A generator over delta.
    iiisrepeated file_idN(RRRR%R(RtidsR8tlength((s4/usr/lib/python2.7/dist-packages/bzrlib/inventory.pyRs	
cc@st}xw|D]o}t|d}|d}|dk	rz|j|t||krztj||ddqzn|VqWdS(sjDecorate a delta and check that the new paths in it are unique.

    :return: A generator over delta.
    iis
repeated pathN(RRR'RR%R(RtpathsR8RR[((s4/usr/lib/python2.7/dist-packages/bzrlib/inventory.pyRs	


cc@st}xw|D]o}t|d}|d}|dk	rz|j|t||krztj||ddqzn|VqWdS(sjDecorate a delta and check that the old paths in it are unique.

    :return: A generator over delta.
    iiis
repeated pathN(RRR'RR%R(RRR8RR[((s4/usr/lib/python2.7/dist-packages/bzrlib/inventory.pyRs	


cc@sx|D]}|d}|ddkrUtj|dp>|d|dd|nt|dtkrtj|dp|d|dd|n|VqWdS(scDecorate a delta and check that the ids in it are valid.

    :return: A generator over delta.
    iiiisentry with file_id None %rsentry with non bytes file_id %rN(R'R%RRtstr(RR8R((s4/usr/lib/python2.7/dist-packages/bzrlib/inventory.pyR	s

cc@stxm|D]e}|d}|dk	rg|j|dkrgtj|dpM|d|dd|qgn|VqWdS(sqDecorate a delta and check that the ids in it match the entry.file_id.

    :return: A generator over delta.
    iiiismismatched id with %rN(R'R
R%R(RR8R((s4/usr/lib/python2.7/dist-packages/bzrlib/inventory.pyR	s

cc@sx|D]}|d}|d}|dkrY|dk	rYtj|d|ddn|dk	r|dkrtj||ddn|VqWdS(smDecorate a delta and check that the new_path and entry are paired.

    :return: A generator over delta.
    iiisEntry with no new_pathsnew_path with no entryN(R'R%R(RR8RR((s4/usr/lib/python2.7/dist-packages/bzrlib/inventory.pyR&	s


cC@sO|j}td|j}x'|D]\}}|j|jq(W|S(sCreate a new inventory that has the same contents as a specified tree.

    :param tree: Revision tree to create inventory from
    N(RRR'tget_revision_idRR=(RRR R[t	inv_entry((s4/usr/lib/python2.7/dist-packages/bzrlib/inventory.pytmutable_inventory_from_tree7	s
N(&t
__future__RRtbzrlib.lazy_importRtglobalstbzrlibRRtbzrlib.static_tupleRtbzrlib.symbol_versioningRRtobjectRRdRlRvRRRRRERR'RR
tlazy_compileRRRRRRRRR(((s4/usr/lib/python2.7/dist-packages/bzrlib/inventory.pyt<module>sL	@$cK!*25
								

Copyright © 2017 || Recoded By Mr.Bumblebee