-=[ Mr. Bumblebee ]=-
_Indonesia_

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

ó
î:ïNc@@sndZddlmZddlmZmZmZmZmZde	fd„ƒYZ
de	fd„ƒYZdS(	s5Utility for create branches with particular contents.i(tabsolute_import(t
controldirtcommitterrorst
memorytreetrevisiont
BranchBuildercB@s‰eZdZd
d
d
d„Zd
ed„Zd
d
d„Zed„Zd„Z	d„Z
d
d
ed
d
d
d„Zd„Zd	„Z
RS(sA BranchBuilder aids creating Branches with particular shapes.

    The expected way to use BranchBuilder is to construct a
    BranchBuilder on the transport you want your branch on, and then call
    appropriate build_ methods on it to get the shape of history you want.

    This is meant as a helper for the test suite, not as a general class for
    real data.

    For instance:

    >>> from bzrlib.transport.memory import MemoryTransport
    >>> builder = BranchBuilder(MemoryTransport("memory:///"))
    >>> builder.start_series()
    >>> builder.build_snapshot('rev-id', None, [
    ...     ('add', ('', 'root-id', 'directory', '')),
    ...     ('add', ('filename', 'f-id', 'file', 'content\n'))])
    'rev-id'
    >>> builder.build_snapshot('rev2-id', ['rev-id'],
    ...     [('modify', ('f-id', 'new-content\n'))])
    'rev2-id'
    >>> builder.finish_series()
    >>> branch = builder.get_branch()

    :ivar _tree: This is a private member which is not meant to be modified by
        users of this class. While a 'series' is in progress, it should hold a
        MemoryTree with the contents of the last commit (ready to be modified
        by the next build_snapshot command) with a held write lock. Outside of
        a series in progress, it should be None.
    cC@s×|dk	rN|dk	r'tdƒ‚n|dk	rBtdƒ‚n||_n||jdƒsm|jdƒn|dkr‚d}nt|tƒr¦tjj	|ƒ}ntj
j|jd|dt
ƒ|_d|_dS(sConstruct a BranchBuilder on transport.

        :param transport: The transport the branch should be created on.
            If the path of the transport does not exist but its parent does
            it will be created.
        :param format: Either a BzrDirFormat, or the name of a format in the
            controldir format registry for the branch to be built.
        :param branch: An already constructed branch to use.  This param is
            mutually exclusive with the transport and format params.
        s/branch and format kwargs are mutually exclusives2branch and transport kwargs are mutually exclusivet.tdefaulttformattforce_new_treeN(tNonetAssertionErrort_branchthastmkdirt
isinstancetstrRtformat_registrytmake_bzrdirt
ControlDirtcreate_branch_conveniencetbasetFalset_tree(tselft	transportR	tbranch((s8/usr/lib/python2.7/dist-packages/bzrlib/branchbuilder.pyt__init__>s"		cK@sÖ|dk	rbt|ƒdkr*tj}n
|d}||jjƒkrb|j|d|ƒqbntjj	|jƒ}|j
ƒzC|dk	r¦|j|d|ƒn|jdƒ|j
||SWd|jƒXdS(s	Build a commit on the branch.

        This makes a commit with no real file content for when you only want
        to look at the revision graph structure.

        :param commit_kwargs: Arguments to pass through to commit, such as
             timestamp.
        itallow_leftmost_as_ghosttN(RtlenRt
NULL_REVISIONR
t
last_revisiont_move_branch_pointerRt
MemoryTreetcreate_on_brancht
lock_writetset_parent_idstaddt
_do_committunlock(Rt
parent_idsRt
commit_kwargstbase_idttree((s8/usr/lib/python2.7/dist-packages/bzrlib/branchbuilder.pytbuild_commit\s 





cK@s]tjƒ}|dkrA|dkrAd|jjƒdf}n|j|d|d||S(Nu	commit %ditmessage_callbacktreporter(RtNullCommitReporterRR
trevno(RR-tmessageR/tkwargsR0((s8/usr/lib/python2.7/dist-packages/bzrlib/branchbuilder.pyR(yscC@sï|jjƒz†|jjƒ\}}yD|jjjƒ}|j|||fgƒ}|jj||ƒWn&tjk
r‘|sˆ‚nd}nXWd|jj	ƒX|j
dk	rëtj
j|jƒ}|jƒ|j
j	ƒ||_
ndS(s.Point self._branch to a different revision id.iN(R
R%tlast_revision_infot
repositoryt	get_graphtfind_distance_to_nulltset_last_revision_infoRtGhostRevisionsHaveNoRevnoR)RRRR#R$(Rtnew_revision_idRt	cur_revnotcur_revision_idtgt	new_revnotnew_tree((s8/usr/lib/python2.7/dist-packages/bzrlib/branchbuilder.pyR"s$
	

cC@sG|jdk	rtdƒ‚ntjj|jƒ|_|jjƒdS(s·We will be creating a series of commits.

        This allows us to hold open the locks while we are processing.

        Make sure to call 'finish_series' when you are done.
        s>You cannot start a new series while a series is already going.N(RRRRR#R$R
R%(R((s8/usr/lib/python2.7/dist-packages/bzrlib/branchbuilder.pytstart_series scC@s|jjƒd|_dS(s;Call this after start_series to unlock the various objects.N(RR)R(R((s8/usr/lib/python2.7/dist-packages/bzrlib/branchbuilder.pyt
finish_series­s
c
C@sz|dk	rbt|ƒdkr*tj}
n
|d}
|
|jjƒkrb|j|
d|ƒqbn|jdk	r}|j}ntj	j
|jƒ}|jƒzÌ|dk	rÁ|j|d|ƒnt
ƒ}xY|D]Q\}
}|
dkro|\}}}}|dkr |jj||fƒq"|jj|ƒ|jj|ƒ|jj|ƒ|dk	r"||j|<q"qÑ|
dkr—|\}}||j|<qÑ|
dkr¶|jj|ƒqÑ|
dkrç|\}}|jj||fƒqÑ|
dkr|j||ƒt
ƒ}qÑtd	|
fƒ‚qÑW|j||ƒ|j|d
|d|d|d
|d|d|	ƒSWd|jƒXdS(sØBuild a commit, shaped in a specific way.

        Most of the actions are self-explanatory.  'flush' is special action to
        break a series of actions into discrete steps so that complex changes
        (such as unversioning a file-id and re-adding it with a different kind)
        can be expressed in a way that will clearly work.

        :param revision_id: The handle for the new commit, can be None
        :param parent_ids: A list of parent_ids to use for the commit.
            It can be None, which indicates to use the last commit.
        :param actions: A list of actions to perform. Supported actions are:
            ('add', ('path', 'file-id', 'kind', 'content' or None))
            ('modify', ('file-id', 'new-content'))
            ('unversion', 'file-id')
            ('rename', ('orig-path', 'new-path'))
            ('flush', None)
        :param message: An optional commit message, if not supplied, a default
            commit message will be written.
        :param message_callback: A message callback to use for the commit, as
            per mutabletree.commit.
        :param timestamp: If non-None, set the timestamp of the commit to this
            value.
        :param timezone: An optional timezone for timestamp.
        :param committer: An optional username to use for commit
        :param allow_leftmost_as_ghost: True if the leftmost parent should be
            permitted to be a ghost.
        :return: The revision_id of the new commit
        iRR't	directorytmodifyt	unversiontrenametflushsUnknown build action: "%s"R3trev_idt	timestampttimezonet	committerR/N(RRRR R
R!R"RRR#R$R%R&t_PendingActionstto_add_directoriestappendtto_add_filestto_add_file_idstto_add_kindstnew_contentstto_unversion_idsR't	to_renamet_flush_pendingt
ValueErrorR(R)(Rtrevision_idR*tactionsR3RIRRKRJR/R,R-tpendingtactiontinfotpathtfile_idtkindtcontenttfrom_relpatht
to_relpath((s8/usr/lib/python2.7/dist-packages/bzrlib/branchbuilder.pytbuild_snapshot²sV



	c	C@s(x|jD]„\}}|dkr~|j|ƒ}|dk	r_||jkr_|jj|ƒn|j|g|gdgƒq
|j||ƒq
Wx'|jD]\}}|j||ƒqœW|jrØ|j	|jƒn|j|j
|j|jƒx-|j
jƒD]\}}|j||ƒqWdS(sBFlush the pending actions in 'pending', i.e. apply them to 'tree'.RRCN(RMtpath2idRRStdiscardR'RRTt
rename_oneRERORPRQRRt	iteritemstput_file_bytes_non_atomic(	RR-RYR\R]told_idR`RaR_((s8/usr/lib/python2.7/dist-packages/bzrlib/branchbuilder.pyRUs	cC@s|jS(s)Return the branch created by the builder.(R
(R((s8/usr/lib/python2.7/dist-packages/bzrlib/branchbuilder.pyt
get_branchsN(t__name__t
__module__t__doc__RRRR.R(R"RARBRbRURi(((s8/usr/lib/python2.7/dist-packages/bzrlib/branchbuilder.pyRs		
		S	RLcB@seZdZd„ZRS(s£Pending actions for build_snapshot to take.

    This is just a simple class to hold a bunch of the intermediate state of
    build_snapshot in single object.
    cC@sFg|_g|_g|_g|_i|_tƒ|_g|_dS(N(RMRORPRQRRtsetRSRT(R((s8/usr/lib/python2.7/dist-packages/bzrlib/branchbuilder.pyR's					(RjRkRlR(((s8/usr/lib/python2.7/dist-packages/bzrlib/branchbuilder.pyRL sN(Rlt
__future__RtbzrlibRRRRRtobjectRRL(((s8/usr/lib/python2.7/dist-packages/bzrlib/branchbuilder.pyt<module>s
(	ÿ

Copyright © 2017 || Recoded By Mr.Bumblebee