/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/branch.py

  • Committer: Martin Pool
  • Date: 2008-07-14 07:47:45 UTC
  • mfrom: (3536 +trunk)
  • mto: This revision was merged to the branch mainline in revision 3537.
  • Revision ID: mbp@sourcefrog.net-20080714074745-ow7wqktgjbn6xb6q
merge trunk

Show diffs side-by-side

added added

removed removed

Lines of Context:
1134
1134
        # local is the local branch or None, master is the target branch,
1135
1135
        # and an empty branch recieves new_revno of 0, new_revid of None.
1136
1136
        self['post_uncommit'] = []
 
1137
        # Introduced in 1.6
 
1138
        # Invoked before the tip of a branch changes.
 
1139
        # the api signature is
 
1140
        # (params) where params is a ChangeBranchTipParams with the members
 
1141
        # (branch, old_revno, new_revno, old_revid, new_revid)
 
1142
        self['pre_change_branch_tip'] = []
1137
1143
        # Introduced in 1.4
1138
1144
        # Invoked after the tip of a branch changes.
1139
1145
        # the api signature is
1175
1181
        self.old_revid = old_revid
1176
1182
        self.new_revid = new_revid
1177
1183
 
 
1184
    def __eq__(self, other):
 
1185
        return self.__dict__ == other.__dict__
 
1186
    
 
1187
    def __repr__(self):
 
1188
        return "<%s of %s from (%s, %s) to (%s, %s)>" % (
 
1189
            self.__class__.__name__, self.branch, 
 
1190
            self.old_revno, self.old_revid, self.new_revno, self.new_revid)
 
1191
 
1178
1192
 
1179
1193
class BzrBranchFormat4(BranchFormat):
1180
1194
    """Bzr branch format 4.
1571
1585
        for hook in Branch.hooks['set_rh']:
1572
1586
            hook(self, rev_history)
1573
1587
 
 
1588
    def _run_pre_change_branch_tip_hooks(self, new_revno, new_revid):
 
1589
        """Run the pre_change_branch_tip hooks."""
 
1590
        hooks = Branch.hooks['pre_change_branch_tip']
 
1591
        if not hooks:
 
1592
            return
 
1593
        old_revno, old_revid = self.last_revision_info()
 
1594
        params = ChangeBranchTipParams(
 
1595
            self, old_revno, new_revno, old_revid, new_revid)
 
1596
        for hook in hooks:
 
1597
            hook(params)
 
1598
 
1574
1599
    def _run_post_change_branch_tip_hooks(self, old_revno, old_revid):
1575
1600
        """Run the post_change_branch_tip hooks."""
1576
1601
        hooks = Branch.hooks['post_change_branch_tip']
1602
1627
        history = self._lefthand_history(revision_id)
1603
1628
        if len(history) != revno:
1604
1629
            raise AssertionError('%d != %d' % (len(history), revno))
 
1630
        self._run_pre_change_branch_tip_hooks(revno, revision_id)
1605
1631
        self.set_revision_history(history)
1606
1632
        self._run_post_change_branch_tip_hooks(old_revno, old_revid)
1607
1633
 
2039
2065
        old_revno, old_revid = self.last_revision_info()
2040
2066
        if self._get_append_revisions_only():
2041
2067
            self._check_history_violation(revision_id)
 
2068
        self._run_pre_change_branch_tip_hooks(revno, revision_id)
2042
2069
        self._write_last_revision_info(revno, revision_id)
2043
2070
        self._clear_cached_state()
2044
2071
        self._last_revision_info_cache = revno, revision_id