-=[ Mr. Bumblebee ]=-
_Indonesia_

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


zyOc@@sxddlmZddlZddlZddlmZmZddlZddlm	Z
mZmZm
Z
mZmZejedddlmZmZmZmZmZmZmZddlmZmZddlmZdd	lmZm Z m!Z!m"Z"m#Z#m$Z$dd
l%m&Z&ddl'm(Z(m)Z)m*Z*dZ+d
Z,de-fdYZ.de-fdYZ/de/fdYZ0dej1fdYZ2de2fdYZ3dZ4dZ5e
j6Z7e7j8de5de7j8de4de7j9de
j:de7dd d!d"Z;d#e0fd$YZ<d%e0fd&YZ=d'ej>fd(YZ?d)Z@d*e-fd+YZAd,ZBeCeDeDd-ZEd.ZFd/ZGd0ZHd1ZId2ZJd3ZKd4ZLeCeCd5ZMd6ZNeDeCeCd7ZOeCeCd8ZPeCd9ZQeCeCd:ZReCd;ZSd<ZTd=ZUd>e-fd?YZVdS(@i(tabsolute_importN(tS_ISREGtS_IEXEC(tconfigterrorstlazy_importtregistryttracettrees
from bzrlib import (
    annotate,
    bencode,
    controldir,
    commit,
    conflicts,
    delta,
    inventory,
    multiparent,
    osutils,
    revision as _mod_revision,
    ui,
    urlutils,
    )
from bzrlib.i18n import gettext
(tDuplicateKeytMalformedTransformtReusingTransformtCantMoveRoott
ImmortalLimbotNoFinalPathtUnableCreateSymlink(tfiltered_output_bytestContentFilterContext(tMutableTree(t
delete_anyt	file_kindthas_symlinkstpathjointsha_filet	splitpath(t
ProgressPhase(tdeprecated_functiont
deprecated_intdeprecated_methodsroot-parentcC@s,||krtd|n|||<dS(Ntkey(R	(tmapRtvalue((s4/usr/lib/python2.7/dist-packages/bzrlib/transform.pyt
unique_addIst_TransformResultscB@seZdZRS(cC@s#tj|||_||_dS(N(tobjectt__init__tmodified_pathstrename_count(tselfR$R%((s4/usr/lib/python2.7/dist-packages/bzrlib/transform.pyR#Qs
	(t__name__t
__module__R#(((s4/usr/lib/python2.7/dist-packages/bzrlib/transform.pyR!PstTreeTransformBasec	B@seZdZdBedZdZdZdZdZ	e
e	ZdZdZ
dZd	Zd
ZdZdZd
ZdZdZdZdZdZdZdZdZdZedZdZdZ dZ!dZ"dZ#dZ$dZ%dZ&d Z'd!Z(d"Z)d#Z*d$Z+d%Z,d&Z-d'Z.d(Z/d)Z0d*Z1d+Z2d,Z3d-Z4d.Z5d/Z6d0Z7dBdBdBd1Z8dBd2Z9dBd3Z:d4Z;d5Z<d6Z=d7Z>d8Z?d9Z@d:ZAd;ZBdBedBdBdBdBdBdBd<ZCd=ZDd>ZEd?ZFd@ZGdAZHRS(Cs-The base class for TreeTransform and its kin.cC@stj|||_d|_i|_i|_i|_i|_t|_	i|_
i|_i|_i|_
i|_t|_i|_i|_|j}|dk	r|j||_n	d|_t|_||_||_d|_dS(sConstructor.

        :param tree: The tree that will be transformed, but not necessarily
            the output tree.
        :param pb: ignored
        :param case_sensitive: If True, the target of the transform is
            case sensitive, not just case preserving.
        iN(R"R#t_treet
_id_numbert	_new_namet_new_parentt
_new_contentst_observed_sha1stsett_removed_contentst_new_executabilityt_new_reference_revisiont_new_idt_non_present_idst	_r_new_idt_removed_idt_tree_path_idst_tree_id_pathstget_root_idtNonettrans_id_tree_file_idt	_new_roottFalset_donet_pbt_case_sensitive_targetR%(R&Rtpbtcase_sensitivetroot_id((s4/usr/lib/python2.7/dist-packages/bzrlib/transform.pyR#Zs0

																	cC@s|S(sSupport Context Manager API.((R&((s4/usr/lib/python2.7/dist-packages/bzrlib/transform.pyt	__enter__scC@s|jdS(sSupport Context Manager API.N(tfinalize(R&texc_typetexc_valtexc_tb((s4/usr/lib/python2.7/dist-packages/bzrlib/transform.pyt__exit__scC@sU|jdkrdSx%tjdD]}||j|q!W|jjd|_dS(sRelease the working tree lock, if held.

        This is required if apply has not been invoked, but can be invoked
        even after apply.
        Ntpost_transform(R*R;Rthookstunlock(R&thook((s4/usr/lib/python2.7/dist-packages/bzrlib/transform.pyRFs
cC@s|jS(N(R=(R&((s4/usr/lib/python2.7/dist-packages/bzrlib/transform.pyt
__get_rootscC@s d|j}|jd7_|S(sProduce a new tranform idsnew-%si(R+(R&tnew_id((s4/usr/lib/python2.7/dist-packages/bzrlib/transform.pyt
_assign_ids
cC@s6|j}t|j||t|j|||S(s%Assign a transaction id to a new path(RQR R,R-(R&tnametparentttrans_id((s4/usr/lib/python2.7/dist-packages/bzrlib/transform.pytcreate_pathscC@sQ|dkrtdn||jkr3tn||j|<||j|<dS(s5Change the path that is assigned to a transaction id.sParent trans-id may not be NoneN(R;t
ValueErrorR=RR,R-(R&RRRSRT((s4/usr/lib/python2.7/dist-packages/bzrlib/transform.pytadjust_paths	
cC@s8|j}|j|}x|j|D]u}||krb|j|j||j||n|j|}|dk	r|j|n|j||q(W|j	j
d|jj
||j|j
j|_||kr|j}n|j||||j||j|||j|jdS(s~Emulate moving the root by moving all children, instead.

        We do this by undoing the association of root's transaction id with the
        current tree.  This allows us to create a new directory with that
        transaction id.  We unversion the root directory and version the
        physically new directory, and hope someone versions the tree root
        later.
        tN(R=t
final_file_idtiter_tree_childrenRWt
final_nametfinal_parentR;tunversion_filetversion_fileR8tpopR9R<R*R:tcreate_directory(R&RRRStold_roottold_root_file_idtchild_idtfile_id((s4/usr/lib/python2.7/dist-packages/bzrlib/transform.pytadjust_root_paths&		
cC@sg|jjD]\}}|tkr|^q}t|dkrJdSt|dkrktdn|jdkr|d|_dS|d}|j|jdkr|j|}n|j|j}||j	kr|j
|n
|j||j|jdk	r:|j|j
kr:|j|jn|dk	r\|j||jnt|j|x?|jj|gD]%}|j|j||j|qW||jkr|j|n
|j||j|jkr|j|jn|j|=|j|=dS(sReinterpret requests to change the root directory

        Instead of creating a root directory, or moving an existing directory,
        all the attributes and children of the new root are applied to the
        existing root directory.

        This means that the old root trans-id becomes obsolete, so it is
        recommended only to invoke this after the root trans-id has become
        irrelevant.

        iNsA tree cannot have two roots!i(R-t	iteritemstROOT_PARENTtlenRVR=R;t
final_kindRYR4tcancel_versioningR]ttree_file_idR7R^tlistRZt	by_parenttgetRWR[R.tcancel_creationtdelete_contentsR1tcancel_deletionR,(R&tktvt	new_rootstold_new_rootRdtchild((s4/usr/lib/python2.7/dist-packages/bzrlib/transform.pytfixup_new_rootss>


#

cC@s:|dkrtdn|jj|}|j|S(sDetermine the transaction id of a working tree file.

        This reflects only files that already exist, not ones that will be
        added by transactions.
        sNone is not a valid file idN(R;RVR*tid2pathttrans_id_tree_path(R&tinventory_idtpath((s4/usr/lib/python2.7/dist-packages/bzrlib/transform.pyR<scC@s|dkrtdn||jkrH|j|dk	rH|j|Sy|jj|gjWnHtk
r||jkr|j|S|j}||j|<|SnX|j	|SdS(s$Determine or set the transaction id associated with a file ID.
        A new id is only created for file_ids that were never present.  If
        a transaction has been unversioned, it is deliberately still returned.
        (this will likely lead to an unversioned parent conflict.)
        sNone is not a valid file idN(
R;RVR6R*titer_entries_by_dirtnextt
StopIterationR5RQR<(R&RdRT((s4/usr/lib/python2.7/dist-packages/bzrlib/transform.pyttrans_id_file_id(s"

cC@sS|j|}||jkrH|j|j|<||j|j|<n|j|S(s=Determine (and maybe set) the transaction ID for a tree path.(tcanonical_pathR8RQR9(R&R{((s4/usr/lib/python2.7/dist-packages/bzrlib/transform.pyRy?s
cC@s6|j|}|dkrtS|jtjj|S(s'Determine id of the parent in the tree.RX(R9RgRytosR{tdirname(R&RTR{((s4/usr/lib/python2.7/dist-packages/bzrlib/transform.pytget_tree_parentGs
cC@s2|j|}|dk	r.|jj|ndS(s2Schedule the contents of a path entry for deletionN(t	tree_kindR;R1tadd(R&RTtkind((s4/usr/lib/python2.7/dist-packages/bzrlib/transform.pyRpNscC@s|jj|dS(sCancel a scheduled deletionN(R1tremove(R&RT((s4/usr/lib/python2.7/dist-packages/bzrlib/transform.pyRqTscC@s|jj|dS(s+Schedule a path entry to become unversionedN(R7R(R&RT((s4/usr/lib/python2.7/dist-packages/bzrlib/transform.pyR]XscC@s|j||j|dS(s%Delete and unversion a versioned fileN(RpR](R&RT((s4/usr/lib/python2.7/dist-packages/bzrlib/transform.pytdelete_versioned\s
cC@s0|dkr|j|=nt|j||dS(sQSchedule setting of the 'execute' bit
        To unschedule, set to None
        N(R;R2R (R&t
executabilityRT((s4/usr/lib/python2.7/dist-packages/bzrlib/transform.pytset_executabilityas
cC@st|j||dS(s-Set the reference associated with a directoryN(R R3(R&trevision_idRT((s4/usr/lib/python2.7/dist-packages/bzrlib/transform.pytset_tree_referencejscC@sB|dkrtnt|j||t|j||dS(s$Schedule a file to become versioned.N(R;RVR R4R6(R&RdRT((s4/usr/lib/python2.7/dist-packages/bzrlib/transform.pyR^nscC@s%|j|}|j|=|j|=dS(s$Undo a previous versioning of a fileN(R4R6(R&RTRd((s4/usr/lib/python2.7/dist-packages/bzrlib/transform.pyRjus

cC@st}|rx|jj|j}|j|j|j|j|j|j|jj|}||jf}n$|j|j|j|j|jf}x|D]}|j	|qWt
t|j|S(sDetermine the paths of all new and changed files.

        :param filesystem_only: if True, only calculate values for files
            that require renames or execute bit changes.
        (
R0t
_needs_renamet
differenceR,tdifference_updateR-R.R4R2tupdatetsortedt
FinalPathst	get_paths(R&tfilesystem_onlytnew_idst	stale_idstneeds_renametid_setstid_set((s4/usr/lib/python2.7/dist-packages/bzrlib/transform.pyt	new_paths{s	
c@st}tfdjD}x0jj|jgD]}|j|qDWtj}|jj|j	|fd|D}|j|tfd|D}x$|D]}|jj
|qWttj
|S(sLDetermine which trans_ids need new Inventory entries.

        An new entry is needed when anything that would be reflected by an
        inventory entry changes, including file name, file_id, parent file_id,
        file kind, and the execute bit.

        Some care is taken to return entries with real changes, not cases
        where the value is deleted and then restored to its original value,
        but some actually unchanged values may be returned.

        :returns: A list of (path, trans_id) for all items requiring an
            inventory change. Ordered by path.
        c3@s1|]'}j|j|kr|VqdS(N(R4Rk(t.0tt(R&(s4/usr/lib/python2.7/dist-packages/bzrlib/transform.pys	<genexpr>sc3@s3|])}j|j|kr|VqdS(N(RRi(RR(R&(s4/usr/lib/python2.7/dist-packages/bzrlib/transform.pys	<genexpr>sc3@s$|]}|jkr|VqdS(N(R7(RR(R&(s4/usr/lib/python2.7/dist-packages/bzrlib/transform.pys	<genexpr>s(R0R4R,R-R2RR1tintersection_updateR.RRZRRR(R&tchanged_idstnew_file_idRtchanged_kindtchanged_file_idtparent_trans_id((R&s4/usr/lib/python2.7/dist-packages/bzrlib/transform.pyt_inventory_altereds	


cC@s>||jkr|j|S||jkr-dS|j|SdS(sDetermine the final file kind, after any changes applied.

        :return: None if the file does not exist/has no contents.  (It is
            conceivable that a path would be created without the corresponding
            contents insertion command)
        N(R.R1R;R(R&RT((s4/usr/lib/python2.7/dist-packages/bzrlib/transform.pyRis
cC@sRy|j|}Wntk
r%dSX|j|krB|jjS|jj|S(s>Determine the file id associated with the trans_id in the treeN(R9tKeyErrorR;R=R*R:tpath2id(R&RTR{((s4/usr/lib/python2.7/dist-packages/bzrlib/transform.pyRks

cC@sCy|j|SWn$tk
r5||jkr6dSnX|j|S(sDetermine the file id after any changes are applied, or None.

        None indicates that the file will not be versioned after changes are
        applied.
        N(R4RR7R;Rk(R&RT((s4/usr/lib/python2.7/dist-packages/bzrlib/transform.pyRYs
cC@sS|j|}|dk	r|Sx-|jjD]\}}||kr/|Sq/WdS(sReturn the inactive file_id associated with a transaction id.
        That is, the one in the tree or in non_present_ids.
        The file_id may actually be active, too.
        N(RkR;R5Rf(R&RTRdRR((s4/usr/lib/python2.7/dist-packages/bzrlib/transform.pytinactive_file_idscC@s1y|j|SWntk
r,|j|SXdS(syDetermine the parent file_id, after any changes are applied.

        ROOT_PARENT is returned for the tree root.
        N(R-RR(R&RT((s4/usr/lib/python2.7/dist-packages/bzrlib/transform.pyR\s
cC@sey|j|SWnOtk
r`ytjj|j|SWqatk
r\t||qaXnXdS(s<Determine the final filename, after all changes are applied.N(R,RRR{tbasenameR9R(R&RT((s4/usr/lib/python2.7/dist-packages/bzrlib/transform.pyR[s

c@si}tjj}|jfdjjDxA|D]9\}}||krpt||<n||j|qHW|S(sReturn a map of parent: children for known parents.

        Only new paths and parents of tree files with assigned ids are used.
        c3@s$|]}|j|fVqdS(N(R\(RR(R&(s4/usr/lib/python2.7/dist-packages/bzrlib/transform.pys	<genexpr>s(RlR-RftextendR9tkeysR0R(R&RmtitemsRTt	parent_id((R&s4/usr/lib/python2.7/dist-packages/bzrlib/transform.pyRmscC@s||jkp||jkS(s-Return True if a trans_id's path has changed.(R,R-(R&RT((s4/usr/lib/python2.7/dist-packages/bzrlib/transform.pytpath_changedscC@s
||jkS(N(R.(R&RT((s4/usr/lib/python2.7/dist-packages/bzrlib/transform.pytnew_contentsscC@s|jtkrtng}|j|j}|j|j||j|j|j|j||j|j	|j|j
||j|j|j|j|j|j
|S(s9Find any violations of inventory or filesystem invariants(R?tTrueRt_add_tree_childrenRmRt_unversioned_parentst
_parent_loopst_duplicate_entriest_duplicate_idst_parent_type_conflictst_improper_versioningt_executability_conflictst_overwrite_conflicts(R&t	conflictsRm((s4/usr/lib/python2.7/dist-packages/bzrlib/transform.pytfind_conflictss
cC@s4|j}t|dkr0td|ndS(NiR(RRhR
(R&R((s4/usr/lib/python2.7/dist-packages/bzrlib/transform.pyt_check_malformed(scC@s|jj}|jg|jD]!}|j|dkr"|^q"x||jD]q}|j|}|dk	r|jj	|dkr|j
|qqT|j|dkrT|j
|qTqTWx!|D]}t|j|qWdS(sAdd all the children of all active parents to the known paths.

        Active parents are those which gain children, and those which are
        removed.  This is a necessary first step in detecting conflicts.
        t	directoryN(
RmRRR1RR7RkR;R*tstored_kindtappendRlRZ(R&tparentsRRTRdR((s4/usr/lib/python2.7/dist-packages/bzrlib/transform.pyR-s"
cC@s|dkr'|jj|g}nx'|D]}|j||kr.tSq.W|jj|d}|dkrvtSt||}|jj|d}|dkrt	j
|jj|St
d|||fdS(sbDoes a parent already have a name child.

        :param name: The searched for name.

        :param parent_id: The parent for which the check is made.

        :param known_children: The already known children. This should have
            been recently obtained from `self.by_parent.get(parent_id)`
            (or will be if None is passed).
        schild_id is missing: %s, %s, %sN(R;RmRnR[RR9R>tjoinpathR8tosutilstlexistsR*tabspathtAssertionError(R&RRRtknown_childrenRvtparent_patht
child_pathRc((s4/usr/lib/python2.7/dist-packages/bzrlib/transform.pyt_has_named_childBs
c@s7jjgtj|fdS(sFind an available backup name.

        :param name: The basename of the file.

        :param target_id: The directory trans_id where the backup should 
            be placed.
        c@sj|S(N(R(tbase(RR&t	target_id(s4/usr/lib/python2.7/dist-packages/bzrlib/transform.pyt<lambda>js(RmRnRtavailable_backup_name(R&RRR((RR&Rs4/usr/lib/python2.7/dist-packages/bzrlib/transform.pyt_available_backup_name_scC@sg}x|jD]}t}|}xw|tkr|j|y|j|}Wntk
rhPnX||kr|jd|fn||kr(Pq(q(WqW|S(s#No entry should be its own ancestorsparent loop(R-R0RgRR\RR(R&RRTtseenR((s4/usr/lib/python2.7/dist-packages/bzrlib/transform.pyRms	

cC@sg}x|jD]v\}}|tkr1qn|j|dk	rLqnx:|D]2}|j|dk	rS|jd|fPqSqSWqW|S(s@If parent directories are versioned, children must be versioned.sunversioned parentN(RfRgRYR;R(R&RmRRtchildrenRc((s4/usr/lib/python2.7/dist-packages/bzrlib/transform.pyRs
cC@sg}xv|jjD]e}|j|}|dkrP|jd|fqntjj|s|jd||fqqW|S(s}Cannot version a file with no contents, or a bad type.

        However, existing entries with no contents are okay.
        sversioning no contentssversioning bad kindN(R4titerkeysRiR;Rt	inventorytInventoryEntrytversionable_kind(R&RRTR((s4/usr/lib/python2.7/dist-packages/bzrlib/transform.pyRscC@stg}xg|jD]\}|j|dkrA|jd|fq|j|dkr|jd|fqqW|S(s2Check for bad executability changes.

        Only versioned files may have their executability set, because
        1. only versioned entries can have executability under windows
        2. only files can be executable.  (The execute bit on a directory
           does not indicate searchability)
        sunversioned executabilitytfilesnon-file executabilityN(R2RYR;RRi(R&RRT((s4/usr/lib/python2.7/dist-packages/bzrlib/transform.pyRscC@sjg}x]|jD]R}|j|dkr1qn||jkr|jd||j|fqqW|S(s-Check for overwrites (not permitted on Win32)t	overwriteN(R.RR;R1RR[(R&RRT((s4/usr/lib/python2.7/dist-packages/bzrlib/transform.pyRscC@s@g}|j|jfiifkr(|Sx|jD]}g}xW|D]O}|j|}|dk	rH|js|j}n|j||fqHqHW|jd}d}x|D]|\}}	|j	|	}
|j
|	}|
dkr|dkrqn||kr(|jd||	|fn|}|	}qWq5W|S(s5No directory may have two entries with the same name.t	duplicateN(R,R-t
itervaluesR[R;RAtlowerRtsortRiRY(R&RmRRtname_idst	child_tidRRt	last_namet
last_trans_idRTRRd((s4/usr/lib/python2.7/dist-packages/bzrlib/transform.pyRs2
	

c@sg}tfdjD}jj}|j|}xQjjD]@\}}||krSj|}|jd||fqSqSW|S(s'Each inventory id may only be used oncec3@s|]}j|VqdS(N(Rk(RRT(R&(s4/usr/lib/python2.7/dist-packages/bzrlib/transform.pys	<genexpr>ssduplicate id(	R0R7R*tall_file_idsRR4RfR<R(R&Rtremoved_tree_idstall_idstactive_tree_idsRTRdtold_trans_id((R&s4/usr/lib/python2.7/dist-packages/bzrlib/transform.pyRscC@sg}x|jD]\}}|tkr1qnt}x-|D]%}|j|dk	r>t}Pq>q>W|rsqn|j|}|dkr|jd|fq|dkr|jd|fqqW|S(s%Children must have a directory parentsmissing parentRsnon-directory parentN(RfRgRRiR;R>R(R&RmRRRtno_childrenRcR((s4/usr/lib/python2.7/dist-packages/bzrlib/transform.pyRs"
cC@s|jjr|j|}|jj|}tj|j}|rtjd}tj||d|@B}|d@r|d|@O}n|d@r|d|@O}qn
|d	@}tj	||ndS(
s)Set the executability of versioned files ii@iii iiINi(
R*t_supports_executableR2RRtstattst_modetumaskRtchmod_if_possible(R&R{RTtnew_executabilityRtcurrent_modeRtto_mode((s4/usr/lib/python2.7/dist-packages/bzrlib/transform.pyt_set_executabilitys




cC@s5|j||}|dk	r1|j||n|S(s1Helper function to create a new filesystem entry.N(RUR;R^(R&RRRRdRT((s4/usr/lib/python2.7/dist-packages/bzrlib/transform.pyt
_new_entry
scC@sN|j|||}|j||d||dk	rJ|j||n|S(sConvenience method to create files.

        name is the name of the file to create.
        parent_id is the transaction id of the parent directory of the file.
        contents is an iterator of bytestrings, which will be used to produce
        the file.
        :param file_id: The inventory ID of the file, if it is to be versioned.
        :param executable: Only valid when a file_id has been supplied.
        tsha1N(Rtcreate_fileR;R(R&RRRtcontentsRdt
executableRRT((s4/usr/lib/python2.7/dist-packages/bzrlib/transform.pytnew_files
cC@s&|j|||}|j||S(sConvenience method to create directories.

        name is the name of the directory to create.
        parent_id is the transaction id of the parent directory of the
        directory.
        file_id is the inventory ID of the directory, if it is to be versioned.
        (RR`(R&RRRRdRT((s4/usr/lib/python2.7/dist-packages/bzrlib/transform.pyt
new_directory's
cC@s)|j|||}|j|||S(s@Convenience method to create symbolic link.

        name is the name of the symlink to create.
        parent_id is the transaction id of the parent directory of the symlink.
        target is a bytestring of the target of the symlink.
        file_id is the inventory ID of the file, if it is to be versioned.
        (Rtcreate_symlink(R&RRRttargetRdRT((s4/usr/lib/python2.7/dist-packages/bzrlib/transform.pytnew_symlink3scC@st|jdS(s?Schedule an item to be orphaned.

        When a directory is about to be removed, its children, if they are not
        versioned are moved out of the way: they don't have a parent anymore.

        :param trans_id: The trans_id of the existing item.
        :param parent_id: The parent trans_id of the item.
        N(tNotImplementedErrort
new_orphan(R&RTR((s4/usr/lib/python2.7/dist-packages/bzrlib/transform.pyR?s	cC@sfg}xY|j|D]G}||jkr2qq|j|dkrW|j|qd}PqW|S(sFind the potential orphans in a directory.

        A directory can't be safely deleted if there are versioned files in it.
        If all the contained files are unversioned then they can be orphaned.

        The 'None' return value means that the directory contains at least one
        versioned file and should not be deleted.

        :param dir_id: The directory trans id.

        :return: A list of the orphan trans ids or None if at least one
             versioned file is present.
        N(RmR1RYR;R(R&tdir_idtorphansR((s4/usr/lib/python2.7/dist-packages/bzrlib/transform.pyt_get_potential_orphansJscC@st|j}|j|jj|j|j|j|jj|j|jj|j|jj|j|j	j|S(s9Return the set of transform ids affected by the transform(
R0R7RR4RR1R.R2R,R-(R&t	trans_ids((s4/usr/lib/python2.7/dist-packages/bzrlib/transform.pyt
_affected_idsiscC@s|j}i}i}x^|D]V}|j|}|dk	rM|||<n|j|}|dk	r|||<qqW||fS(sAReturn mapping of file_ids to trans_ids in the to and from statesN(RRkR;RY(R&Rtfrom_trans_idstto_trans_idsRTtfrom_file_idt
to_file_id((s4/usr/lib/python2.7/dist-packages/bzrlib/transform.pyt_get_file_id_mapsts

cC@s|jj|}|rL|jj|gjd}|j}|j}nQd}|dkrmd}d}n0tj	j
|}|j|}|j|}|dk	r|jj
||\}	}
}nd}	t}
|||	|
fS(spGet data about a file in the from (tree) state

        Return a (name, parent, kind, executable) tuple
        iN(R9RnR*R|R}RRRR;RR{RRRkt_comparison_dataR>(R&t
from_trans_idtfrom_versionedRdt	from_patht
from_entryt	from_nametfrom_parentttree_parentt	from_kindtfrom_executablet
from_stats((s4/usr/lib/python2.7/dist-packages/bzrlib/transform.pyt_from_file_datas"		!cC@s|j|}|j|}|j|j|}||jkrU|j|}n||krj|}nt}||||fS(spGet data about a file in the to (target) state

        Return a (name, parent, kind, executable) tuple
        (R[RiRYR\R2R>(R&tto_trans_idRRtto_nametto_kindt	to_parentt
to_executable((s4/usr/lib/python2.7/dist-packages/bzrlib/transform.pyt
_to_file_datas	cC@st|}|j\}}g}xt|j|jD]}t}|j|}|dkr{t}||}nt}|j|}	|	dkrt}
|}	nt}
|j|||\}}}
}|j	|	||\}}}}|sd}n|j
j|}|
s#d}n|j|	}|
|krGt}n0|dkrw|	|ksn|	|jkrwt}n|r||
kr||kr||kr||krqAn|j
|||f|||
f||f||f|
|f||ffqAWtt|ddS(sProduce output in the same format as Tree.iter_changes.

        Will produce nonsensical results if invoked while inventory/filesystem
        conflicts (as reported by TreeTransform.find_conflicts()) are present.

        This reads the Transform, but only reproduces changes involving a
        file_id.  Files that are not versioned in either of the FROM or TO
        states are not reflected.
        RtsymlinkRcS@s|dS(Ni((tx((s4/usr/lib/python2.7/dist-packages/bzrlib/transform.pyRsN(sfilessymlink(RRR0RR>RnR;RR
RR9tget_pathR.RtiterR(R&tfinal_pathsRRtresultsRdtmodifiedRRRtto_versionedRRR
RRRRRRtto_path((s4/usr/lib/python2.7/dist-packages/bzrlib/transform.pytiter_changessP
#
	!!								cC@s
t|S(sReturn a tree representing the result of the transform.

        The tree is a snapshot, and altering the TreeTransform will invalidate
        it.
        (t_PreviewTree(R&((s4/usr/lib/python2.7/dist-packages/bzrlib/transform.pytget_preview_treescC@s|j|rit|jjt|j}x5|D]*}|j|d	kr8tjq8q8Wn|j	\}
}|t
jkr|d	k	rtdng}n%|g}|d	k	r|j
|n|jj|krtd|jjntjj|	||}	|j|d|d|d|d|	d|
}|j}t|j|||j|j|j|}
|j|
d|
|
S(
sCommit the result of this TreeTransform to a branch.

        :param branch: The branch to commit to.
        :param message: The message to attach to the commit.
        :param merge_parents: Additional parent revision-ids specified by
            pending merges.
        :param strict: If True, abort the commit if there are unversioned
            files.
        :param timestamp: if not None, seconds-since-epoch for the time and
            date.  (May be a float.)
        :param timezone: Optional timezone for timestamp, as an offset in
            seconds.
        :param committer: Optional committer in email-id format.
            (e.g. "J Random Hacker <jrandom@example.com>")
        :param authors: Optional list of authors in email-id format.
        :param revprops: Optional dictionary of revision properties.
        :param revision_id: Optional revision id.  (Specifying a revision-id
            may reduce performance for some non-native formats.)
        :return: The revision_id of the revision committed.
        s-Cannot supply merge parents for first commit.s+TreeTransform not based on branch basis: %st	timestampttimezonet	committertrevpropsRiN(RR0R.RR4RYR;RtStrictCommitFailedtlast_revision_infot
_mod_revisiont
NULL_REVISIONRVRR*tget_revision_idtcommittCommittupdate_revpropstget_commit_builderRRltrecord_iter_changesRtfinish_inventorytset_last_revision_info(R&tbranchtmessaget
merge_parentststrictR R!R"tauthorsR#RtunversionedRTtrevnotlast_rev_idt
parent_idstbuildertpreview((s4/usr/lib/python2.7/dist-packages/bzrlib/transform.pyR)s>
!
			
cC@sW|j|}y,|dks6|jj|dkr:dSWntjk
rRdSX|S(NR(RkR;R*RRt
NoSuchFile(R&RTRd((s4/usr/lib/python2.7/dist-packages/bzrlib/transform.pyt_text_parent3s$cC@s2|j|}|dkrdS|jj|fS(s/Get texts for compression parents of this file.N((R<R;R*t
get_file_text(R&RTRd((s4/usr/lib/python2.7/dist-packages/bzrlib/transform.pyt_get_parents_texts<scC@s2|j|}|dkrdS|jj|fS(s/Get lines for compression parents of this file.N((R<R;R*tget_file_lines(R&RTRd((s4/usr/lib/python2.7/dist-packages/bzrlib/transform.pyt_get_parents_linesCscc@std|jjD}td|jjD}td|jjD}i	|jd6|d6|jd6|d6|jd6|d	6t|j	d
6t|j
d6|jd6}|jt
j
|dVx|jjD]\}}|dkrVtj|j|}|j|}	tjj||	}
dj|
j}n|dkrkd}n|dkr|j|}n|j|||ffVqWdS(snSerialize this TreeTransform.

        :param serializer: A Serialiser like pack.ContainerSerializer.
        cs@s*|] \}}||jdfVqdS(sutf-8N(tencode(RRrRs((s4/usr/lib/python2.7/dist-packages/bzrlib/transform.pys	<genexpr>Oscs@s'|]\}}|t|fVqdS(N(tint(RRrRs((s4/usr/lib/python2.7/dist-packages/bzrlib/transform.pys	<genexpr>Qscs@s*|] \}}|jd|fVqdS(sutf-8N(RA(RRrRs((s4/usr/lib/python2.7/dist-packages/bzrlib/transform.pys	<genexpr>SsR+R,R-R2R4R8R7R1R5tattribsRRXRRN(sattribs((sattribs(tdictR,RR2R8R+R-R4RlR7R1R5tbytes_recordtbencodeR.Rtchunks_to_linest_read_file_chunksR@tmultiparenttMultiParentt
from_linestjointto_patcht_read_symlink_target(R&t
serializertnew_nameRt
tree_path_idsRCRTRtlinesRtmpdifftcontent((s4/usr/lib/python2.7/dist-packages/bzrlib/transform.pyt	serializeJs<			



	cC@s|j\}}tj|}|d|_td|djD|_|d|_td|djD|_|d|_	td|j	jD|_
i|_i|_xG|d	jD]5\}}|j
d
}||j|<||j|<qWt|d|_t|d|_|d
|_x|D]\\\}}}|dkrtjj|}	|	j|j|}
|j|
|n|dkr|j|n|dkrF|j|j
d
|qFqFWdS(sDeserialize a stored TreeTransform.

        :param records: An iterable of (names, content) tuples, as per
            pack.ContainerPushParser.
        R+cs@s*|] \}}||jdfVqdS(sutf-8N(tdecode(RRrRs((s4/usr/lib/python2.7/dist-packages/bzrlib/transform.pys	<genexpr>xsR,R-cs@s'|]\}}|t|fVqdS(N(tbool(RRrRs((s4/usr/lib/python2.7/dist-packages/bzrlib/transform.pys	<genexpr>{sR2R4cs@s!|]\}}||fVqdS(N((RRrRs((s4/usr/lib/python2.7/dist-packages/bzrlib/transform.pys	<genexpr>~sR8sutf-8R7R1R5RRRN(R}RFtbdecodeR+RDRR,R-R2R4R6R8R9RVR0R7R1R5RIRJt
from_patchtto_linesR>RR`R(R&trecordstnamesRTRCtbytepathRTR{RRSRR((s4/usr/lib/python2.7/dist-packages/bzrlib/transform.pytdeserializeos8
	
	
"		

N(IR'R(t__doc__R;RR#RERJRFt_TreeTransformBase__get_roottpropertytrootRQRURWReRwR<RRyRRpRqR]RRRR^RjR>RRRiRkRYRR\R[RmRRRRRRRRRRRRRRRRRRRRRRRRR
RRRR)R<R>R@RUR^(((s4/usr/lib/python2.7/dist-packages/bzrlib/transform.pyR)Ws5			
						 	=														(			
		
	
															
										>	8					%tDiskTreeTransformcB@seZdZdedZdZdZdZdZ	dZ
dZdZddd	Z
d
ZdZdZd
ZdZdZdZdZRS(s,Tree transform storing its contents on disk.cC@shtj||||||_d|_i|_t|_i|_i|_	t|_
d|_dS(sConstructor.
        :param tree: The tree that will be transformed, but not necessarily
            the output tree.
        :param limbodir: A directory where new files can be stored until
            they are installed in their proper places
        :param pb: ignored
        :param case_sensitive: If True, the target of the transform is
            case sensitive, not just case preserving.
        N(R)R#t	_limbodirR;t_deletiondirt_limbo_filesR0t_possibly_stale_limbo_filest_limbo_childrent_limbo_children_namesRt_creation_mtime(R&RtlimbodirRBRC((s4/usr/lib/python2.7/dist-packages/bzrlib/transform.pyR#s					cC@s$|jdkrdSz|jjt|j}t|dt}xJ|D]B}yt|WqKt	k
r}|j
t
jkrqqKXqKWyt|jWn t	k
rt
|jnXy#|jdk	rt|jnWn#t	k
r
tj|jnXWdtj|XdS(sRelease the working tree lock, if held, clean up limbo dir.

        This is required if apply has not been invoked, but can be invoked
        even after apply.
        Ntreverse(R*R;RftvaluesRlRgRRRtOSErrorterrnotENOENTRdR
ReRtImmortalPendingDeletionR)RF(R&tlimbo_pathsR{te((s4/usr/lib/python2.7/dist-packages/bzrlib/transform.pyRFs,



cC@s
tjS(s4Check if the limbo path supports the executable bit.(Rtsupports_executable(R&((s4/usr/lib/python2.7/dist-packages/bzrlib/transform.pyt_limbo_supports_executablescC@sA|jj|}|dkr=|j|}||j|<n|S(s!Generate the limbo name of a fileN(RfRnR;t_generate_limbo_path(R&RTt
limbo_name((s4/usr/lib/python2.7/dist-packages/bzrlib/transform.pyt_limbo_names
cC@s |jj|t|j|S(sGenerate a limbo path using the trans_id as the relative path.

        This is suitable as a fallback, and when the transform should not be
        sensitive to the path encoding of the limbo directory.
        (RRRRd(R&RT((s4/usr/lib/python2.7/dist-packages/bzrlib/transform.pyRvscC@s|jj|}|jj|}tj||||||jkr||jkr|j|g||kr|j|j	|n||ks||kr|j
||=qndS(N(R-RnR,R)RWRfRt_rename_in_limboRhRRi(R&RRRSRTtprevious_parentt
previous_name((s4/usr/lib/python2.7/dist-packages/bzrlib/transform.pyRWscC@sx|D]}|j|}|jj||j|=||jkrIqn|j|}tj|||jj|xE|j|D]4}|j|}||t	|}||j|<qWqWdS(sFix limbo names so that the right final path is produced.

        This means we outsmarted ourselves-- we tried to avoid renaming
        these files later by creating them with their final names in their
        final parents.  But now the previous name or parent is no longer
        suitable, so we have to rename them.

        Even for trans_ids that have no new contents, we must remove their
        entries from _limbo_files, because they are now stale.
        N(
RfRgRR.RxRtrenameRt_limbo_descendantsRh(R&RRTtold_pathtnew_patht
descendantt	desc_path((s4/usr/lib/python2.7/dist-packages/bzrlib/transform.pyRys



cC@sLt|jj|g}x*t|D]}|j|j|q(W|S(s@Return the set of trans_ids whose limbo paths descend from this.(R0RhRnRlRR}(R&RTtdescendantsR((s4/usr/lib/python2.7/dist-packages/bzrlib/transform.pyR}
scC@s|j|}t|d}z$t|j|d|j|Wd|jX|j||j||t|dk	r|t
j|f|j|<ndS(sPSchedule creation of a new file.

        :seealso: new_file.

        :param contents: an iterator of strings, all of which will be written
            to the target destination.
        :param trans_id: TreeTransform handle
        :param mode_id: If not None, force the mode of the target file to match
            the mode of the object referenced by mode_id.
            Otherwise, we will try to preserve mode bits of an existing file.
        :param sha1: If the sha1 of this content is already known, pass it in.
            We can use it to prevent future sha1 computations.
        twbRN(
RxtopenR R.t
writelinestcloset
_set_mtimet	_set_modeRR;RtlstatR/(R&RRTtmode_idRRRtf((s4/usr/lib/python2.7/dist-packages/bzrlib/transform.pyRs
cC@s8t|j|d}z|jSWd|jXdS(Ntrb(RRxt	readlinesR(R&RTtcur_file((s4/usr/lib/python2.7/dist-packages/bzrlib/transform.pyRH1scC@stj|j|S(N(RtreadlinkRx(R&RT((s4/usr/lib/python2.7/dist-packages/bzrlib/transform.pyRN8scC@sA|jdkr!tj|_ntj||j|jfdS(stAll files that are created get the same mtime.

        This time is set by the first object to be created.
        N(RjR;ttimeRtutime(R&R{((s4/usr/lib/python2.7/dist-packages/bzrlib/transform.pyR;scC@s|j|}ytj||Wn:tk
r_}|jtjkrMntj|nXyt|j	|dWntj
|nXdS(s Schedule creation of a hard linkRN(RxRtlinkRnRotEPERMRtHardLinkNotSupportedR R.tunlink(R&R{RTRRRs((s4/usr/lib/python2.7/dist-packages/bzrlib/transform.pytcreate_hardlinkDs
cC@s-tj|j|t|j|ddS(sOSchedule creation of a new directory.

        See also new_directory.
        RN(RtmkdirRxR R.(R&RT((s4/usr/lib/python2.7/dist-packages/bzrlib/transform.pyR`UscC@s~tr8tj||j|t|j|dnByt|j|}Wntk
rjd}nXt
d|dS(sqSchedule creation of a new symbolic link.

        target is a bytestring.
        See also new_symlink.
        RR{N(RRRRxR R.RRRR;R(R&RRTR{((s4/usr/lib/python2.7/dist-packages/bzrlib/transform.pyR]s	

cC@s|j|=||jkr&|j|=n|jj|}|dk	rh|j||j|=|j|=nt|j|dS(s)Cancel the creation of new file contents.N(	R.R/RhRnR;RyRiRRx(R&RTR((s4/usr/lib/python2.7/dist-packages/bzrlib/transform.pyRoms




cC@s2|jj}|jd}||||dS(Nsbzr.transform.orphan_policy(R*tget_config_stackRn(R&RTRtconft
handle_orphan((s4/usr/lib/python2.7/dist-packages/bzrlib/transform.pyR{sN(R'R(R_R;RR#RFRuRxRvRWRyR}RRHRNRRR`RRoR(((s4/usr/lib/python2.7/dist-packages/bzrlib/transform.pyRcs&	"															tOrphaningErrorcB@seZeZdZdZRS(s(Error while orphaning %s in %s directorycC@s&tjj|||_||_dS(N(RtBzrErrorR#torphanRS(R&RRS((s4/usr/lib/python2.7/dist-packages/bzrlib/transform.pyR#s	(R'R(Rtinternal_errort_fmtR#(((s4/usr/lib/python2.7/dist-packages/bzrlib/transform.pyRstOrphaningForbiddencB@seZdZdZRS(s*Policy: %s doesn't allow creating orphans.cC@stjj|||_dS(N(RRR#tpolicy(R&R((s4/usr/lib/python2.7/dist-packages/bzrlib/transform.pyR#s(R'R(RR#(((s4/usr/lib/python2.7/dist-packages/bzrlib/transform.pyRscC@sd}|j|}|j|dkr:|j|n|j|}|j|}|j||}|j|||tj	dt
|||fdS(s.See TreeTransformBase.new_orphan.

    This creates a new orphan in the `bzr-orphans` dir at the root of the
    `TreeTransform`.

    :param tt: The TreeTransform orphaning `trans_id`.

    :param orphan_id: The trans id that should be orphaned.

    :param parent_id: The orphan parent trans id.
    sbzr-orphanss%s has been orphaned in %sN(RyRiR;R`R9R[RRWRtwarningR(tttt	orphan_idRtorphan_dir_basenametod_idRtactual_nameRP((s4/usr/lib/python2.7/dist-packages/bzrlib/transform.pytmove_orphans

	cC@stddS(srSee TreeTransformBase.new_orphan.

    This refuses to create orphan, letting the caller handle the conflict.
    tneverN(R(RRR((s4/usr/lib/python2.7/dist-packages/bzrlib/transform.pyt
refuse_orphanstconflicts>Leave orphans in place and create a conflict on the directory.tmoves,Move orphans into the bzr-orphans directory.sbzr.transform.orphan_policythelps6Policy for orphaned files during transform operations.tinvalidRt
TreeTransformcB@s}eZdZddZdZdZdZdZdZ	e
dddZdZd	Z
d
ZdZRS(
s
Represent a tree transformation.

    This object is designed to support incremental generation of the transform,
    in any order.

    However, it gives optimum performance when parent directories are created
    before their contents.  The transform is then able to put child files
    directly in their parent directory, avoiding later renames.

    It is easy to produce malformed transforms, but they are generally
    harmless.  Attempting to apply a malformed transform will cause an
    exception to be raised before any modifications are made to the tree.

    Many kinds of malformed transforms can be corrected with the
    resolve_conflicts function.  The remaining ones indicate programming error,
    such as trying to create a file with no path.

    Two sets of file creation methods are supplied.  Convenience methods are:
     * new_file
     * new_directory
     * new_symlink

    These are composed of the low-level methods:
     * create_path
     * create_file or create_directory or create_symlink
     * version_file
     * set_executability

    Transform/Transaction ids
    -------------------------
    trans_ids are temporary ids assigned to all files involved in a transform.
    It's possible, even common, that not all files in the Tree have trans_ids.

    trans_ids are used because filenames and file_ids are not good enough
    identifiers; filenames change, and not all files have file_ids.  File-ids
    are also associated with trans-ids, so that moving a file moves its
    file-id.

    trans_ids are only valid for the TreeTransform that generated them.

    Limbo
    -----
    Limbo is a temporary directory use to hold new versions of files.
    Files are added to limbo by create_file, create_directory, create_symlink,
    and their convenience variants (new_*).  Files may be removed from limbo
    using cancel_creation.  Files are renamed from limbo into their final
    location as part of TreeTransform.apply

    Limbo must be cleaned up, by either calling TreeTransform.apply or
    calling TreeTransform.finalize.

    Files are placed into limbo inside their parent directories, where
    possible.  This reduces subsequent renames, and makes operations involving
    lots of files faster.  This optimization is only possible if the parent
    directory is created *before* creating any of its children, so avoid
    creating children before parents, where possible.

    Pending-deletion
    ----------------
    This temporary directory is used by _FileMover for storing files that are
    about to be deleted.  In case of rollback, the files will be restored.
    FileMover does not delete files until it is sure that a rollback will not
    happen.
    cC@s|jy`tj|jjd}tj|tjtj|jjd}tj|tj	Wn|j
nXi|_i|_t
j|||||j||_dS(sNote: a tree_write lock is taken on the tree.

        Use TreeTransform.finalize() to release the lock (can be omitted if
        TreeTransform.apply() called).
        tlimbospending-deletionN(tlock_tree_writeturlutilstlocal_path_from_urlt
_transportRRtensure_empty_directory_existsRt
ExistingLimbotExistingPendingDeletionRMt
_realpathst	_relpathsRcR#RCRe(R&RRBRktdeletiondir((s4/usr/lib/python2.7/dist-packages/bzrlib/transform.pyR#	s(


		
cC@s|jj|}||jkr,|j|Stjj|\}}||jkrotjj||j|<n|j|}t||}||jkrt|j||}|j	d}n|jj
|}||j|<|S(s$Get the canonical tree-relative paths/\(R*RRRR{tsplitRtrealpathRtrstriptrelpath(R&R{tabsRRR((s4/usr/lib/python2.7/dist-packages/bzrlib/transform.pyR(s

cC@sX|jj|}|dkr"dSyt|jj|SWntjk
rSdSXdS(syDetermine the file kind in the working tree.

        :returns: The file kind or None if the file does not exist
        N(R9RnR;RR*RRR;(R&RTR{((s4/usr/lib/python2.7/dist-packages/bzrlib/transform.pyR;scC@s|dkr|}ny|j|}Wntk
r:dSXy"tj|jj|j}Wn5tk
r}|j	t	j
t	jfkrdSnX||rtj
|j||ndS(sSet the mode of new file contents.
        The mode_id is the existing file to get the mode from (often the same
        as trans_id).  The operation is only performed if there's a mode match
        according to typefunc.
        N(R;R9RRRR*RRRnRoRptENOTDIRRRRx(R&RTRttypefuncR~tmodeRs((s4/usr/lib/python2.7/dist-packages/bzrlib/transform.pyRHs	
"cc@sy|j|}Wntk
r%dSXytj|jj|}WnDtk
r}tj|p~|j	t	j
t	jfksndSXxC|D];}t||}|jj
|rqn|j|VqWdS(s1Iterate through the entry's tree children, if anyN(R9RRtlistdirR*RRnRt_is_error_enotdirRoRptESRCHRtis_control_filenameRy(R&RR{RRsRvt	childpath((s4/usr/lib/python2.7/dist-packages/bzrlib/transform.pyRZbs 

cC@sm|jj|}t}|jj|dkr|jj|}|dk	r||jkrt|j|<i|j|<t	}q|j
r|j|j||dfkrt	}qqxX|j|jD]:\}}||krqn|j|jkrPqqWt	}qn|s.t
j||St|j||}|j|j|||j||<|S(spGenerate a limbo path using the final path if possible.

        This optimizes the performance of applying the tree transform by
        avoiding renames.  These renames can be avoided only when the parent
        directory is already scheduled for creation.

        If the final path cannot be used, falls back to using the trans_id as
        the relpath.
        RN(R-RnR>R.R,R;RhR0RiRRARfRRcRvRRfR(R&RTRStuse_direct_pathtfilenamet
l_filenamet
l_trans_idRw((s4/usr/lib/python2.7/dist-packages/bzrlib/transform.pyRvvs4

		cC@sx%tjdD]}||j|qW|s;|jntjj}z|dkr|jt	ddd|j
}d}n|}d}|dkrt}n|}yb|jt	dd|d||j||jt	dd|d||j
|}	Wn|jnX|jWd|jX|j|jdkrg|D]}
|
ddkrb|
^qb}n|jj||jt|_|jt|	|jS(sApply all changes to the inventory and filesystem.

        If filesystem or inventory conflicts are present, MalformedTransform
        will be thrown.

        If apply succeeds, finalize is not necessary.

        :param no_conflicts: if True, the caller guarantees there are no
            conflicts, so no check is made.
        :param precomputed_delta: An inventory delta to use instead of
            calculating one.
        :param _mover: Supply an alternate FileMover, for testing
        t
pre_transformsApply phaseiiiNRX(RRLR*Rtuit
ui_factorytnested_progress_barR;Rtgettextt_generate_inventory_deltat
_FileMovert_apply_removalst_apply_insertionstrollbacktapply_deletionstfinishedRYRbtapply_inventory_deltat_apply_observed_sha1sRR?RFR!R%(R&tno_conflictstprecomputed_deltat_moverRNtchild_pbtinventory_deltatoffsettmoverR$Rs((s4/usr/lib/python2.7/dist-packages/bzrlib/transform.pytapplys@
	!
!
,
	
c@sg}tjj}j}t|tj}zxtjD]\}}|ddkr|jtd||n|j	krj
j}nj|}|j
krqMnj|}|j|d|dfqMWtfd|D}	j
j|	j}
td|
D}i}xt|D]\}\}}|ddkr|jtd|tj|n|	|}|dkrqQnt}
j|}|dkrj
j|}nj|}|	j|}|dkr*j|}n|jkrutj|j|jj|dj|}n!tj|j |||}|j|j!}j"j|}|dk	r||_#n|j|||j!|fqQWWd|j$X|S(s6Generate an inventory delta for the current transform.i
is
removing filec3@s*|] \}}|j|fVqdS(N(RY(RtpR(R&(s4/usr/lib/python2.7/dist-packages/bzrlib/transform.pys	<genexpr>scs@s$|]\}}|j|fVqdS(N(Rd(RRRs((s4/usr/lib/python2.7/dist-packages/bzrlib/transform.pys	<genexpr>ssadding fileN(%RRRRRhR7t	enumerateRRR=R*R:RkR6R9RR;RDR|RmR>RiRR\RnRYR3Rt
TreeReferenceR,R-t
make_entryR[RdR2RR(R&RRRt
total_entriestnumRTRdR{tnew_path_file_idstentriest	old_pathstfinal_kindstneeds_entryRRtparent_file_idt	new_entryR~R((R&s4/usr/lib/python2.7/dist-packages/bzrlib/transform.pyRsj

	

	c
C@sht|jj}|jdttjj}z"xt|D]
\}\}}|dkrhqDn|j	t
d|t||jj
|}||jkrtjj|j|}|j||qD||jks||jkrDy|j||j|Wn.tjk
r>}	|	jtjkrNqNqQX|jd7_qDqDWWd|jXdS(sDPerform tree operations that remove directory/inventory names.

        That is, delete files that are to be deleted, and put any files that
        need renaming into limbo.  This must be done in strict child-to-parent
        order.

        If inventory_delta is None, no inventory delta generation is performed.
        RlRXs
removing fileiN(RlR8RfRRRRRRRRRhR*RR1RR{RLRet
pre_deleteR,R-R|RxRtTransformRenameFailedRoRpR%R(
R&Rt
tree_pathsRRR{RTt	full_pathtdelete_pathRs((s4/usr/lib/python2.7/dist-packages/bzrlib/transform.pyRs*	
c@sjdt}g}tfd|D}tjj}zx|t|D]n\}\}}|ddkr|jtd|t	|nj
j|}	|jkry|j
j||	Wn.tjk
r}
|
jtjkrqqXjd7_n|jks6j|rX|jkrX|j|	qXn|jkrzj||n|jkrSj|\}}tj|	}
||
fj|<qSqSWWd|jXx0|D](\}}|jkrj|=qqWjj|S(sxPerform tree operations that insert directory/inventory names.

        That is, create any files that need to be created, and restore from
        limbo any files that needed renaming.  This must be done in strict
        parent-to-child order.

        If inventory_delta is None, no inventory delta is calculated, and
        no list of modified paths is returned.
        Rc3@s*|] \}}|j|fVqdS(N(RY(RRR(R&(s4/usr/lib/python2.7/dist-packages/bzrlib/transform.pys	<genexpr>Csi
isadding fileiN(RRRDRRRRRRRhR*RRR|RxRRRoRpR%R.RRR2RR/RRRRftclear(R&RRR$RRRR{RTRRsto_sha1to_st_valtst((R&s4/usr/lib/python2.7/dist-packages/bzrlib/transform.pyR7sB

"

cC@sUt|}xB|jjD]1\}}|j|}|jjd||qWdS(s5After we have finished renaming everything, update observed sha1s

        This has to be done after self._tree.apply_inventory_delta, otherwise
        it doesn't know anything about the files we are updating. Also, we want
        to do this as late as possible, so that most entries end up cached.
        N(RR/RfRR*t_observed_sha1R;(R&tpathsRTtobservedR{((s4/usr/lib/python2.7/dist-packages/bzrlib/transform.pyRksN(R'R(R_R;R#RRRRZRvR>RRRRR(((s4/usr/lib/python2.7/dist-packages/bzrlib/transform.pyRs@		
			03	<	"	4tTransformPreviewcB@sJeZdZdedZdZdZdZdZ	dZ
RS(sA TreeTransform for generating preview trees.

    Unlike TreeTransform, this version works when the input tree is a
    RevisionTree, rather than a WorkingTree.  As a result, it tends to ignore
    unversioned files in the input tree.
    cC@s9|jtjdd}tj|||||dS(Ntprefixs
bzr-limbo-(t	lock_readRtmkdtempRcR#(R&RRBRCRk((s4/usr/lib/python2.7/dist-packages/bzrlib/transform.pyR#s
cC@s|S(N((R&R{((s4/usr/lib/python2.7/dist-packages/bzrlib/transform.pyRscC@sQ|jj|}|dkr"dS|jj|d}|dkrMd}n|S(Nitmissing(R9RnR;R*tpath_content_summary(R&RTR{R((s4/usr/lib/python2.7/dist-packages/bzrlib/transform.pyRs	cC@sdS(sSet the mode of new file contents.
        The mode_id is the existing file to get the mode from (often the same
        as trans_id).  The operation is only performed if there's a mode match
        according to typefunc.
        N((R&RTRR((s4/usr/lib/python2.7/dist-packages/bzrlib/transform.pyRscc@sy|j|}Wntk
r%dSX|j|}|dkrEdS|jj|gjd}t|di}x+|D]#}t||}|j	|Vq}WdS(s1Iterate through the entry's tree children, if anyNiR(
R9RRkR;R*R|R}tgetattrRRy(R&RR{RdtentryRRvR((s4/usr/lib/python2.7/dist-packages/bzrlib/transform.pyRZs

cC@st|jdS(N(RR(R&RTR((s4/usr/lib/python2.7/dist-packages/bzrlib/transform.pyRsN(R'R(R_R;RR#RRRRZR(((s4/usr/lib/python2.7/dist-packages/bzrlib/transform.pyRs						RcB@sHeZdZdZdZdZdZdZd7d7dZ	e
dZdZd	Z
d
ZdZe
eed8dZe
dZdZdZdZdZdZdZdZdZdZdZdZdZd7e dZ!dZ"d7dZ#d7e d Z$d!Z%e d7e&d"Z'd#Z(d$Z)d7d%Z*d&Z+d'Z,d7d7d(Z-d7d7d)Z.d7d*Z/d+Z0d,Z1e d7d7d7e&e d-Z2d7d.Z3d7d/Z4e5j6d0Z7d7d1Z8d2d3Z9d4Z:d5Z;d6Z<RS(9s9Partial implementation of Tree to support show_diff_treescC@sk||_t||_d|_g|_i|_i|_i|_t	d|jj
D|_dS(Ncs@s|]}|d|fVqdS(iN((Rtc((s4/usr/lib/python2.7/dist-packages/bzrlib/transform.pys	<genexpr>s(t
_transformRt_final_pathsR;t_PreviewTree__by_parentt_parent_idst_all_children_cachet_path2trans_id_cachet_final_name_cacheRDRt_iter_changes_cache(R&t	transform((s4/usr/lib/python2.7/dist-packages/bzrlib/transform.pyR#s							cC@s&|jj|}|dk	o%|dS(s/Return True if the content of this file changediN(RRnR;(R&Rdtchanges((s4/usr/lib/python2.7/dist-packages/bzrlib/transform.pyt_content_changescC@s=t|jjdd}|dkr9|jjjj}n|S(Nt_repository(RRR*R;R0t
repository(R&trepo((s4/usr/lib/python2.7/dist-packages/bzrlib/transform.pyt_get_repositoryscc@sXxQ|jD]C}y|j|VWq
tjk
rO|jj|Vq
Xq
WdS(N(tget_parent_idst
revision_treeRtNoSuchRevisionInTreeR(R&R((s4/usr/lib/python2.7/dist-packages/bzrlib/transform.pyt_iter_parent_treess
cC@sg|jD]}||j|f^q
}|j||f||j||j}|j}||jkr|jj|n|S(N(Rtget_file_revisiont	add_linesR?Rttextstfallback_versionedfilesR(R&Rdtvft
tree_revisionRtparent_keysRtbase_vf((s4/usr/lib/python2.7/dist-packages/bzrlib/transform.pyt_get_file_revisions+	cC@s@|dkr!|jj|}n|jj|}tj|S(N(R;RRRxRR(R&RdRTRR((s4/usr/lib/python2.7/dist-packages/bzrlib/transform.pyt_stat_limbo_filescC@s+|jdkr$|jj|_n|jS(N(RR;RRm(R&((s4/usr/lib/python2.7/dist-packages/bzrlib/transform.pyt
_by_parentscC@sp|j|\}}}}|dkr6d}t}n-|jj|j|}|j||}||dfS(NR(RR;R>RRYt_path2trans_idt
is_executable(R&RR{RtsizeRtlink_or_sha1Rd((s4/usr/lib/python2.7/dist-packages/bzrlib/transform.pyRs	cC@stS(N(R>(R&((s4/usr/lib/python2.7/dist-packages/bzrlib/transform.pyt	is_lockedscC@s|S(N((R&((s4/usr/lib/python2.7/dist-packages/bzrlib/transform.pyRscC@sdS(N((R&((s4/usr/lib/python2.7/dist-packages/bzrlib/transform.pyRMsiiicC@sttjdS(s5This Tree does not use inventory as its backing data.N(RRR(R&((s4/usr/lib/python2.7/dist-packages/bzrlib/transform.pyRscC@sttjdS(s5This Tree does not use inventory as its backing data.N(RRtroot_inventory(R&((s4/usr/lib/python2.7/dist-packages/bzrlib/transform.pyR'scC@s|jj|jjS(N(RRYRb(R&((s4/usr/lib/python2.7/dist-packages/bzrlib/transform.pyR:sc@sXtjjj}|jfdjjD|jjjj|S(Nc3@s!|]}jj|VqdS(N(RRk(RR(R&(s4/usr/lib/python2.7/dist-packages/bzrlib/transform.pys	<genexpr>s(	R0RR*RRR7RR4Rm(R&ttree_ids((R&s4/usr/lib/python2.7/dist-packages/bzrlib/transform.pyRs
cC@st|jS(N(RR(R&((s4/usr/lib/python2.7/dist-packages/bzrlib/transform.pyt__iter__scC@s_||jjkrtS|tg|jjD]}|jj|^q)krQtS||SdS(N(RR6RR0R7RkR>(R&Rdtfallback_checkRT((s4/usr/lib/python2.7/dist-packages/bzrlib/transform.pyt_has_ids	.cC@s|j||jjjS(N(R+RR*thas_id(R&Rd((s4/usr/lib/python2.7/dist-packages/bzrlib/transform.pyR,&scC@s|j||jjjS(N(R+RR*t
has_or_had_id(R&Rd((s4/usr/lib/python2.7/dist-packages/bzrlib/transform.pyR-)scC@s|jj|t}|tk	r%|St|}|jj}x|D]}x~|j|D]\}|jj|}|dkr|jj	|}||j|<n||krZ|}PqZqZWd|j|<dSqDW||j|<|S(N(
R	RnR"RRRbt
_all_childrenR
R;R[(R&R{RTtsegmentst
cur_parenttcur_segmentRvR[((s4/usr/lib/python2.7/dist-packages/bzrlib/transform.pyR",s$


cC@sRt|tr9|gkr'dg}ntj|}n|jj|j|S(NRX(t
isinstanceRlRRRRYR"(R&R{((s4/usr/lib/python2.7/dist-packages/bzrlib/transform.pyRBs
cC@sP|jj|}y|jj|SWn#tk
rKtj||nXdS(N(RRRt_determine_pathRRtNoSuchId(R&RdRT((s4/usr/lib/python2.7/dist-packages/bzrlib/transform.pyRxIs

cC@s|jj|}|dk	r"|St|jj|}|j|jjj|j	|j
j|g||j|<|S(N(RRnR;R0RRZRR-RRR!(R&RTR((s4/usr/lib/python2.7/dist-packages/bzrlib/transform.pyR.Ps
cc@sA|jj|}x(|j|D]}|jj|Vq"WdS(N(RRR.RY(R&RdRTtchild_trans_id((s4/usr/lib/python2.7/dist-packages/bzrlib/transform.pyt
iter_children[sc#@stfdjjjD}|jjj|jjjx:|D]2}jj|dkrUj	j
|VqUqUWdS(Nc3@s!|]}jj|VqdS(N(RRy(RR(R&(s4/usr/lib/python2.7/dist-packages/bzrlib/transform.pys	<genexpr>as(R0RR*textrasRR.R7RYR;RR3(R&tpossible_extrasRT((R&s4/usr/lib/python2.7/dist-packages/bzrlib/transform.pyR7`s
c	c@sx|D]\}}|jj|}|dkr7qn|dk	rU||krUqn|jj|}|dkr|jjj|}ntj||jj|||}||fVqWdS(N(	RRYR;RiR*RRRR[(	R&tordered_entriestspecific_file_idst
yield_parentsRTRRdRR((s4/usr/lib/python2.7/dist-packages/bzrlib/transform.pyt_make_inv_entriesiscC@stg}g}xt|dkr|j}|jj|}t|j|}tt||j	j
|}|jd|j|j
t|x!|D]}|j||fqWqW|S(NiR(RgRhR_RRYRlR.RDtzipRRRRnRtreversedR(R&ttodotordered_idsRSRRRRT((s4/usr/lib/python2.7/dist-packages/bzrlib/transform.pyt_list_files_by_dir{s	!
cc@sp|j||jj|}g|j|D]}||f^q/}x"|j|D]\}}|VqWWdS(N(RxRRR.R<(R&RdR{RTR5R?R((s4/usr/lib/python2.7/dist-packages/bzrlib/transform.pytiter_child_entriess
%cc@sV|j}xC|j||d|D])\}}t|jj||fVq%WdS(NR;(RAR<tunicodeRR(R&R:R;R@RRT((s4/usr/lib/python2.7/dist-packages/bzrlib/transform.pyR|scc@s|j|}g}x<|j|D]+}|jj|}|j||fq%Wx:|j|D])\}}t|jj||fVqdWdS(sCReturn path, entry for items in a directory without recursing down.N(	RR6RRRR<RCRR(R&tdir_pathtdir_file_idR@RdRTR((s4/usr/lib/python2.7/dist-packages/bzrlib/transform.pyt_iter_entries_for_dirsc	c@sC|rd}|r|d}n|j}x|D]p\}}|jdkrZ|rZq2n|r|j|suq2n|t|}n|d|j|j|fVq2Wn|dkr|tkrtj	ddt
|j}ddd|j|fVn|j|pd}x.|D]&\}}|d|j|j|fVqWdS(sSee WorkingTree.list_files.t/RXtVRN(
R;R|RRt
startswithRhRRdRRRRgR:RF(	R&tinclude_roottfrom_dirt	recursiveRRR{Rt
root_entry((s4/usr/lib/python2.7/dist-packages/bzrlib/transform.pyt
list_filess(
!cC@s"|jj|}|jj|S(N(RRRi(R&RdRT((s4/usr/lib/python2.7/dist-packages/bzrlib/transform.pyRscC@sL|jj|}y|jj|SWn!tk
rG|jjj|SXdS(N(RRR.RR*R(R&RdRT((s4/usr/lib/python2.7/dist-packages/bzrlib/transform.pyRs

cC@s2|j|s"|jjj|S|j|jS(sSee Tree.get_file_mtime(RRR*tget_file_mtimeR tst_mtime(R&RdR{((s4/usr/lib/python2.7/dist-packages/bzrlib/transform.pyROscC@s|j|jS(N(t
get_file_sizeRd(R&Rt
stat_value((s4/usr/lib/python2.7/dist-packages/bzrlib/transform.pyt
_file_sizescC@s|jj|}|jj|}|dkr4dS||jjkrY|jd|jS|j|dkr|jjj	|SdSdS(sSee Tree.get_file_sizeRRTN(
RRRiR;R.R tst_sizeRR*RQ(R&RdRTR((s4/usr/lib/python2.7/dist-packages/bzrlib/transform.pyRQscC@s|jj|}|jjj|}|dkrF|jjj|S|dkr|j|}zdt|fSWd|j	XndS(NRtSHA1(
RRR.RnR;R*tget_file_verifiertget_fileRR(R&RdR{RRRTRtfileobj((s4/usr/lib/python2.7/dist-packages/bzrlib/transform.pyRVscC@s|jj|}|jjj|}|dkrF|jjj|S|dkr|j|}zt|SWd|j	XndS(NR(
RRR.RnR;R*t
get_file_sha1RWRR(R&RdR{RRRTRRX((s4/usr/lib/python2.7/dist-packages/bzrlib/transform.pyRYscC@s|dkrtS|jj|}y|jj|SWnntk
ry|jjj||SWqtk
r}|j	t	j
krtSqtjk
rtSXnXdS(N(
R;R>RRR2RR*R#RnRoRpRR4(R&RdR{RTRs((s4/usr/lib/python2.7/dist-packages/bzrlib/transform.pyR#s
cC@sR|j|}||jjkr%tS||jjkr;tS|jjj|SdS(N(R"RR.RR1R>R*thas_filename(R&R{RT((s4/usr/lib/python2.7/dist-packages/bzrlib/transform.pyRZ		scC@s_|j|}|j}|jj|}|jj|}|dkr|dksc||jkrgdS|jj|}|\}}}}	nd}	|j	|}
||j
krd}n|dkrtj|
}|j
}|jst}q|jt@}nd}d}|dkr:tj|
jtj}	n|jj||}||||	fS(NRstree-referenceRR(smissingNNN(R"RR9RnR.R;R1R*RRxR3RRRTRuR>RRRRVRt_fs_encR2(R&R{RTRt	tree_pathRtsummaryR$RR%Rwtstatval((s4/usr/lib/python2.7/dist-packages/bzrlib/transform.pyR	s2				c
C@s||jjk	s$|s$|s$|r^tj||jd|d|d|d|d|d|S|rstdn|jjS(sSee InterTree.iter_changes.

        This has a fast path that is only used when the from_tree matches
        the transform tree, and no fancy options are supplied.
        tinclude_unchangedtspecific_filesRBtextra_treestrequire_versionedtwant_unversioneds!want_unversioned is not supported(RR*Rt	InterTreeRRV(R&t	from_treeR_R`RBRaRbRc((s4/usr/lib/python2.7/dist-packages/bzrlib/transform.pyR0	scC@sV|j|s%|jjj||S|jj|}|jj|}t|dS(sSee Tree.get_fileR(RRR*RWRRxR(R&RdR{RTRR((s4/usr/lib/python2.7/dist-packages/bzrlib/transform.pyRWE	s
cC@s|j||dfS(N(RWR;(R&RdR{((s4/usr/lib/python2.7/dist-packages/bzrlib/transform.pytget_file_with_statM	sc	C@s|jj|}|dkr't}nN|d|d|d}}}|ddkr[dS|ddkor|d}|r|jjj|d|}ng}|dkr|S|s|Stj|g|j	|j
|S(NiiiiiRtdefault_revision(RRnR;RRR*t
annotate_itertannotatet
reannotateRWR(	R&RdRgR
tget_oldtchanged_contentt	versionedRtold_annotation((s4/usr/lib/python2.7/dist-packages/bzrlib/transform.pyRhP	s&	cC@sS|j|s"|jjj|S|jj|}|jj|}tj|S(sSee Tree.get_symlink_target(RRR*tget_symlink_targetRRxRR(R&RdR{RTRR((s4/usr/lib/python2.7/dist-packages/bzrlib/transform.pyRoo	s
RXcc@s|jjg}xt|dkr|j}g}g}|jd}|jj|}|jj|}x|j|D]}|jj|}	|jj	|}
|jj|}|jj
|}|dk	r|}
nd}|jjj
|}
|
dkr|j|n|j|	|
|d||
fqW|j|j|ri||f|fVn|jt|d|jjdtqWdS(NiRGtunknownRRRl(RRbRhR_RRRRYR.R[RiR;R*RRRRIRRR(R&RtpendingRRtsubdirsRRRctpath_from_rootRRdRtversioned_kind((s4/usr/lib/python2.7/dist-packages/bzrlib/transform.pytwalkdirsw	s4	
cC@s|jS(N(R(R&((s4/usr/lib/python2.7/dist-packages/bzrlib/transform.pyR	scC@s
||_dS(N(R(R&R8((s4/usr/lib/python2.7/dist-packages/bzrlib/transform.pytset_parent_ids	scC@s|jjj|S(N(RR*tget_revision_tree(R&R((s4/usr/lib/python2.7/dist-packages/bzrlib/transform.pyRw	sN(iii(=R'R(R_R#RRRRR;R RaR!RR&RRMRRRR'R:RR)R+R,R-R"RRxR.R6R7R>R<RARBR|RFRRNRRRORSRQRVRYR#RZRRRWRfR&tCURRENT_REVISIONRhRoRuRRvRw(((s4/usr/lib/python2.7/dist-packages/bzrlib/transform.pyRsn						
																			
				
						cC@s-|dks|dkr|St||SdS(s:Join tree-relative paths, handling the tree root speciallyRXN(R;R(RSRv((s4/usr/lib/python2.7/dist-packages/bzrlib/transform.pyR	sRcB@s2eZdZdZdZdZdZRS(sMake path calculation cheap by memoizing paths.

    The underlying tree must not be manipulated between calls, or else
    the results will likely be incorrect.
    cC@s#tj|i|_||_dS(N(R"R#t_known_pathsR(R&R((s4/usr/lib/python2.7/dist-packages/bzrlib/transform.pyR#	s
	cC@sv||jjks|tkr"dS|jj|}|jj|}||jjkr\|St|j||SdS(NRX(RRbRgR[R\RR(R&RTRRR((s4/usr/lib/python2.7/dist-packages/bzrlib/transform.pyR3	scC@s3||jkr(|j||j|<n|j|S(s.Find the final path associated with a trans_id(RyR3(R&RT((s4/usr/lib/python2.7/dist-packages/bzrlib/transform.pyR	scC@s&g|D]}|j||f^qS(N(R(R&RR((s4/usr/lib/python2.7/dist-packages/bzrlib/transform.pyR	s(R'R(R_R#R3RR(((s4/usr/lib/python2.7/dist-packages/bzrlib/transform.pyR	s
		
	cC@s#t|}|jd|j|S(s4Determine the topological order of the ids in a treeR(RlRRx(Rtfile_ids((s4/usr/lib/python2.7/dist-packages/bzrlib/transform.pyttopology_sorted_ids	scC@s|jzp|jzT|dk	r3|jnzt|||||SWd|dk	ri|jnXWd|jXWd|jXdS(sCreate working tree for a branch, using a TreeTransform.

    This function should be used on empty trees, having a tree root at most.
    (see merge and revert functionality for working with existing trees)

    Existing files are handled like so:

    - Existing bzrdirs take precedence over creating new items.  They are
      created as '%s.diverted' % name.
    - Otherwise, if the content on disk matches the content we are building,
      it is silently replaced.
    - Otherwise, conflict resolution will move the old file to 'oldname.moved'.

    :param tree: The tree to convert wt into a copy of
    :param wt: The working tree that files will be placed into
    :param accelerator_tree: A tree which can be used for retrieving file
        contents more quickly than tree itself, i.e. a workingtree.  tree
        will be used for cases where accelerator_tree's content is different.
    :param hardlink: If true, hard-link files to accelerator_tree, where
        possible.  accelerator_tree must implement abspath, i.e. be a
        working tree.
    :param delta_from_tree: If true, build_tree may use the input Tree to
        generate the inventory delta.
    N(RRR;t_build_treeRM(Rtwttaccelerator_treethardlinktdelta_from_tree((s4/usr/lib/python2.7/dist-packages/bzrlib/transform.pyt
build_tree	s


c$@sxDt|jD]0\}}|dkrtjd|jqqWitjj}tdd|}|j	d
k	r|j	|j	kr|j|j	|jqnt
|}	t}
z|j|	j|j	|j	<tjj}zg}d}t|j}
|r;g}nd
}|
dkrt}x4|jD]#\}}|jd|DqcWnx;t|jD]'\}\}}|jtd|t||
|jd
krqnt}|j}|r|jd
|||fn||kr|j|}t|}|dkrytjj|Wntjk
rxqX|
j |n||
krt!|||||r|	j"|	j#||dkrt$}qqn|j}|j%dkr||	j&|j'|}||<|	j(|||j)||}|rT|	j*||n|||j+f}|j||fnt,|	||||<|r|}|	j#|}t-|	||qqW|d	t|}t.|	||||||Wd
|j/X|jtfd|
Dfd}t0|	d
|} t| dkrld
}nt1| |	}!x!|!D]}"t2j3t4|"qWy|j5|!Wntj6k
rnX|	j7dt$d|}#Wd
|	j8|j/X|#S(sSee build_tree.iRsBuild phaseics@s|]}|dVqdS(iN((RR((s4/usr/lib/python2.7/dist-packages/bzrlib/transform.pys	<genexpr>#
ss
Building treeRRiNc3@s|]}|VqdS(N((RR(t
file_trans_id(s4/usr/lib/python2.7/dist-packages/bzrlib/transform.pys	<genexpr>V
sc@st||S(N(tresolve_checkout(RR(tdivert_trans(s4/usr/lib/python2.7/dist-packages/bzrlib/transform.pyRW
st	pass_funcRR(9RRRtWorkingTreeAlreadyPopulatedtbasedirRRRRR:R;tset_root_idtflushRR0t
next_phaseR<RhRuRR|RRR>RdRRRt
controldirt
ControlDirRtNotBranchErrorRt_content_matchRpRyRRRURRR^R#Rt	text_sha1tnew_by_entryt_reparent_childrent
_create_filesRtresolve_conflictstcook_conflictsRRRCt
add_conflictstUnsupportedOperationRRF($RR}R~RRRt_unusedttop_pbtppRtdivertRBtdeferred_contentsttotalRtexisting_filestdirtfilesR\RtreparentRdttarget_pathRRRTRt
trans_datatnew_trans_idt
old_parentRtresolvert
raw_conflictsRRtresult((RRs4/usr/lib/python2.7/dist-packages/bzrlib/transform.pyR|	s	
		"#		




	


c
C@st||}|j}|dkr.|}	n	|j|dt}
g|
D]H\}}}
}}}}}|
p|d|dksJ||df^qJ}|jrg|D]0\}}|j|gjs||f^q}nt|}g}	d}x.|D]&\}\}}}|j	|}|dkrU|	j
||||ffqn|jtd||||r|j
|j||n|j||}|jr|j|}t||t||}nz|j||d|Wdy|jWntk
rnXX|d7}qW||7}xt|j|	D]\}\\}}}}|jr|j|}t||t||}n|j||d||jtd|||qMWdS(NR_iisAdding file contentsR(RhR*R;RRtsupports_content_filteringtiter_search_rulesR}RDRnRRRRRRWt_content_filter_stackRRRRtAttributeErrorRtiter_files_bytes(RRt
desired_filesRBRR~RRR}tnew_desired_filesRRRRRstdtnRrRst	unchangedtcountRdRTR\Rtaccelerator_pathRtfilters((s4/usr/lib/python2.7/dist-packages/bzrlib/transform.pyRj
sX		R-	
	

+	cC@s:x3|j|D]"}|j|j|||qWdS(N(RZRWR[(RRt
new_parentRv((s4/usr/lib/python2.7/dist-packages/bzrlib/transform.pyR
scC@sE|j}x.||D]"}|j|j|||qW||S(N(RmRWR[(RRRRmRv((s4/usr/lib/python2.7/dist-packages/bzrlib/transform.pyt_reparent_transform_children
s cC@s|j|krtS|jdkr&tS|jdkrxt|d}z#|j||jkrftSWd|jXn4|jdkr|j|tj	|krtSntS(NRRRR(
RR>RRR=treadRRoRR(RRRdRRR((s4/usr/lib/python2.7/dist-packages/bzrlib/transform.pyR
sc
C@s#t}xd|DD]\}}|dkrAt|n|j|drk|d}|d}n|d}|d}|j|}||kr|j|d}	|j|	|||j|d||fq|j|d}	|j|	|||j|d||fqW|S(	Ncs@s|]}|d|fVqdS(iN((RR((s4/usr/lib/python2.7/dist-packages/bzrlib/transform.pys	<genexpr>
sRiis	.divertedsDiverted tos.movedsMoved existing file to(R0RRR\R[RWR(
RRRt
new_conflictstc_typeRRtold_fileR\RP((s4/usr/lib/python2.7/dist-packages/bzrlib/transform.pyR
s(	



c
C@s|j}|j}|dkrd|j|jj}|j|j}|j||||j|S|dkr|j|||j}|dkr|j|j	|n|S|dkr|j
|j}	|j|||	|jStj
||dS(s2Create a new file according to its inventory entryRRstree-referenceRN(s	directorystree-reference(RRRRWRdRR#RRRtreference_revisionRoRRtBadFileKindError(
RRRRRRRRRRTR((s4/usr/lib/python2.7/dist-packages/bzrlib/transform.pyR
s 		c
C@s|j|}|dkr+|j|n|dkr|dkrs|j|}z|j}Wd|jXn|j}|jr|dk	r|j|}	t	||	t
||}n|j||n8|dkr|j|j
||ntd|dS(s
Create new file contents according to tree contents.
    
    :param filter_tree_path: the tree path to use to lookup
      content filters to apply to the bytes output in the working tree.
      This only applies if the working tree supports content filtering.
    RRNRsUnknown kind %r(RR`R;RWRRR*RRRRRRRoR(
RRTRRdtbytestfilter_tree_pathRt	tree_fileR}R((s4/usr/lib/python2.7/dist-packages/bzrlib/transform.pytcreate_from_tree
s$		cC@s)|jdkr%|j|j|ndS(sCSet the executability of a trans_id according to an inventory entryRN(RRR(RRRT((s4/usr/lib/python2.7/dist-packages/bzrlib/transform.pytcreate_entry_executability
scC@s|jtjj}t||}ztdd|}t||||||\}}	|rtjd|j	}tj
|j|nx!|D]}
tj
t|
qW|j|j|j|	Wd|j|j|jX|S(s;Revert a working tree's contents to those of a target tree.sRevert phaseitunversioned_filterN(RRRRRRt_prepare_revert_transformtdeltat_ChangeReportert
is_ignoredtreport_changesRRRRCRRtset_merge_modifiedRMRFR(tworking_treettarget_treet	filenamestbackupsRBtchange_reporterRRRtmerge_modifiedR((s4/usr/lib/python2.7/dist-packages/bzrlib/transform.pytreverts(
	




c	@stjj}z@|dkr-|j}nt|||||||}Wd|jXtjj}zt||fd}	Wd|jXt|	|}
|
|fS(Nc@st||S(N(t
conflict_pass(RR(R(s4/usr/lib/python2.7/dist-packages/bzrlib/transform.pyR<s(	RRRR;Rt_alter_filesRRR(RRRRRRt
basis_treeRRRR((Rs4/usr/lib/python2.7/dist-packages/bzrlib/transform.pyR-s		c.	C@s|dk	r|jn|j|d|d|}|jdkrOt}	nt}	z[g}
xpt|D]b\}\}}
}}}}}}|
\}}|\}}|\}}|\}}|\}}|\}}|	r|dkrqkn|j|} d}!|rt}"|dkr|s.|dkr|j|}#|j	||#kr|dkrw|j
}|jn|j|r|#|j|krt}"qq|dkr|rt}"qqn|dk	r{|"s|j| q{|dk	r{|j|}$|j
||$}%|j|%|$| |j||$}&|ri|ri|j| |j||&n| }!|&} q{n|d	kr|j| |dkr|j||}'|j|'| qq|dkr|j|j|| q|dkr|
j|| |!ff|dkr:|j
}|jn|j|}(|j|r|(|j|kr||kr||=qn
|(||<|"r||kr|j|| qq|dk	rt|qn|r|r|j|| n|r|r|j| n|dk	r||ks7||kr|dkrX|dkrXt})n|j|})|dkr|r|j||)q|j||)| n||krk|dkrk|j|| qkqkW|jrlxt|j|
D]r\}*\\} }!}+|
|*d}|j|},|j|,}-t |+|-t!|,|}+|j"|+| |!qWn9x6|j|
D]%\\} }!}+|j"|+| |!q|W|j#Wd|dk	r|j$nX|S(
NR`RBRRstree-referenceRRXi(s	directorystree-reference(%R;RRR:RR>RRRYRnRR,RpRRWRUR]R^R`tget_reference_revisionRRRoRRRRgReRRRxRRRRRwRM(.RRRRBR`RRRtchange_listt	skip_roottdeferred_filestid_numRdR{RlRmRSRRRRRtwt_pathttarget_versionedtwt_versionedt
target_parentt	wt_parentttarget_nametwt_namettarget_kindtwt_kindttarget_executablet
wt_executableRTRtkeep_contenttwt_sha1Rtbackup_nameRtrevisiontnew_sha1tparent_transtindexRRR((s4/usr/lib/python2.7/dist-packages/bzrlib/transform.pyRCs
	.


		





	(		cC@s|dkrt}nt}tjj}zxitdD][}|jtd|dd|j	}t
|dkr|S|j|||q=Wtd|Wd|jXdS(s<Make many conflict-resolution attempts, but die if they faili
sResolution passiiRN(
R;RR0RRRtrangeRRRRhR
R(RRBRRRR((s4/usr/lib/python2.7/dist-packages/bzrlib/transform.pyRs		cC@st}xd|DD]\}}|dkrg|j|d|j|d|d|dfq|dkr|j|d}|j|dr|d|d}}n|d|d}}|j|d}	|j|	|||j|d||fq|d	kr|d}
x"|j|
sB|j|
}
q!W|j|d
|
|j|
f|j|j|
|j|
|
q|dkru|d}||jkrEt	}|j
|}
|
rt}x@|
D]5}y|j||Wqt
k
rt	}PqXqWn|rr|j||jdd
|fqrqt	}y|j|Wntk
rE|dk	rF|j|}|dkr|j|}n|j|gj\}}|jdkrt}t|||j}xO|D]}|j|d|fqWqB|j|j}|j|j||qFnX|r|j||j|d|fqq|dkr|j|d}|r|j|r|jd|krqqn|j||d|j|d|dfq|dkr|d}|j|}|j|}|j|}|j|d||}t||||dk	r|j|n|j|d|fq|dkr|j|dqqW|S(sResolve some classes of conflicts.

    :param tt: The transform to resolve conflicts in
    :param conflicts: The conflicts to resolve
    :param path_tree: A Tree to get supplemental paths from
    cs@s|]}|d|fVqdS(iN((RR((s4/usr/lib/python2.7/dist-packages/bzrlib/transform.pys	<genexpr>ssduplicate idisUnversioned existing fileiRs.movedsMoved existing file tosparent loopsCancelled movesmissing parentsdeleting parentsNot deletings
Moved to rootsCreated directorysunversioned parentRXsVersioned directorysnon-directory parents.newsversioning no contentsN( R0R]RR\RR[RWRR1RRR>RRRqRR;RYRR|R}RRRbRRRR`R,RR^RRj(RRt	path_treeRRRR\t
existing_fileRRPtcurRTRqRtotcreateRdt_RtmovedRvRRt
parent_parenttparent_nameRt
new_parent_id((s4/usr/lib/python2.7/dist-packages/bzrlib/transform.pyRs	
(






	

cC@s%t||}t|dtjjS(s8Generate a list of cooked conflicts, sorted by file pathR(titer_cook_conflictsRRtConflicttsort_key(RRt
conflict_iter((s4/usr/lib/python2.7/dist-packages/bzrlib/transform.pyRBsc

c@st|}x|D]}|d}|d}|j|d}|j|d}t|dkrtjj|d|d|d|Vq|j|d}|j|d}	tjj|d|d|d|d|d	|	VqWdS(
NiiiitactionR{Rdt
conflict_pathtconflict_file_id(RRRYRhRRtfactory(
RRtfpRRRt
modified_pathtmodified_idtconflicting_pathtconflicting_id((s4/usr/lib/python2.7/dist-packages/bzrlib/transform.pyRHs 


		RcB@s;eZdZdZdZdZdZdZRS(s>Moves and deletes files for TreeTransform, tracking operationscC@sg|_g|_dS(N(tpast_renamestpending_deletions(R&((s4/usr/lib/python2.7/dist-packages/bzrlib/transform.pyR#`s	cC@sytj||Wnjtk
r}|jtjtjfkr\tj|t|ntj	||t||jnX|j
j||fdS(s'Rename a file from one path to another.N(RR|RnRotEEXISTt	ENOTEMPTYRt
FileExistststrRRR(R&tfrom_ttoRs((s4/usr/lib/python2.7/dist-packages/bzrlib/transform.pyR|ds%cC@s$|j|||jj|dS(sRename a file out of the way and mark it for deletion.

        Unlike os.unlink, this works equally well for files and directories.
        :param from_: The current file path
        :param to: A temporary path for the file
        N(R|RR(R&RR	((s4/usr/lib/python2.7/dist-packages/bzrlib/transform.pyRpscC@s{xht|jD]W\}}ytj||Wqtk
rf}tj||t||jqXqWd}d}dS(s,Reverse all renames that have been performedN(
R>RRR|RnRRRRoR;(R&RR	RsRR((s4/usr/lib/python2.7/dist-packages/bzrlib/transform.pyRzs)cC@s.x|jD]}t|q
Wd}d}dS(sApply all marked deletionsN(RRR;(R&R{RR((s4/usr/lib/python2.7/dist-packages/bzrlib/transform.pyRs(R'R(R_R#R|RRR(((s4/usr/lib/python2.7/dist-packages/bzrlib/transform.pyR]s			
	(Wt
__future__RRRoRRRRtbzrlibRt_mod_configRRRRRtglobalst
bzrlib.errorsR	R
RRR
RRtbzrlib.filtersRRtbzrlib.mutabletreeRtbzrlib.osutilsRRRRRRtbzrlib.progressRtbzrlib.symbol_versioningRRRRgR R"R!R)RcRRRRRtRegistrytorphaning_registrytregistert_set_default_keytRegistryOptiontopt_transform_orphanRRt
InventoryTreeRRRR{R;R>RR|RRRRRRRRRRRRRRRR(((s4/usr/lib/python2.7/dist-packages/bzrlib/transform.pyt<module>s.4.	@			
		5	 	+	q	4						}o		

Copyright © 2017 || Recoded By Mr.Bumblebee