-=[ Mr. Bumblebee ]=-
_Indonesia_

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


zyOc@@sdZddlmZddlZddlmZeedddlmZddl	m
Z
ddlmZm
Z
d	efd
YZdefdYZed
ZdZdZde
fdYZejedefdYZdS(s7Tree classes, representing directory at point in time.
i(tabsolute_importN(tlazy_imports
import collections

from bzrlib import (
    conflicts as _mod_conflicts,
    debug,
    delta,
    errors,
    filters,
    inventory,
    osutils,
    revision as _mod_revision,
    rules,
    trace,
    )
from bzrlib.i18n import gettext
(tneeds_read_lock(tInterObject(t
deprecated_intdeprecated_methodtTreecB@seZdZdZed=d=eeedZed=d=d=eedZdZ	dZ
dZdZdZ
eed>dZd
ZdZdZdZd=edZd=dZed=edZdZdZdZdZd=dZdZdZd=dZd=dZ d=dZ!d=dZ"d=d=dZ#d=d=d Z$d=d!Z%d"Z&d=d#Z'd$Z(d=d%Z)d&Z*e+j,d'Z-d(Z.d=d)Z/d=d*Z0d+Z1d,Z2d-Z3d.Z4ged/Z5d0Z6d1Z7d2Z8d3Z9d4Z:d5Z;d6d7Z<d8Z=d=d=d9Z>d:Z?d=d=d;Z@d<ZARS(?s+Abstract file tree.

    There are several subclasses:

    * `WorkingTree` exists as files on disk editable by the user.

    * `RevisionTree` is a tree as recorded at some point in the past.

    Trees can be compared, etc, regardless of whether they are working
    trees or versioned trees.
    cC@stS(sWhether this tree can contain explicitly versioned directories.

        This defaults to True, but some implementations may want to override
        it.
        (tTrue(tself((s//usr/lib/python2.7/dist-packages/bzrlib/tree.pythas_versioned_directories@sc
C@s:tj||jd|d|d|d|d|d|S(sReturn a TreeDelta of the changes from other to this tree.

        :param other: A tree to compare with.
        :param specific_files: An optional list of file paths to restrict the
            comparison to. When mapping filenames to ids, all matches in all
            trees (including optional extra_trees) are used, and all children of
            matched directories are included.
        :param want_unchanged: An optional boolean requesting the inclusion of
            unchanged entries in the result.
        :param extra_trees: An optional list of additional trees to use when
            mapping the contents of specific_files (paths) to file_ids.
        :param require_versioned: An optional boolean (defaults to False). When
            supplied and True all the 'specific_files' must be versioned, or
            a PathsNotVersionedError will be thrown.
        :param want_unversioned: Scan for unversioned paths.

        The comparison will be performed by an InterTree object looked up on
        self and other.
        twant_unchangedtspecific_filestextra_treestrequire_versionedtinclude_roottwant_unversioned(t	InterTreetgettcompare(RtotherR
RRR
RR((s//usr/lib/python2.7/dist-packages/bzrlib/tree.pytchanges_fromHsc	C@s1tj||}|j|||||d|S(sSee InterTree.iter_changesR(RRtiter_changes(	Rt	from_treetinclude_unchangedRtpbRR
Rt	intertree((s//usr/lib/python2.7/dist-packages/bzrlib/tree.pyRjscC@s
tjS(suGet a list of the conflicts in the tree.

        Each conflict is an instance of bzrlib.conflicts.Conflict.
        (t_mod_conflictstConflictList(R((s//usr/lib/python2.7/dist-packages/bzrlib/tree.pyt	conflictsrscC@sgS(sAFor trees that can have unversioned files, return all such paths.((R((s//usr/lib/python2.7/dist-packages/bzrlib/tree.pytextrasyscC@st|jdS(sGet the parent ids for this tree.

        :return: a list of parent ids. [] is returned to indicate
        a tree with no parents.
        :raises: BzrError if the parents are not known.
        N(tNotImplementedErrortget_parent_ids(R((s//usr/lib/python2.7/dist-packages/bzrlib/tree.pyR}scC@st|jdS(s$True if the tree has given filename.N(Rthas_filename(Rtfilename((s//usr/lib/python2.7/dist-packages/bzrlib/tree.pyR scC@st|jdS(N(Rthas_id(Rtfile_id((s//usr/lib/python2.7/dist-packages/bzrlib/tree.pyR"siiicC@s
|j|S(N(R"(RR#((s//usr/lib/python2.7/dist-packages/bzrlib/tree.pyt__contains__scC@st|jdS(N(Rt
has_or_had_id(RR#((s//usr/lib/python2.7/dist-packages/bzrlib/tree.pyR%scC@stS(sCheck whether the filename is ignored by this tree.

        :param filename: The relative filename within the tree.
        :return: True if the filename is ignored.
        (tFalse(RR!((s//usr/lib/python2.7/dist-packages/bzrlib/tree.pyt
is_ignoredscC@st|jdS(s>Iterate through all file ids, including ids for missing files.N(Rtall_file_ids(R((s//usr/lib/python2.7/dist-packages/bzrlib/tree.pyR(scC@st|jdS(sBReturn the path for a file id.

        :raises NoSuchId:
        N(Rtid2path(RR#((s//usr/lib/python2.7/dist-packages/bzrlib/tree.pyR)scC@st|jdS(sPWalk the tree in 'by_dir' order.

        This will yield each entry in the tree as a (path, entry) tuple.
        The order that they are yielded is:

        Directories are walked in a depth-first lexicographical order,
        however, whenever a directory is reached, all of its direct child
        nodes are yielded in  lexicographical order before yielding the
        grandchildren.

        For example, in the tree::

           a/
             b/
               c
             d/
               e
           f/
             g

        The yield order (ignoring root) would be::

          a, f, a/b, a/d, a/b/c, a/d/e, f/g

        :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.
        N(Rtiter_entries_by_dir(Rtspecific_file_idst
yield_parents((s//usr/lib/python2.7/dist-packages/bzrlib/tree.pyR*scC@st|jdS(s*Iterate over the children of a directory or tree reference.

        :param file_id: File id of the directory/tree-reference
        :param path: Optional path of the directory
        :raise NoSuchId: When the file_id does not exist
        :return: Iterator over entries in the directory
        N(Rtiter_child_entries(RR#tpath((s//usr/lib/python2.7/dist-packages/bzrlib/tree.pyR-scC@st|jdS(sRList all files in this tree.

        :param include_root: Whether to include the entry for the tree root
        :param from_dir: Directory under which to list files
        :param recursive: Whether to list files recursively
        :return: iterator over tuples of (path, versioned, kind, file_id,
            inventory entry)
        N(Rt
list_files(RRtfrom_dirt	recursive((s//usr/lib/python2.7/dist-packages/bzrlib/tree.pyR/s	cc@sP|jrLx=|jD],\}}|jdkr||jfVqqWndS(Nstree-reference(tsupports_tree_referenceR*tkindR#(RR.tentry((s//usr/lib/python2.7/dist-packages/bzrlib/tree.pytiter_referencesscC@std|jjdS(Ns$Tree subclass %s must implement kind(Rt	__class__t__name__(RR#((s//usr/lib/python2.7/dist-packages/bzrlib/tree.pyR3scC@s
|j|S(sFile kind stored for this file_id.

        May not match kind on disk for working trees.  Always available
        for versioned files, even when the file itself is missing.
        (R3(RR#((s//usr/lib/python2.7/dist-packages/bzrlib/tree.pytstored_kindscC@st|jdS(sGet a summary of the information about path.

        All the attributes returned are for the canonical form, not the
        convenient form (if content filters are in use.)

        :param path: A relative path within the tree.
        :return: A tuple containing kind, size, exec, sha1-or-link.
            Kind is always present (see tree.kind()).
            size is present if kind is file and the size of the 
                canonical form can be cheaply determined, None otherwise.
            exec is None unless kind is file and the platform supports the 'x'
                bit.
            sha1-or-link is the link target if kind is symlink, or the sha1 if
                it can be obtained without reading the file.
        N(Rtpath_content_summary(RR.((s//usr/lib/python2.7/dist-packages/bzrlib/tree.pyR9scC@std|jjdS(Ns6Tree subclass %s must implement get_reference_revision(RR6R7(RR#R.((s//usr/lib/python2.7/dist-packages/bzrlib/tree.pytget_reference_revisionscC@st|jdS(s@Return a tuple of kind, executable, stat_value for a file.

        entry may be None if there is no inventory entry for the file, but
        path must always be supplied.

        kind is None if there is no file present (even if an inventory id is
        present).  executable is False for non-file entries.
        N(Rt_comparison_data(RR4R.((s//usr/lib/python2.7/dist-packages/bzrlib/tree.pyR;s	cC@st|jdS(N(Rt
_file_size(RR4t
stat_value((s//usr/lib/python2.7/dist-packages/bzrlib/tree.pyR<scC@st|jdS(sReturn a file object for the file file_id in the tree.

        If both file_id and path are defined, it is implementation defined as
        to which one is used.
        N(Rtget_file(RR#R.((s//usr/lib/python2.7/dist-packages/bzrlib/tree.pyR>scC@s|j||dfS(sGet a file handle and stat object for file_id.

        The default implementation returns (self.get_file, None) for backwards
        compatibility.

        :param file_id: The file id to read.
        :param path: The path of the file, if it is known.
        :return: A tuple (file_handle, stat_value_or_None). If the tree has
            no stat facility, or need for a stat cache feedback during commit,
            it may return None for the second element of the tuple.
        N(R>tNone(RR#R.((s//usr/lib/python2.7/dist-packages/bzrlib/tree.pytget_file_with_statscC@s2|j||}z|jSWd|jXdS(s"Return the byte content of a file.

        :param file_id: The file_id of the file.
        :param path: The path of the file.

        If both file_id and path are supplied, an implementation may use
        either one.

        :returns: A single byte string for the whole file.
        N(R>treadtclose(RR#R.tmy_file((s//usr/lib/python2.7/dist-packages/bzrlib/tree.pyt
get_file_text(scC@stj|j||S(sReturn the content of a file, as lines.

        :param file_id: The file_id of the file.
        :param path: The path of the file.

        If both file_id and path are supplied, an implementation may use
        either one.
        (tosutilstsplit_linesRD(RR#R.((s//usr/lib/python2.7/dist-packages/bzrlib/tree.pytget_file_lines9s	cC@sd|j|d|d|fS(svReturn a verifier for a file.

        The default implementation returns a sha1.

        :param file_id: The handle for this file.
        :param path: The path that this file can be found at.
            These must point to the same object.
        :param stat_value: Optional stat value for the object
        :return: Tuple with verifier name and verifier data
        tSHA1R.R=(t
get_file_sha1(RR#R.R=((s//usr/lib/python2.7/dist-packages/bzrlib/tree.pytget_file_verifierDscC@st|jdS(sReturn the SHA1 file for a file.

        :note: callers should use get_file_verifier instead
            where possible, as the underlying repository implementation may
            have quicker access to a non-sha1 verifier.

        :param file_id: The handle for this file.
        :param path: The path that this file can be found at.
            These must point to the same object.
        :param stat_value: Optional stat value for the object
        N(RRI(RR#R.R=((s//usr/lib/python2.7/dist-packages/bzrlib/tree.pyRIRscC@st|jdS(sReturn the modification time for a file.

        :param file_id: The handle for this file.
        :param path: The path that this file can be found at.
            These must point to the same object.
        N(Rtget_file_mtime(RR#R.((s//usr/lib/python2.7/dist-packages/bzrlib/tree.pyRK`scC@st|jdS(sReturn the size of a file in bytes.

        This applies only to regular files.  If invoked on directories or
        symlinks, it will return None.
        :param file_id: The file-id of the file
        N(Rt
get_file_size(RR#((s//usr/lib/python2.7/dist-packages/bzrlib/tree.pyRLiscC@st|jdS(sCheck if a file is executable.

        :param file_id: The handle for this file.
        :param path: The path that this file can be found at.
            These must point to the same object.
        N(Rt
is_executable(RR#R.((s//usr/lib/python2.7/dist-packages/bzrlib/tree.pyRMrscc@s8x1|D])\}}|j|f}||fVqWdS(sIterate through file contents.

        Files will not necessarily be returned in the order they occur in
        desired_files.  No specific order is guaranteed.

        Yields pairs of identifier, bytes_iterator.  identifier is an opaque
        value supplied by the caller as part of desired_files.  It should
        uniquely identify the file version in the caller's context.  (Examples:
        an index number or a TreeTransform trans_id.)

        bytes_iterator is an iterable of bytestrings for the file.  The
        kind of iterable and length of the bytestrings are unspecified, but for
        this implementation, it is a tuple containing a single bytestring with
        the complete text of the file.

        :param desired_files: a list of (file_id, identifier) pairs
        N(RD(Rt
desired_filesR#t
identifiertcur_file((s//usr/lib/python2.7/dist-packages/bzrlib/tree.pytiter_files_bytes{scC@st|jdS(sGet the target for a given file_id.

        It is assumed that the caller already knows that file_id is referencing
        a symlink.
        :param file_id: Handle for the symlink entry.
        :param path: The path of the file.
        If both file_id and path are supplied, an implementation may use
        either one.
        :return: The path the symlink points to.
        N(Rtget_symlink_target(RR#R.((s//usr/lib/python2.7/dist-packages/bzrlib/tree.pyRRscC@st|jdS(s-Return the file_id for the root of this tree.N(Rtget_root_id(R((s//usr/lib/python2.7/dist-packages/bzrlib/tree.pyRSscC@st|jdS(sReturn an iterator of revision_id, line tuples.

        For working trees (and mutable trees in general), the special
        revision_id 'current:' will be used for lines that are new in this
        tree, e.g. uncommitted changes.
        :param file_id: The file to produce an annotated version from
        :param default_revision: For lines that don't match a basis, mark them
            with this revision id. Not all implementations will make use of
            this value.
        N(Rt
annotate_iter(RR#tdefault_revision((s//usr/lib/python2.7/dist-packages/bzrlib/tree.pyRTsc	C@sddlm}|j|}|j||d}|j||d}|dkr^d}n|j||d}||||fS(Ni(t
versionedfilesthis:sother:sbase:(tbzrlibRVt_PlanMergeVersionedFilet_get_file_revisionR?(	RR#RtbaseRVtvftlast_revision_atlast_revision_btlast_revision_base((s//usr/lib/python2.7/dist-packages/bzrlib/tree.pyt_get_plan_merge_datas	c	C@s:|j|||}|\}}}}|j|||S(s;Generate a merge plan based on annotations.

        If the file contains uncommitted changes in this tree, they will be
        attributed to the 'current:' pseudo-revision.  If the file contains
        uncommitted changes in the other tree, they will be assigned to the
        'other:' pseudo-revision.
        (R_t
plan_merge(	RR#RRZtdataR[R\R]R^((s//usr/lib/python2.7/dist-packages/bzrlib/tree.pytplan_file_mergesc	C@s:|j|||}|\}}}}|j|||S(s8Generate a merge plan based lca-newness.

        If the file contains uncommitted changes in this tree, they will be
        attributed to the 'current:' pseudo-revision.  If the file contains
        uncommitted changes in the other tree, they will be assigned to the
        'other:' pseudo-revision.
        (R_tplan_lca_merge(	RR#RRZRaR[R\R]R^((s//usr/lib/python2.7/dist-packages/bzrlib/tree.pytplan_file_lca_mergescc@sUxN|jD]@}y|j|VWq
tjk
rL|jj|Vq
Xq
WdS(s?Iterate through parent trees, defaulting to Tree.revision_tree.N(Rt
revision_treeterrorstNoSuchRevisionInTreet
repository(Rtrevision_id((s//usr/lib/python2.7/dist-packages/bzrlib/tree.pyt_iter_parent_treess
c	C@st|dddkr|}g|jD]}||j|f^q+}|j||f||j||jj}|j}n|j|}|j	j}||j
kr|j
j|n|S(s>Ensure that file_id, tree_revision is in vf to plan the merge.t_repositoryN(tgetattrR?Rjtget_file_revisiont	add_linesRGtbranchRhttextsRktfallback_versionedfilestappend(	RR#R[t
tree_revisiont
last_revisiontttparent_keystrepotbase_vf((s//usr/lib/python2.7/dist-packages/bzrlib/tree.pyRYs+cC@sts
dStj|}|jd|jdk	r|j|dkrtjd|j|j	fd|jd|ddgqn|j
|dkrtjd|j|j	fd	|j
d
|ddgndS(Nitsizes!mismatched size for file %r in %rsinventory expects %d bytessfile is actually %d bytess!store is probably damaged/corrupttsha1swrong SHA-1 for file %r in %rsinventory expects %ssfile is actually %s(t	__debug__REtfingerprint_filetseekt	text_sizeR?RftBzrErrorR#t_storet	text_sha1(Rtietftfp((s//usr/lib/python2.7/dist-packages/bzrlib/tree.pyt_check_retrieveds$

	
cC@st|jdS(s$Return the id for path in this tree.N(Rtpath2id(RR.((s//usr/lib/python2.7/dist-packages/bzrlib/tree.pyR	scC@st||gt||S(sReturn all the ids that can be reached by walking from paths.

        Each path is looked up in this tree and any extras provided in
        trees, and this is repeated recursively: the children in an extra tree
        of a directory that has been renamed under a provided path in this tree
        are all returned, even if none exist under a provided path in this
        tree, and vice versa.

        :param paths: An iterable of paths to start converting to ids from.
            Alternatively, if paths is None, no ids should be calculated and None
            will be returned. This is offered to make calling the api unconditional
            for code that *might* take a list of files.
        :param trees: Additional trees to consider.
        :param require_versioned: If False, do not raise NotVersionedError if
            an element of paths is not versioned in this tree and all of trees.
        (tfind_ids_across_treestlist(RtpathsttreesR
((s//usr/lib/python2.7/dist-packages/bzrlib/tree.pyt	paths2ids
scC@st|jdS(sIterate over the file ids of the children of an entry.

        :param file_id: File id of the entry
        :return: Iterator over child file ids.
        N(Rt
iter_children(RR#((s//usr/lib/python2.7/dist-packages/bzrlib/tree.pyR scC@sdS(smLock this tree for multiple read only operations.

        :return: A bzrlib.lock.LogicalLockResult.
        N((R((s//usr/lib/python2.7/dist-packages/bzrlib/tree.pyt	lock_read(scC@stj||dS(sEObtain a revision tree for the revision revision_id.

        The intention of this method is to allow access to possibly cached
        tree data. Implementors of this method should raise NoSuchRevision if
        the tree is not locally available, even if they could obtain the
        tree via a repository or some other means. Callers are responsible
        for finding the ultimate source for a revision tree.

        :param revision_id: The revision_id of the requested tree.
        :return: A Tree.
        :raises: NoSuchRevision if the tree cannot be obtained.
        N(RfRg(RRi((s//usr/lib/python2.7/dist-packages/bzrlib/tree.pyRe/s
cC@s
tgS(soWhat files are present in this tree and unknown.

        :return: an iterator over the unknown files.
        (titer(R((s//usr/lib/python2.7/dist-packages/bzrlib/tree.pytunknowns>scC@sdS(N((R((s//usr/lib/python2.7/dist-packages/bzrlib/tree.pytunlockEscC@st|jdS(sMFilter out paths that are versioned.

        :return: set of paths.
        N(Rtfilter_unversioned_files(RR((s//usr/lib/python2.7/dist-packages/bzrlib/tree.pyRHstcC@st|jdS(sWalk the contents of this tree from path down.

        This yields all the data about the contents of a directory at a time.
        After each directory has been yielded, if the caller has mutated the
        list to exclude some directories, they are then not descended into.

        The data yielded is of the form:
        ((directory-relpath, directory-path-from-root, directory-fileid),
        [(relpath, basename, kind, lstat, path_from_tree_root, file_id,
          versioned_kind), ...]),
         - directory-relpath is the containing dirs relpath from prefix
         - directory-path-from-root is the containing dirs path from /
         - directory-fileid is the id of the directory if it is versioned.
         - relpath is the relative path within the subtree being walked.
         - basename is the basename
         - kind is the kind of the file now. If unknonwn then the file is not
           present within the tree - but it may be recorded as versioned. See
           versioned_kind.
         - lstat is the stat data *if* the file was statted.
         - path_from_tree_root is the path from the root of the tree.
         - file_id is the file_id if the entry is versioned.
         - versioned_kind is the kind of the file as last recorded in the
           versioning system. If 'unknown' the file is not versioned.
        One of 'kind' and 'versioned_kind' must not be 'unknown'.

        :param prefix: Start walking from prefix within the tree rather than
        at the root. This allows one to walk a subtree but get paths that are
        relative to a tree rooted higher up.
        :return: an iterator over the directory data.
        N(Rtwalkdirs(Rtprefix((s//usr/lib/python2.7/dist-packages/bzrlib/tree.pyROscC@stS(N(R&(R((s//usr/lib/python2.7/dist-packages/bzrlib/tree.pytsupports_content_filteringpscC@stj}t|dkr"gS|dkr@|j|}n|j|g|j}tj|}dtj	krt
jtdj
|||n|S(sThe stack of content filters for a path if filtering is supported.

        Readers will be applied in first-to-last order.
        Writers will be applied in last-to-first order.
        Either the path or the file-id needs to be provided.

        :param path: path relative to the root of the tree
            or None if unknown
        :param file_id: file_id or None if unknown
        :return: the list of filters - [] if there are none
        itfilterss$*** {0} content-filter: {1} => {2!r}N(Rt_get_registered_namestlenR?R)titer_search_rulestnextt_get_filter_stack_fortdebugtdebug_flagsttracetnotetgettexttformat(RR.R#tfilter_pref_namestprefststk((s//usr/lib/python2.7/dist-packages/bzrlib/tree.pyt_content_filter_stackss%c@s!jrfdSdSdS(sA function that returns a stack of ContentFilters.

        The function takes a path (relative to the top of the tree) and a
        file-id as parameters.

        :return: None if content filtering is not supported by this tree.
        c@sj||S(N(R(R.R#(R(s//usr/lib/python2.7/dist-packages/bzrlib/tree.pyt<lambda>sN(RR?(R((Rs//usr/lib/python2.7/dist-packages/bzrlib/tree.pyt_content_filter_stack_providers
cc@s|dkrtj}n|j|}|dk	r|dk	rdxA|D]}|j||VqFWqx|D]}|j|VqkWndS(sFind the preferences for filenames in a tree.

        :param path_names: an iterable of paths to find attributes for.
          Paths are given relative to the root of the tree.
        :param pref_names: the list of preferences to lookup - None for all
        :param _default_searcher: private parameter to assist testing - don't use
        :return: an iterator of tuple sequences, one per path-name.
          See _RulesSearcher.get_items for details on the tuple sequence.
        N(R?trulest_per_user_searchert_get_rules_searchertget_selected_itemst	get_items(Rt
path_namest
pref_namest_default_searchertsearcherR.((s//usr/lib/python2.7/dist-packages/bzrlib/tree.pyRs

cC@s
|}|S(s:Get the RulesSearcher for this tree given the default one.((Rtdefault_searcherR((s//usr/lib/python2.7/dist-packages/bzrlib/tree.pyRsN(iii(BR7t
__module__t__doc__R	R&R?RRRRRRR R"RRR$R%R'R(R)R*R-R/R5R3R8R9R:R;R<R>R@RDRGRJRIRKRLRMRQRRRSt
_mod_revisiontCURRENT_REVISIONRTR_RbRdRjRYRRRRRReRRRRRRRRR(((s//usr/lib/python2.7/dist-packages/bzrlib/tree.pyR3s|		 											
											
	
	

										!		t
InventoryTreecB@s(eZdZdZdZdZeeddZe	edd	Z
d
Ze	eddZdZ
ed
ZdZdZdZdZdZeeddZdZededZeddZeeddZddZRS(sA tree that relies on an inventory for its metadata.

    Trees contain an `Inventory` object, and also know how to retrieve
    file texts mentioned in the inventory, either from a working
    directory or from a store.

    It is possible for trees to contain files that are not described
    in their inventory or vice versa; for this use `filenames()`.

    Subclasses should set the _inventory attribute, which is considered
    private to external API users.
    cC@st|j|S(s=Like get_canonical_inventory_path() but works on multiple items.

        :param paths: A sequence of paths relative to the root of the tree.
        :return: A list of paths, with each item the corresponding input path
        adjusted to account for existing elements that match case
        insensitively.
        (Rt _yield_canonical_inventory_paths(RR((s//usr/lib/python2.7/dist-packages/bzrlib/tree.pytget_canonical_inventory_pathsscC@s|j|gjS(sReturns the first inventory item that case-insensitively matches path.

        If a path matches exactly, it is returned. If no path matches exactly
        but more than one path matches case-insensitively, it is implementation
        defined which is returned.

        If no path matches case-insensitively, the input path is returned, but
        with as many path entries that do exist changed to their canonical
        form.

        If you need to resolve many names from the same tree, you should
        use get_canonical_inventory_paths() to avoid O(N) behaviour.

        :param path: A paths relative to the root of the tree.
        :return: The input path adjusted to account for existing elements
        that match case insensitively.
        (RR(RR.((s//usr/lib/python2.7/dist-packages/bzrlib/tree.pytget_canonical_inventory_pathscc@sWxP|D]H}|j|dk	r-|Vqn|j}d}t|jd}x|D]}|j}d}x|j|D]}	yttjj	|j
|	}
|
|kr|	}tj||
}Pn-|
j|kr|	}tj||
}nWqt
jk
rqqXqW|r*|}q[tj||t|}Pq[W|VqWdS(NRt/(RR?RSRtsplittlowerRtosR.tbasenameR)REtpathjoinRftNoSuchIdR(RRR.tcur_idtcur_pathtbit_itertelttlelttnew_pathtchildt
child_base((s//usr/lib/python2.7/dist-packages/bzrlib/tree.pyRs6

		iiicC@s|jS(N(t
_inventory(R((s//usr/lib/python2.7/dist-packages/bzrlib/tree.pyt_get_inventorystdocsInventory of this TreecC@s|jS(N(R(R((s//usr/lib/python2.7/dist-packages/bzrlib/tree.pyt_get_root_inventoryssRoot inventory of this treecC@sNt|trAt|dkr4td|n|d}n|j|fS(sFind the inventory and inventory file id for a tree file id.

        :param file_id: The tree file id, as bytestring or tuple
        :return: Inventory and inventory file id
        is"nested trees not yet supported: %ri(t
isinstancettupleRt
ValueErrortroot_inventory(RR#((s//usr/lib/python2.7/dist-packages/bzrlib/tree.pyt_unpack_file_ids

cC@s|j|dS(s$Return the id for path in this tree.i(t_path2inv_file_id(RR.((s//usr/lib/python2.7/dist-packages/bzrlib/tree.pyR)scC@s|j|jj|fS(sLookup a inventory and inventory file id by path.

        :param path: Path to look up
        :return: tuple with inventory and inventory file id
        (RR(RR.((s//usr/lib/python2.7/dist-packages/bzrlib/tree.pyR.scC@s"|j|\}}|j|S(sBReturn the path for a file id.

        :raises NoSuchId:
        (RR)(RR#t	inventory((s//usr/lib/python2.7/dist-packages/bzrlib/tree.pyR)7scC@s"|j|\}}|j|S(N(RR"(RR#R((s//usr/lib/python2.7/dist-packages/bzrlib/tree.pyR"?scC@s"|j|\}}|j|S(N(RR"(RR#R((s//usr/lib/python2.7/dist-packages/bzrlib/tree.pyR%CscC@s,tg|jD]\}}|j^qS(N(tsetR*R#(RR.R4((s//usr/lib/python2.7/dist-packages/bzrlib/tree.pyR(GsicC@st|jS(N(RR((R((s//usr/lib/python2.7/dist-packages/bzrlib/tree.pyt__iter__Ksc@stfd|DS(sMFilter out paths that are versioned.

        :return: set of paths.
        c3@s*|] }j|dkr|VqdS(N(RR?(t.0tp(R(s//usr/lib/python2.7/dist-packages/bzrlib/tree.pys	<genexpr>Ws(R(RR((Rs//usr/lib/python2.7/dist-packages/bzrlib/tree.pyROscC@s|dkrd}ndg}x[|D]S}|j|\}}||jk	rhtd||jfn|j|q"W|jjd|d|S(sWalk the tree in 'by_dir' order.

        This will yield each entry in the tree as a (path, entry) tuple.
        The order that they are yielded is:

        See Tree.iter_entries_by_dir for details.

        :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.
        s%r != %rR+R,N(R?RRtAssertionErrorRrR*(RR+R,tinventory_file_idsttree_file_idRtinv_file_id((s//usr/lib/python2.7/dist-packages/bzrlib/tree.pyR*Ys
	
cC@s&|j|\}}||jjS(N(Rtchildrent
itervalues(RR#R.tinvR((s//usr/lib/python2.7/dist-packages/bzrlib/tree.pyR-tscC@s|j|j||S(N(R>R(RR.((s//usr/lib/python2.7/dist-packages/bzrlib/tree.pytget_file_by_pathyscc@sK|j|gjd}x(t|dijD]}|jVq5WdS(sSee Tree.iter_children.iRN(R*RRlRR#(RR#R.R4R((s//usr/lib/python2.7/dist-packages/bzrlib/tree.pyR}s(iii(iiiN(iii(R7RRRRRRRRtpropertyRRRRRRRR)R"R%R(RRR?R&R*R-RR(((s//usr/lib/python2.7/dist-packages/bzrlib/tree.pyRs2	
		0													
cC@s)|s
dSt|||}t||S(sFind the ids corresponding to specified filenames.

    All matches in all trees will be used, and all children of matched
    directories will be used.

    :param filenames: The filenames to find file_ids for (if None, returns
        None)
    :param trees: The trees to find file_ids within
    :param require_versioned: if true, all specified filenames must occur in
        at least one tree.
    :return: a set of file ids for the specified filenames and their children.
    N(R?t_find_ids_across_treest_find_children_across_trees(t	filenamesRR
tspecified_path_ids((s//usr/lib/python2.7/dist-packages/bzrlib/tree.pyRs

		c	C@sg}t}xl|D]d}t}x?|D]7}|j|}|dk	r)|j|t}q)q)W|r|j|qqWt|dkr|rtj	|n|S(sFind the ids corresponding to specified filenames.

    All matches in all trees will be used, but subdirectories are not scanned.

    :param filenames: The filenames to find file_ids for
    :param trees: The trees to find file_ids within
    :param require_versioned: if true, all specified filenames must occur in
        at least one tree.
    :return: a set of file ids for the specified filenames
    iN(
RRRR?taddR&RrRRftPathsNotVersionedError(	RRR
t
not_versionedtinteresting_idst	tree_patht	not_foundttreeR#((s//usr/lib/python2.7/dist-packages/bzrlib/tree.pyRs	



cC@st|}|}xt|dkrt}xj|D]b}xY|D]Q}|j|s_qDnx3|j|D]"}||kro|j|qoqoWqDWq7W|j||}qW|S(sReturn a set including specified ids and their children.

    All matches in all trees will be used.

    :param trees: The trees to find file_ids within
    :return: a set containing all specified ids and their children
    i(RRR%RRtupdate(t
specified_idsRRtpendingtnew_pendingR#Rtchild_id((s//usr/lib/python2.7/dist-packages/bzrlib/tree.pyRs	



RcB@seZdZdZdZgZedZdddZ	e
eddeeedZeddge
edZdZddZe
dddddZRS(	sThis class represents operations taking place between two Trees.

    Its instances have methods like 'compare' and contain references to the
    source and target trees these operations are to be carried out on.

    Clients of bzrlib should not need to use InterTree directly, rather they
    should use the convenience methods on Tree such as 'Tree.compare()' which
    will pass through to InterTree as appropriate.
    cC@stS(N(R(tklstsourcettarget((s//usr/lib/python2.7/dist-packages/bzrlib/tree.pyt
is_compatiblescC@s|dkr(|dkrdS|j}n	|j}|dk	rt}|j}|j}|dkrv|jj|}n|jj||\}	}
}nt}d}d}d}	d}
|dk	rt}|j}
|j}|dkr|j	j|}n|j	j||\}}}nt}d}
d}d}d}||f}|	|f}t}|	|krlt}n|	dkr|j
||||||s t}q n~|	dkr|jj||j	j|kr t}q nB|	dkr |jj|||j	j||kr t}q n||f}||
f}|
|f}|tk	s|d|dks|d|dks|d|dks|d|dkrt}nt}|||f||||||f|fS(sZGenerate a iter_changes tuple between source_entry and target_entry.

        :param source_entry: An inventory entry from self.source, or None.
        :param target_entry: An inventory entry from self.target, or None.
        :param source_path: The path of source_entry, if known. If not known
            it will be looked up.
        :param target_path: The path of target_entry, if known. If not known
            it will be looked up.
        :return: A tuple, item 0 of which is an iter_changes result tuple, and
            item 1 is True if there are any changes in the result tuple.
        tfiletsymlinkstree-referenceiiN(
R?R#Rtnamet	parent_idRR)R;R&Rtfile_content_matchesRRR:(Rtsource_entryttarget_entrytsource_pathttarget_pathR#tsource_versionedtsource_namet
source_parenttsource_kindtsource_executabletsource_statttarget_versionedttarget_namet
target_parentttarget_kindttarget_executablettarget_statt	versionedR3tchanged_contenttparentRt
executabletchanges((s//usr/lib/python2.7/dist-packages/bzrlib/tree.pyt_changes_from_entriessp
			!		!	 (	cC@s|jf}|dk	r+|t|}n|jj||d|}|r|rtj}	tjddd}
g|D](}|d|jj	|
|df^q{|	_
|	Stj|j|j|||d|d|d|S(sReturn the changes from source to target.

        :return: A TreeDelta.
        :param specific_files: An optional list of file paths to restrict the
            comparison to. When mapping filenames to ids, all matches in all
            trees (including optional extra_trees) are used, and all children of
            matched directories are included.
        :param want_unchanged: An optional boolean requesting the inclusion of
            unchanged entries in the result.
        :param extra_trees: An optional list of additional trees to use when
            mapping the contents of specific_files (paths) to file_ids.
        :param require_versioned: An optional boolean (defaults to False). When
            supplied and True all the 'specific_files' must be versioned, or
            a PathsNotVersionedError will be thrown.
        :param want_unversioned: Scan for unversioned paths.
        R
tunusediRRN(RR?RRRtdeltat	TreeDeltaRt
InventoryFileR;tunversionedt_compare_trees(RR
RRR
RRRR+tresultt
fake_entryR.((s//usr/lib/python2.7/dist-packages/bzrlib/tree.pyR2s	
5c2
c@s|jg}|r"|j|nt}g}	|gkrFg}
n|jj||d|}
|dk	rt}t}n|rtg|jjD]9}
|dkstj	||
r|
j
d|
f^q}tj|}ntj}i}t
|jjd|
}td|D}t
|jjd|
}t|t|}d}tjddd}x|D]\}}x|r/|dd|j
dkr/|j}|jj||d\}}}dd|dftttfdd|ddfd|fd|ffVqW|j|jd\}}|j||d	|d
|\}}|dd||d<|d7}|ddr|d7}n|dk	r|jd||n|s|r|
dk	r|d
d} |j| |	j|dn|Vn|dk	r|dddkrO|j|dn|d}!|d
}"|!ds|"d|"dkr|j|"dqqqWx|r|j}|jj||d\}#}$}%dd|dftttfdd|ddfd|#fd|$ffVqWx$|D]\}&}'|'j}(|(|krMq&n|jj|(shd})n|jj|(})|d7}|dk	r|jd||nttf}!|'jdf}*|'j df}+|jj|'|&\},}-}.|,df}/|-df}0|,dk	}1|	j|(|(|&|)f|1|!|*|+|/|0fVq&Wt|	}	|
dk	rx"|j!||	D]}|VqqWndS(sGenerate an iterator of changes between trees.

        A tuple is returned:
        (file_id, (path_in_source, path_in_target),
         changed_content, versioned, parent, name, kind,
         executable)

        Changed_content is True if the file's content has changed.  This
        includes changes to its kind, and to a symlink's target.

        versioned, parent, name, kind, executable are tuples of (from, to).
        If a file is missing in a tree, its kind is None.

        Iteration is done in parent-to-child order, relative to the target
        tree.

        There is no guarantee that all paths are in sorted order: the
        requirement to expand the search due to renames may result in children
        that should be found early being found late in the search, after
        lexically later results have been returned.
        :param require_versioned: Raise errors.PathsNotVersionedError if a
            path in the specific_files list is not versioned in one of
            source, target or extra_trees.
        :param specific_files: An optional list of file paths to restrict the
            comparison to. When mapping filenames to ids, all matches in all
            trees (including optional extra_trees) are used, and all children
            of matched directories are included. The parents in the target tree
            of the specific files up to and including the root of the tree are
            always evaluated for changes too.
        :param want_unversioned: Should unversioned files be returned in the
            output. An unversioned file is defined as one with (False, False)
            for the versioned pair.
        R
RR+cs@s*|] \}}|j||ffVqdS(N(R#(RRte((s//usr/lib/python2.7/dist-packages/bzrlib/tree.pys	<genexpr>siRiiRRiscomparing filesiit	directoryN(NN(NN(NN("RtextendRRRR?tsortedRREt
is_inside_anyRtcollectionstdequeRR*tdictRRRtpopleftR;RR&RR#RRRRrR"R)RRt_handle_precise_ids(2RRRRRR
Rtlookup_treestprecise_file_idstchanged_file_idsR+tseen_parentst	seen_dirsRtall_unversionedtto_pathstfrom_entries_by_dirt	from_datatto_entries_by_dirtnum_entriestentry_countRRRtunversioned_pathRRR	RRRRt
new_parent_idR
tparentstto_kindt
to_executabletto_statR.t
from_entryR#tto_pathRRt	from_kindtfrom_executableR=R3R
R((s//usr/lib/python2.7/dist-packages/bzrlib/tree.pyRZs$			0	"		




	"			


cC@sy
|j}WnMtk
r\y'|jd|g}|jdSWqtk
rXdSXn%Xy||SWntjk
rdSXdS(s[Get an inventory entry from a tree, with missing entries as None.

        If the tree raises NotImplementedError on accessing .inventory, then
        this is worked around using iter_entries_by_dir on just the file id
        desired.

        :param tree: The tree to lookup the entry in.
        :param file_id: The file_id to lookup.
        R+iN(RRR*Rt
StopIterationR?RfR(RRR#Rtiterator((s//usr/lib/python2.7/dist-packages/bzrlib/tree.pyt
_get_entrys



	cc@sx|r|jd|j||s-Png}xB|D]:}y|j|jj|Wq:tjk
rsq:Xq:Wx-|D]%}|jj	|}|j
|qW|jd|}t}x+|D]#}	|r|j|	}
d}nd}
|
dkrF|j
|j|	}|j
|j|	}|j||\}
}
nt}
|
dd}|j
||
r|
dddkr|
dddkr|dkr|j
|j|	}n|j|jj|	n|j
|
d|
VqqWqWdS(sFill out a partial iter_changes to be consistent.

        :param precise_file_ids: The file ids of parents that were seen during
            the iter_changes.
        :param changed_file_ids: The file ids of already emitted items.
        :param discarded_changes: An optional dict of precalculated
            iter_changes items which the partial iter_changes had not output
            but had calculated.
        :return: A generator of iter_changes items to output.
        iiiiRN(tdiscardR?tdifference_updateRrRR)RfRRRRRRR:RRRR(RR#R$tdiscarded_changesRRR.told_idtcurrent_idsR#Rt	old_entryt	new_entryRR/((s//usr/lib/python2.7/dist-packages/bzrlib/tree.pyR!sN	




	
	
c
C@s|jj|||\}}|jj|||\}	}
||	krR||
kS|dkry|jj|||}n|}|	dkr|jj|||}n|
}||kS(sCheck if two files are the same in the source and target trees.

        This only checks that the contents of the files are the same,
        it does not touch anything else.

        :param source_file_id: File id of the file in the source tree
        :param target_file_id: File id of the file in the target tree
        :param source_path: Path of the file in the source tree
        :param target_path: Path of the file in the target tree
        :param source_stat: Optional stat value of the file in the source tree
        :param target_stat: Optional stat value of the file in the target tree
        :return: Boolean indicating whether the files have the same contents
        RH(RRJRRI(
Rtsource_file_idttarget_file_idRRRR	tsource_verifier_kindtsource_verifier_datattarget_verifier_kindttarget_verifier_datatsource_sha1ttarget_sha1((s//usr/lib/python2.7/dist-packages/bzrlib/tree.pyRWs		
N(R7RRR?t_matching_from_tree_formatt_matching_to_tree_formatt_optimiserstclassmethodRRRR&RRRR:R!R(((s//usr/lib/python2.7/dist-packages/bzrlib/tree.pyRs"	K	%		GtMultiWalkercB@sqeZdZdZedZedZedZdZdZ	dZ
dZd	ZRS(
s=Walk multiple trees simultaneously, getting combined results.cC@s"||_||_t|_dS(sCCreate a new MultiWalker.

        All trees being walked must implement "iter_entries_by_dir()", such
        that they yield (path, object) tuples, where that object will have a
        '.file_id' member, that can be used to check equality.

        :param master_tree: All trees will be 'slaved' to the master_tree such
            that nodes in master_tree will be used as 'first-pass' sync points.
            Any nodes that aren't in master_tree will be merged in a second
            pass.
        :param other_trees: A list of other trees to walk simultaneously.
        N(t_master_treet_other_treesRt_out_of_order_processed(Rtmaster_treetother_trees((s//usr/lib/python2.7/dist-packages/bzrlib/tree.pyt__init__s
		cC@sEy|j\}}Wntk
r3tddfSXt||fSdS(sStep an iter_entries_by_dir iterator.

        :return: (has_more, path, ie)
            If has_more is False, path and ie will be None.
        N(RR8R&R?R(R9R.R((s//usr/lib/python2.7/dist-packages/bzrlib/tree.pyt	_step_ones

cC@s||krdSt|ts>tdt||fnt|tsltdt||fnttj|tj|S(sCompare two paths based on what directory they are in.

        This generates a sort order, such that all children of a directory are
        sorted together, and grandchildren are in the same order as the
        children appear. But all grandchildren come after all children.

        :param path1: first path
        :param path2: the second path
        :return: negative number if ``path1`` comes first,
            0 if paths are equal
            and a positive number if ``path2`` sorts first
        is,'path1' must be a unicode string, not %s: %rs,'path2' must be a unicode string, not %s: %r(Rtunicodet	TypeErrorttypetcmpRNt_path_to_key(tpath1tpath2((s//usr/lib/python2.7/dist-packages/bzrlib/tree.pyt_cmp_path_by_dirblockscC@s(tj|\}}|jd|fS(Nu/(RER(R.tdirnameR((s//usr/lib/python2.7/dist-packages/bzrlib/tree.pyRZscC@s||kr|j|Sy|j|}Wntjk
rHd}nX|dkrYdS|jj||j|}||fSdS(sLookup an inventory entry by file_id.

        This is called when an entry is missing in the normal order.
        Generally this is because a file was either renamed, or it was
        deleted/added. If the entry was found in the inventory and not in
        extra_entries, it will be added to self._out_of_order_processed

        :param extra_entries: A dictionary of {file_id: (path, ie)}.  This
            should be filled with entries that were found before they were
            used. If file_id is present, it will be removed from the
            dictionary.
        :param other_tree: The Tree to search, in case we didn't find the entry
            yet.
        :param file_id: The file_id to look for
        :return: (path, ie) if found or (None, None) if not present.
        N(NN(tpopR)RfRR?RQRR(Rt
extra_entriest
other_treeR#Rtcur_ie((s//usr/lib/python2.7/dist-packages/bzrlib/tree.pyt_lookup_by_file_ids


cc@sFx|jD]}|Vq
W|jx|jD]}|Vq3WdS(s+Match up the values in the different trees.N(t_walk_master_treet_finish_otherst_walk_others(RR((s//usr/lib/python2.7/dist-packages/bzrlib/tree.pytiter_alls
	
cc@s|jj}g|jD]}|j^q}g|D]}|j|^q8}gtt|jD]}i^qi}t}|j}	|j}
|j}x|r|	|\}}}
|sPn|
j	}g}|j
}g}|j
}xyt|D]k\}\}}}|sJ||
|||j|||tddfq||j	kr|||f||	||q||}||}x_|r|j||dkr|j	}||kr||f||<n|	|\}}}qW|r3|j	|kr3|||f|	|\}}}n||
||j||||||fqW|}|||
|fVqW||_||_||_dS(sFirst pass, walk all trees in lock-step.

        When we are done, all nodes in the master_tree will have been
        processed. _other_walkers, _other_entries, and _others_extra will be
        set on 'self' for future processing.
        iN(ROR*RPRUtxrangeRRRcRQR#Rrt	enumerateR&R?R]t_other_walkerst_other_entriest
_others_extra(Rtmaster_iteratorRt
other_walkerstwalkert
other_entriestitothers_extratmaster_has_moretstep_onetlookup_by_file_idtout_of_order_processedR.t	master_ieR#tother_valuestother_values_appendtnext_other_entriestnext_other_entries_appendtidxtother_has_moret
other_pathtother_ietother_walkertother_extrat
other_file_id((s//usr/lib/python2.7/dist-packages/bzrlib/tree.pyRds\
"(							"

					cC@sxt|jD]\}}|j|}|\}}}xT|r|j}||jkrl||f||<n|j|j|\}}}q;WqW|`dS(s:Finish walking the other iterators, so we get all entries.N(RiRkRlR#RQRURj(RR|tinfoRR}R~RR((s//usr/lib/python2.7/dist-packages/bzrlib/tree.pyRe?s
		'c#@s!xtjD]	\}}t|jdfd}x|D]\}}|j}|j|gt|D]}d^qs}|j||fxitj|dD]P\}	}
|	|d}	j|	}
j	|	}|jj
|
||qW||d|fVqDWqWdS(s.Finish up by walking all the 'deferred' nodes.tkeyc@sj|dS(Ni(RZ(tx(R(s//usr/lib/python2.7/dist-packages/bzrlib/tree.pyRTsiN(NN(RiRlRRR#R_RhR?RrRPRc(RR|RtothersR~RR#RqRxtalt_idxt	alt_extratalt_tree((Rs//usr/lib/python2.7/dist-packages/bzrlib/tree.pyRfLs	
$

(
R7RRRTtstaticmethodRUR]RZRcRgRdReRf(((s//usr/lib/python2.7/dist-packages/bzrlib/tree.pyRN}s		 		L	
(Rt
__future__RRtbzrlib.lazy_importRtglobalstbzrlib.decoratorsRtbzrlib.interRtbzrlib.symbol_versioningRRtobjectRRRRRRRtregister_optimiserRN(((s//usr/lib/python2.7/dist-packages/bzrlib/tree.pyt<module>s&			


Copyright © 2017 || Recoded By Mr.Bumblebee