/brz/remove-bazaar

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/brz/remove-bazaar

« back to all changes in this revision

Viewing changes to breezy/branchbuilder.py

  • Committer: Jelmer Vernooij
  • Date: 2017-11-16 00:39:04 UTC
  • mto: This revision was merged to the branch mainline in revision 6818.
  • Revision ID: jelmer@jelmer.uk-20171116003904-p6lcb827m6thxbzd
Migrate some build_snapshot code over to having revision_id as keyword argument.

Show diffs side-by-side

added added

removed removed

Lines of Context:
45
45
    >>> from breezy.transport.memory import MemoryTransport
46
46
    >>> builder = BranchBuilder(MemoryTransport("memory:///"))
47
47
    >>> builder.start_series()
48
 
    >>> builder.build_snapshot('rev-id', None, [
 
48
    >>> builder.build_snapshot(None, [
49
49
    ...     ('add', ('', 'root-id', 'directory', '')),
50
 
    ...     ('add', ('filename', 'f-id', 'file', 'content\n'))])
 
50
    ...     ('add', ('filename', 'f-id', 'file', 'content\n'))],
 
51
    ...     revision_id='rev-id')
51
52
    'rev-id'
52
 
    >>> builder.build_snapshot('rev2-id', ['rev-id'],
53
 
    ...     [('modify', ('f-id', 'new-content\n'))])
 
53
    >>> builder.build_snapshot(['rev-id'],
 
54
    ...     [('modify', ('f-id', 'new-content\n'))],
 
55
    ...     revision_id='rev2-id')
54
56
    'rev2-id'
55
57
    >>> builder.finish_series()
56
58
    >>> branch = builder.get_branch()
178
180
        self._tree.unlock()
179
181
        self._tree = None
180
182
 
181
 
    def build_snapshot(self, revision_id, parent_ids, actions,
182
 
        message=None, timestamp=None, allow_leftmost_as_ghost=False,
183
 
        committer=None, timezone=None, message_callback=None):
 
183
    def build_snapshot(self, parent_ids, actions, message=None, timestamp=None,
 
184
            allow_leftmost_as_ghost=False, committer=None, timezone=None,
 
185
            message_callback=None, revision_id=None):
184
186
        """Build a commit, shaped in a specific way.
185
187
 
186
188
        Most of the actions are self-explanatory.  'flush' is special action to
188
190
        (such as unversioning a file-id and re-adding it with a different kind)
189
191
        can be expressed in a way that will clearly work.
190
192
 
191
 
        :param revision_id: The handle for the new commit, can be None
192
193
        :param parent_ids: A list of parent_ids to use for the commit.
193
194
            It can be None, which indicates to use the last commit.
194
195
        :param actions: A list of actions to perform. Supported actions are:
207
208
        :param committer: An optional username to use for commit
208
209
        :param allow_leftmost_as_ghost: True if the leftmost parent should be
209
210
            permitted to be a ghost.
 
211
        :param revision_id: The handle for the new commit, can be None
210
212
        :return: The revision_id of the new commit
211
213
        """
212
214
        if parent_ids is not None: