~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/branch.py

Merge bzr.dev.

Show diffs side-by-side

added added

removed removed

Lines of Context:
91
91
        self._revision_id_to_revno_cache = None
92
92
        self._last_revision_info_cache = None
93
93
        self._open_hook()
 
94
        hooks = Branch.hooks['open']
 
95
        for hook in hooks:
 
96
            hook(self)
94
97
 
95
98
    def _open_hook(self):
96
99
        """Called by init to allow simpler extension of the base class."""
1068
1071
        # (branch, revision_history), and the branch will
1069
1072
        # be write-locked.
1070
1073
        self['set_rh'] = []
 
1074
        # Invoked after a branch is opened. The api signature is (branch).
 
1075
        self['open'] = []
1071
1076
        # invoked after a push operation completes.
1072
1077
        # the api signature is
1073
1078
        # (push_result)
1802
1807
        result.source_branch = self
1803
1808
        result.target_branch = target
1804
1809
        result.old_revno, result.old_revid = target.last_revision_info()
1805
 
 
1806
 
        # We assume that during 'push' this repository is closer than
1807
 
        # the target.
1808
 
        graph = self.repository.get_graph(target.repository)
1809
 
        target.update_revisions(self, stop_revision, overwrite=overwrite,
1810
 
                                graph=graph)
1811
 
        result.tag_conflicts = self.tags.merge_to(target.tags, overwrite)
 
1810
        if result.old_revid != self.last_revision():
 
1811
            # We assume that during 'push' this repository is closer than
 
1812
            # the target.
 
1813
            graph = self.repository.get_graph(target.repository)
 
1814
            target.update_revisions(self, stop_revision, overwrite=overwrite,
 
1815
                                    graph=graph)
 
1816
        if self._push_should_merge_tags():
 
1817
            result.tag_conflicts = self.tags.merge_to(target.tags, overwrite)
1812
1818
        result.new_revno, result.new_revid = target.last_revision_info()
1813
1819
        return result
1814
1820
 
 
1821
    def _push_should_merge_tags(self):
 
1822
        """Should _basic_push merge this branch's tags into the target?
 
1823
        
 
1824
        The default implementation returns False if this branch has no tags,
 
1825
        and True the rest of the time.  Subclasses may override this.
 
1826
        """
 
1827
        return self.tags.supports_tags() and self.tags.get_tag_dict()
 
1828
 
1815
1829
    def get_parent(self):
1816
1830
        """See Branch.get_parent."""
1817
1831
        parent = self._get_parent_location()
2169
2183
        return self._get_bound_location(False)
2170
2184
 
2171
2185
    def get_stacked_on_url(self):
2172
 
        self._check_stackable_repo()
 
2186
        # you can always ask for the URL; but you might not be able to use it
 
2187
        # if the repo can't support stacking.
 
2188
        ## self._check_stackable_repo()
2173
2189
        stacked_url = self._get_config_location('stacked_on_location')
2174
2190
        if stacked_url is None:
2175
2191
            raise errors.NotStacked(self)