/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 bzrlib/commit.py

  • Committer: Canonical.com Patch Queue Manager
  • Date: 2007-02-08 07:06:47 UTC
  • mfrom: (2246.1.4 branch-hooks)
  • Revision ID: pqm@pqm.ubuntu.com-20070208070647-fa39bee48393a769
(robertc) 4 new branch hooks: post_push, post_pull, post_commit, post_uncommit, and fix the inability to do a bzr pull --overwrite of a heavyweight checkout.

Show diffs side-by-side

added added

removed removed

Lines of Context:
61
61
    inventory,
62
62
    tree,
63
63
    )
 
64
from bzrlib.branch import Branch
64
65
import bzrlib.config
65
66
from bzrlib.errors import (BzrError, PointlessCommit,
66
67
                           ConflictsInTree,
332
333
            # now the work tree is up to date with the branch
333
334
            
334
335
            self.reporter.completed(self.branch.revno(), self.rev_id)
 
336
            # old style commit hooks - should be deprecated ? (obsoleted in
 
337
            # 0.15)
335
338
            if self.config.post_commit() is not None:
336
339
                hooks = self.config.post_commit().split(' ')
337
340
                # this would be nicer with twisted.python.reflect.namedAny
340
343
                                  {'branch':self.branch,
341
344
                                   'bzrlib':bzrlib,
342
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)
343
365
            self._emit_progress_update()
344
366
        finally:
345
367
            self._cleanup()