~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/commit.py

  • Committer: Martin Pool
  • Date: 2007-02-21 05:34:56 UTC
  • mfrom: (2296 +trunk)
  • mto: This revision was merged to the branch mainline in revision 2309.
  • Revision ID: mbp@sourcefrog.net-20070221053456-vyr6o0ehqnbetrvb
merge trunk, in particular new Branch6 changes

Show diffs side-by-side

added added

removed removed

Lines of Context:
254
254
                # this is so that we still consier the master branch
255
255
                # - in a checkout scenario the tree may have no
256
256
                # parents but the branch may do.
257
 
                first_tree_parent = None
258
 
            master_last = self.master_branch.last_revision()
259
 
            if (master_last is not None and
260
 
                master_last != first_tree_parent):
261
 
                raise errors.OutOfDateTree(self.work_tree)
262
 
    
 
257
                first_tree_parent = bzrlib.revision.NULL_REVISION
 
258
            old_revno, master_last = self.master_branch.last_revision_info()
 
259
            if master_last != first_tree_parent:
 
260
                if master_last != bzrlib.revision.NULL_REVISION:
 
261
                    raise errors.OutOfDateTree(self.work_tree)
 
262
            if self.branch.repository.has_revision(first_tree_parent):
 
263
                new_revno = old_revno + 1
 
264
            else:
 
265
                # ghost parents never appear in revision history.
 
266
                new_revno = 1
263
267
            if strict:
264
268
                # raise an exception as soon as we find a single unknown.
265
269
                for unknown in self.work_tree.unknowns():
323
327
                # now the master has the revision data
324
328
                # 'commit' to the master first so a timeout here causes the local
325
329
                # branch to be out of date
326
 
                self.master_branch.append_revision(self.rev_id)
 
330
                self.master_branch.set_last_revision_info(new_revno,
 
331
                                                          self.rev_id)
327
332
 
328
333
            # and now do the commit locally.
329
 
            self.branch.append_revision(self.rev_id)
 
334
            self.branch.set_last_revision_info(new_revno, self.rev_id)
330
335
 
331
336
            rev_tree = self.builder.revision_tree()
332
337
            self.work_tree.set_parent_trees([(self.rev_id, rev_tree)])
333
338
            # now the work tree is up to date with the branch
334
339
            
335
 
            self.reporter.completed(self.branch.revno(), self.rev_id)
 
340
            self.reporter.completed(new_revno, self.rev_id)
336
341
            # old style commit hooks - should be deprecated ? (obsoleted in
337
342
            # 0.15)
338
343
            if self.config.post_commit() is not None:
350
355
            else:
351
356
                hook_master = self.master_branch
352
357
                hook_local = self.branch
353
 
            new_revno = self.branch.revno()
354
358
            # With bound branches, when the master is behind the local branch,
355
359
            # the 'old_revno' and old_revid values here are incorrect.
356
360
            # XXX: FIXME ^. RBC 20060206
357
 
            old_revno = new_revno - 1
358
361
            if self.parents:
359
362
                old_revid = self.parents[0]
360
363
            else:
521
524
        # TODO: Make sure that this list doesn't contain duplicate 
522
525
        # entries and the order is preserved when doing this.
523
526
        self.parents = self.work_tree.get_parent_ids()
524
 
        self.parent_invs = []
525
 
        for revision in self.parents:
 
527
        self.parent_invs = [self.basis_inv]
 
528
        for revision in self.parents[1:]:
526
529
            if self.branch.repository.has_revision(revision):
527
530
                mutter('commit parent revision {%s}', revision)
528
531
                inventory = self.branch.repository.get_inventory(revision)