-=[ Mr. Bumblebee ]=-
_Indonesia_

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

ó
€YPc@@sŽddlmZddlZddlZddlmZeeƒdƒdefd„ƒYZdefd„ƒYZ	d	efd
„ƒYZ
dS(i(tabsolute_importN(tlazy_importsa
from bzrlib import (
    bencode,
    errors,
    merge,
    merge3,
    pack,
    transform,
)
tShelfCreatorcB@sÑeZdZdd„Zd„Zd„Zd„Zd„Zd„Z	d„Z
ed„ƒZd	„Z
d
„Zd„Zdd„Zd
„Zd„Zd„Zedd„ƒZdd„Zedd„ƒZRS(s5Create a transform to shelve objects and its inverse.cC@s¯||_tj|ƒ|_yv||_tj|jƒ|_y:i|_i|_i|_	|j
|jd|ƒ|_
Wn|jjƒ‚nXWn|jjƒ‚nXdS(s‘Constructor.

        :param work_tree: The working tree to apply changes to. This is not
            required to be locked - a tree_write lock will be taken out.
        :param target_tree: The tree to make the working tree more similar to.
            This is not required to be locked - a read_lock will be taken out.
        :param file_list: The files to make more similar to the target.
        tspecific_filesN(t	work_treet	transformt
TreeTransformtwork_transformttarget_treetTransformPreviewtshelf_transformtrenamestcreationtdeletiontiter_changestfinalize(tselfRRt	file_list((s0/usr/lib/python2.7/dist-packages/bzrlib/shelf.pyt__init__&s"						

c	c@s%x|jD]\}}}}}}}}|ddkrN|ddkrNq
n|ddkrt|ddkrtq
n|ddks”|dtkrÕ|d|d|d|f|j|<d||d|dfVq
|ddksõ|dtkr6|d|d|d|f|j|<d||d|dfVq
|d|dks^|d|dkrƒ||f|j|<d|f|Vn|d|dkrºd||d|d|dfVq
|ddkr	|jj|ƒ}	|jj|ƒ}
d	||d|	|
fVq
|r
d
|fVq
q
WdS(söIterable of tuples describing shelvable changes.

        As well as generating the tuples, this updates several members.
        Tuples may be::

           ('add file', file_id, work_kind, work_path)
           ('delete file', file_id, target_kind, target_path)
           ('rename', file_id, target_path, work_path)
           ('change kind', file_id, target_kind, work_kind, target_path)
           ('modify text', file_id)
           ('modify target', file_id, target_target, work_target)
        iitsadd filesdelete filetrenameschange kindtsymlinks
modify targetsmodify textN(	RtNonetFalseRR
RRtget_symlink_targetR(Rtfile_idtpathstchangedt	versionedtparentstnamestkindt
executablett_targettw_target((s0/usr/lib/python2.7/dist-packages/bzrlib/shelf.pytiter_shelvableAs4
%    (#cC@sÌ|ddkr$|j|dƒn¤|ddkrH|j|dƒn€|ddkrl|j|dƒn\|ddkr|j|dƒn8|ddkr´|j|dƒntd	|dƒ‚d
S(s-Shelve a change in the iter_shelvable format.iRisdelete filesadd fileschange kindsmodify texts
modify targetsUnknown change kind: "%s"N(schange kindsmodify text(t
shelve_renametshelve_deletiontshelve_creationtshelve_content_changetshelve_modify_targett
ValueError(Rtchange((s0/usr/lib/python2.7/dist-packages/bzrlib/shelf.pyt
shelve_changepscC@s4d}x!|jƒD]}|j|ƒqW|dk	S(slShelve all changes.

        :return: True if changes were shelved, False if there were no changes.
        N(RR#R+(RR*((s0/usr/lib/python2.7/dist-packages/bzrlib/shelf.pyt
shelve_allscC@s›|j|\}}|jj|ƒ}|jj|dƒ}|jj|d||ƒ|jj|ƒ}|jj|dƒ}|jj|d||ƒdS(sjShelve a file rename.

        :param file_id: The file id of the file to shelve the renaming of.
        iiN(RRttrans_id_file_idtadjust_pathR
(RRRRt
w_trans_idtwork_parentt
s_trans_idtshelf_parent((s0/usr/lib/python2.7/dist-packages/bzrlib/shelf.pyR$‰scC@s’|jj|ƒ}|jj|ƒ}|jj|ƒ|jj||ƒ|jj|ƒ}|jj|ƒ}|jj|ƒ|jj||ƒdS(sÕShelve a change of symlink target.

        :param file_id: The file id of the symlink which changed target.
        :param new_target: The target that the symlink should have due
            to shelving.
        N(RRRR-tdelete_contentstcreate_symlinkRR
(RRt
new_targetR/t
old_targetR1((s0/usr/lib/python2.7/dist-packages/bzrlib/shelf.pyR(—scC@s€|jj|ƒ}|jj|ƒ|jj||ƒ|jj|ƒ}|jj|ƒ|j||ƒ}|jj||ƒdS(sÔShelve text changes to a file, using provided lines.

        :param file_id: The file id of the file to shelve the text of.
        :param new_lines: The lines that the file should have due to shelving.
        N(RR-R3tcreate_fileR
t_inverse_lines(RRt	new_linesR/R1t
inverse_lines((s0/usr/lib/python2.7/dist-packages/bzrlib/shelf.pytshelve_lines¨scC@s6|j|ƒ}|j|ƒtj||||ƒdS(N(R-R3Rtcreate_from_tree(tttttreeRttrans_id((s0/usr/lib/python2.7/dist-packages/bzrlib/shelf.pyt_content_from_tree·s
cC@s6|j|j|j|ƒ|j|j|j|ƒdS(sšShelve a kind change or binary file content change.

        :param file_id: The file id of the file to shelve the content change
            of.
        N(R@RRR
R(RR((s0/usr/lib/python2.7/dist-packages/bzrlib/shelf.pyR'½sc	C@sS|j|\}}}}|d}|j|j||j|j||||ƒdS(sšShelve creation of a file.

        This handles content and inventory id.
        :param file_id: The file_id of the file to shelve creation of.
        iN(Rt_shelve_creationRRR
(RRRtnametparentRtversion((s0/usr/lib/python2.7/dist-packages/bzrlib/shelf.pyR&Æs
cC@s†|j|\}}}}|jj|ƒ}|jj|ƒsFd}n|d}|j|j||j|j||||d|ƒdS(sšShelve deletion of a file.

        This handles content and inventory id.
        :param file_id: The file_id of the file to shelve deletion of.
        it
existing_pathN(	R
Rtid2pathRthas_filenameRRAR
R(RRRRBRCRRERD((s0/usr/lib/python2.7/dist-packages/bzrlib/shelf.pyR%Òs	c

C@s|j|ƒ}
|dk	r7|dk	r7|j|
ƒn|j|
ƒ|	dk	rb|j|	ƒ}n|j|ƒ}|dk	ræ|j|ƒ}|j|||ƒ|	dkræ|dkrÊ|jd|ƒqãtj||||ƒqæn|rÿ|j	||ƒndS(NR(
R-RR3tunversion_filettrans_id_tree_pathR.R7RR<tversion_file(
RR>Rtfrom_transformtto_transformRRBRCRDRER/R1ts_parent_id((s0/usr/lib/python2.7/dist-packages/bzrlib/shelf.pyRAás"
cC@s=|jj|ƒ}|jj|ƒ}tj|||ƒjƒS(sAProduce a version with only those changes removed from new_lines.(Rtget_file_linesRtmerge3tMerge3tmerge_lines(RR9Rttarget_linest
work_lines((s0/usr/lib/python2.7/dist-packages/bzrlib/shelf.pyR8øscC@s|jjƒ|jjƒdS(s0Release all resources used by this ShelfCreator.N(RRR
(R((s0/usr/lib/python2.7/dist-packages/bzrlib/shelf.pyRþs
cC@s|jjƒdS(s!Shelve changes from working tree.N(Rtapply(R((s0/usr/lib/python2.7/dist-packages/bzrlib/shelf.pyRscC@sHi|d6}|dk	r/|jdƒ|d<n|jtj|ƒdƒS(Ntrevision_idsutf-8tmessagetmetadata(smetadata((smetadata(Rtencodetbytes_recordtbencode(t
serializerRURVRW((s0/usr/lib/python2.7/dist-packages/bzrlib/shelf.pytmetadata_records

cC@s8tj|jƒ|jjƒ}|j||j||ƒS(söSerialize the shelved changes to a file.

        :param shelf_file: A file-like object to write the shelf to.
        :param message: An optional message describing the shelved changes.
        :return: the filename of the written file.
        (Rtresolve_conflictsR
Rtget_revision_idt_write_shelf(Rt
shelf_fileRVRU((s0/usr/lib/python2.7/dist-packages/bzrlib/shelf.pytwrite_shelfscC@stjƒ}|j|jƒƒ|j|||ƒ}|j|ƒx$|j|ƒD]}|j|ƒqQW|j|jƒƒdS(N(tpacktContainerSerialisertwritetbeginR\t	serializetend(tclsR`RRURVR[RWtbytes((s0/usr/lib/python2.7/dist-packages/bzrlib/shelf.pyR_s
N(t__name__t
__module__t__doc__RRR#R+R,R$R(R;tstaticmethodR@R'R&R%RAR8RRR\RatclassmethodR_(((s0/usr/lib/python2.7/dist-packages/bzrlib/shelf.pyR#s*	/		
										t	UnshelvercB@sYeZdZd„Zed„ƒZed„ƒZed„ƒZdd„Z
d„ZRS(sUnshelve shelved changes.cC@s(||_||_||_||_dS(sÉConstructor.

        :param tree: The tree to apply the changes to.
        :param base_tree: The basis to apply the tranform to.
        :param message: A message from the shelved transform.
        N(R>t	base_treeRRV(RR>RpRRV((s0/usr/lib/python2.7/dist-packages/bzrlib/shelf.pyR)s			cC@s/tjƒ}|j|jƒƒt|jƒƒS(N(RbtContainerPushParsertaccept_bytestreadtitertread_pending_records(R`tparser((s0/usr/lib/python2.7/dist-packages/bzrlib/shelf.pytiter_records5scC@sr|jƒ\}}|ddkr.tj‚ntj|ƒ}|jdƒ}|dk	rn|jdƒ|d<n|S(NiRWRVsutf-8(smetadata(tnextterrorstShelfCorruptRZtbdecodetgetRtdecode(trecordsRtmetadata_bytesRWRV((s0/usr/lib/python2.7/dist-packages/bzrlib/shelf.pytparse_metadata;scC@sŸ|j|ƒ}|j|ƒ}|d}y|j|ƒ}Wn)tjk
rf|jjj|ƒ}nXtj|ƒ}|j	|ƒ|||||j
dƒƒS(sàCreate an Unshelver from a tree and a shelf file.

        :param tree: The tree to apply shelved changes to.
        :param shelf_file: A file-like object containing shelved changes.
        :return: The Unshelver.
        RURV(RwR€t
revision_treeRytNoSuchRevisionInTreetbrancht
repositoryRR	tdeserializeR|(tklassR>R`R~RWtbase_revision_idRpR=((s0/usr/lib/python2.7/dist-packages/bzrlib/shelf.pytfrom_tree_and_shelfFs

cC@s@|jjƒ}tjj|j|||jƒ}tj|_|S(s.Return a merger that can unshelve the changes.(	Rtget_preview_treetmergetMergertfrom_uncommittedR>RptMerge3Mergert
merge_type(RttaskRtmerger((s0/usr/lib/python2.7/dist-packages/bzrlib/shelf.pytmake_mergerYs
cC@s|jjƒdS(s-Release all resources held by this Unshelver.N(RR(R((s0/usr/lib/python2.7/dist-packages/bzrlib/shelf.pyRasN(RjRkRlRRmRwR€RnRˆRR‘R(((s0/usr/lib/python2.7/dist-packages/bzrlib/shelf.pyRo&s	tShelfManagercB@steZdZd„Zd„Zd„Zd„Zdd„Zd„Z	d„Z
d„Zd	„Zd
„Z
d„ZRS(
s#Maintain a list of shelved changes.cC@s,||_|jdƒ|_|jjƒdS(Ntshelf(R>tclonet	transporttensure_base(RR>R•((s0/usr/lib/python2.7/dist-packages/bzrlib/shelf.pyRis	cC@sd|S(Nsshelf-%d((Rtshelf_id((s0/usr/lib/python2.7/dist-packages/bzrlib/shelf.pytget_shelf_filenamenscC@sdtjdƒ}g}xH|D]@}|j|ƒ}|dk	r|jt|jdƒƒƒqqW|S(Nsshelf-([1-9][0-9]*)i(tretcompiletmatchRtappendtinttgroup(Rt	filenamestmatchert	shelf_idstfilenameR›((s0/usr/lib/python2.7/dist-packages/bzrlib/shelf.pyt
get_shelf_idsqs
#cC@s_|jƒ}|dkr!d}n
|d}|j|ƒ}t|jj|ƒdƒ}||fS(s=Return a file object and id for a new set of shelved changes.itwbN(t
last_shelfRR˜topenR•t
local_abspath(RR¥t
next_shelfR¢R`((s0/usr/lib/python2.7/dist-packages/bzrlib/shelf.pyt	new_shelfzs	
cC@sB|jƒ\}}z|j||ƒWd|jƒX|jƒ|S(s/Store the changes in a ShelfCreator on a shelf.N(R©RatcloseR(RtcreatorRVR¨R`((s0/usr/lib/python2.7/dist-packages/bzrlib/shelf.pytshelve_changes…s
cC@s}|j|ƒ}yt|jj|ƒdƒSWnJtk
rx}|jtjkrV‚nddlm}|j	|ƒ‚nXdS(s‡Return the file associated with a shelf_id for reading.

        :param shelf_id: The id of the shelf to retrive the file for.
        trbi(RyN(
R˜R¦R•R§tIOErrorterrnotENOENTtbzrlibRyt
NoSuchShelfId(RR—R¢teRy((s0/usr/lib/python2.7/dist-packages/bzrlib/shelf.pyt
read_shelfscC@s8|j|ƒ}ztj|j|ƒSWd|jƒXdS(svReturn an unshelver for a given shelf_id.

        :param shelf_id: The shelf id to return the unshelver for.
        N(R´RoRˆR>Rª(RR—R`((s0/usr/lib/python2.7/dist-packages/bzrlib/shelf.pyt
get_unshelverscC@s=|j|ƒ}ztj|ƒ}Wd|jƒXtj|ƒS(s5Return the metadata associated with a given shelf_id.N(R´RoRwRªR€(RR—R`R~((s0/usr/lib/python2.7/dist-packages/bzrlib/shelf.pytget_metadata¨s
cC@s#|j|ƒ}|jj|ƒdS(srDelete the shelved changes for a given id.

        :param shelf_id: id of the shelved changes to delete.
        N(R˜R•tdelete(RR—R¢((s0/usr/lib/python2.7/dist-packages/bzrlib/shelf.pytdelete_shelf±scC@s)|j|jjdƒƒ}|jƒ|S(s!Return a list of shelved changes.t.(R£R•tlist_dirtsort(Rtactive((s0/usr/lib/python2.7/dist-packages/bzrlib/shelf.pytactive_shelves¹s
cC@s.|jƒ}t|ƒdkr&|dSdSdS(s1Return the id of the last-created shelved change.iiÿÿÿÿN(R½tlenR(RR¼((s0/usr/lib/python2.7/dist-packages/bzrlib/shelf.pyR¥¿sN(RjRkRlRR˜R£R©RR¬R´RµR¶R¸R½R¥(((s0/usr/lib/python2.7/dist-packages/bzrlib/shelf.pyR’fs					
						(t
__future__RR¯R™tbzrlib.lazy_importRtglobalstobjectRRoR’(((s0/usr/lib/python2.7/dist-packages/bzrlib/shelf.pyt<module>s		ÿ@

Copyright © 2017 || Recoded By Mr.Bumblebee