~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/branchbuilder.py

Allow for BranchBuilder.build_snapshot to accept parent_ids = [], rather than ['null:'].

Show diffs side-by-side

added added

removed removed

Lines of Context:
187
187
        :return: The revision_id of the new commit
188
188
        """
189
189
        if parent_ids is not None:
190
 
            base_id = parent_ids[0]
 
190
            if len(parent_ids) == 0:
 
191
                base_id = revision.NULL_REVISION
 
192
            else:
 
193
                base_id = parent_ids[0]
191
194
            if base_id != self._branch.last_revision():
192
195
                self._move_branch_pointer(base_id,
193
196
                    allow_leftmost_as_ghost=allow_leftmost_as_ghost)
198
201
            tree = memorytree.MemoryTree.create_on_branch(self._branch)
199
202
        tree.lock_write()
200
203
        try:
201
 
            if parent_ids == [revision.NULL_REVISION]:
202
 
                tree.set_parent_ids([],
203
 
                    allow_leftmost_as_ghost=allow_leftmost_as_ghost)
204
 
            elif parent_ids is not None:
 
204
            if parent_ids is not None:
205
205
                tree.set_parent_ids(parent_ids,
206
206
                    allow_leftmost_as_ghost=allow_leftmost_as_ghost)
207
207
            # Unfortunately, MemoryTree.add(directory) just creates an