Part of bzrlib.branchbuilder View In Hierarchy
A 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.
|Method||__init__||Construct a BranchBuilder on transport.|
|Method||build_commit||Build a commit on the branch.|
|Method||start_series||We will be creating a series of commits.|
|Method||finish_series||Call this after start_series to unlock the various objects.|
|Method||build_snapshot||Build a commit, shaped in a specific way.|
|Method||get_branch||Return the branch created by the builder.|
|Method||_move_branch_pointer||Point self._branch to a different revision id.|
|Method||_flush_pending||Flush the pending actions in 'pending', i.e. apply them to 'tree'.|
|Parameters||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.|
|format||Either a BzrDirFormat, or the name of a format in the controldir format registry for the branch to be built.|
|branch||An already constructed branch to use. This param is mutually exclusive with the transport and format params.|
This makes a commit with no real file content for when you only want to look at the revision graph structure.
|Parameters||commit_kwargs||Arguments to pass through to commit, such as timestamp.|
This allows us to hold open the locks while we are processing.
Make sure to call 'finish_series' when you are done.
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.
|Parameters||revision_id||The handle for the new commit, can be None|
|parent_ids||A list of parent_ids to use for the commit. It can be None, which indicates to use the last commit.|
|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)|
|message||An optional commit message, if not supplied, a default commit message will be written.|
|message_callback||A message callback to use for the commit, as per mutabletree.commit.|
|timestamp||If non-None, set the timestamp of the commit to this value.|
|timezone||An optional timezone for timestamp.|
|committer||An optional username to use for commit|
|allow_leftmost_as_ghost||True if the leftmost parent should be permitted to be a ghost.|
|Returns||The revision_id of the new commit|