~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/branchbuilder.py

  • Committer: Andrew Bennetts
  • Date: 2009-08-07 04:17:51 UTC
  • mto: This revision was merged to the branch mainline in revision 4608.
  • Revision ID: andrew.bennetts@canonical.com-20090807041751-0vhb0y0g7k49hr45
Review comments from John.

Show diffs side-by-side

added added

removed removed

Lines of Context:
21
21
    commit,
22
22
    errors,
23
23
    memorytree,
24
 
    revision,
25
24
    )
26
25
 
27
26
 
104
103
        finally:
105
104
            tree.unlock()
106
105
 
107
 
    def _do_commit(self, tree, message=None, message_callback=None, **kwargs):
 
106
    def _do_commit(self, tree, message=None, **kwargs):
108
107
        reporter = commit.NullCommitReporter()
109
 
        if message is None and message_callback is None:
 
108
        if message is None:
110
109
            message = u'commit %d' % (self._branch.revno() + 1,)
111
 
        return tree.commit(message, message_callback=message_callback,
 
110
        return tree.commit(message,
112
111
            reporter=reporter,
113
112
            **kwargs)
114
113
 
163
162
 
164
163
    def build_snapshot(self, revision_id, parent_ids, actions,
165
164
        message=None, timestamp=None, allow_leftmost_as_ghost=False,
166
 
        committer=None, timezone=None, message_callback=None):
 
165
        committer=None, timezone=None):
167
166
        """Build a commit, shaped in a specific way.
168
167
 
169
168
        :param revision_id: The handle for the new commit, can be None
176
175
            ('rename', ('orig-path', 'new-path'))
177
176
        :param message: An optional commit message, if not supplied, a default
178
177
            commit message will be written.
179
 
        :param message_callback: A message callback to use for the commit, as
180
 
            per mutabletree.commit.
181
178
        :param timestamp: If non-None, set the timestamp of the commit to this
182
179
            value.
183
180
        :param timezone: An optional timezone for timestamp.
187
184
        :return: The revision_id of the new commit
188
185
        """
189
186
        if parent_ids is not None:
190
 
            if len(parent_ids) == 0:
191
 
                base_id = revision.NULL_REVISION
192
 
            else:
193
 
                base_id = parent_ids[0]
 
187
            base_id = parent_ids[0]
194
188
            if base_id != self._branch.last_revision():
195
189
                self._move_branch_pointer(base_id,
196
190
                    allow_leftmost_as_ghost=allow_leftmost_as_ghost)
250
244
            for file_id, content in new_contents.iteritems():
251
245
                tree.put_file_bytes_non_atomic(file_id, content)
252
246
            return self._do_commit(tree, message=message, rev_id=revision_id,
253
 
                timestamp=timestamp, timezone=timezone, committer=committer,
254
 
                message_callback=message_callback)
 
247
                timestamp=timestamp, timezone=timezone, committer=committer)
255
248
        finally:
256
249
            tree.unlock()
257
250