~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/commit.py

  • Committer: mbp at sourcefrog
  • Date: 2007-02-13 05:22:39 UTC
  • mfrom: (2279 +trunk)
  • mto: This revision was merged to the branch mainline in revision 2283.
  • Revision ID: mbp@sourcefrog.net-20070213052239-09atqsahwth6zdm1
(merge) trunk

Show diffs side-by-side

added added

removed removed

Lines of Context:
58
58
 
59
59
from bzrlib import (
60
60
    errors,
 
61
    inventory,
61
62
    tree,
62
63
    )
 
64
from bzrlib.branch import Branch
63
65
import bzrlib.config
64
66
from bzrlib.errors import (BzrError, PointlessCommit,
65
67
                           ConflictsInTree,
331
333
            # now the work tree is up to date with the branch
332
334
            
333
335
            self.reporter.completed(self.branch.revno(), self.rev_id)
 
336
            # old style commit hooks - should be deprecated ? (obsoleted in
 
337
            # 0.15)
334
338
            if self.config.post_commit() is not None:
335
339
                hooks = self.config.post_commit().split(' ')
336
340
                # this would be nicer with twisted.python.reflect.namedAny
339
343
                                  {'branch':self.branch,
340
344
                                   'bzrlib':bzrlib,
341
345
                                   'rev_id':self.rev_id})
 
346
            # new style commit hooks:
 
347
            if not self.bound_branch:
 
348
                hook_master = self.branch
 
349
                hook_local = None
 
350
            else:
 
351
                hook_master = self.master_branch
 
352
                hook_local = self.branch
 
353
            new_revno = self.branch.revno()
 
354
            # With bound branches, when the master is behind the local branch,
 
355
            # the 'old_revno' and old_revid values here are incorrect.
 
356
            # XXX: FIXME ^. RBC 20060206
 
357
            old_revno = new_revno - 1
 
358
            if self.parents:
 
359
                old_revid = self.parents[0]
 
360
            else:
 
361
                old_revid = bzrlib.revision.NULL_REVISION
 
362
            for hook in Branch.hooks['post_commit']:
 
363
                hook(hook_local, hook_master, old_revno, old_revid, new_revno,
 
364
                    self.rev_id)
342
365
            self._emit_progress_update()
343
366
        finally:
344
367
            self._cleanup()
428
451
        #       to local.
429
452
        
430
453
        # Make sure the local branch is identical to the master
431
 
        master_rh = self.master_branch.revision_history()
432
 
        local_rh = self.branch.revision_history()
433
 
        if local_rh != master_rh:
 
454
        master_info = self.master_branch.last_revision_info()
 
455
        local_info = self.branch.last_revision_info()
 
456
        if local_info != master_info:
434
457
            raise errors.BoundBranchOutOfDate(self.branch,
435
458
                    self.master_branch)
436
459
 
560
583
        for path, new_ie in entries:
561
584
            self._emit_progress_update()
562
585
            file_id = new_ie.file_id
 
586
            try:
 
587
                kind = self.work_tree.kind(file_id)
 
588
                if kind != new_ie.kind:
 
589
                    new_ie = inventory.make_entry(kind, new_ie.name,
 
590
                                                  new_ie.parent_id, file_id)
 
591
            except errors.NoSuchFile:
 
592
                pass
563
593
            # mutter('check %s {%s}', path, file_id)
564
594
            if (not self.specific_files or 
565
595
                is_inside_or_parent_of_any(self.specific_files, path)):