~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/branch.py

  • Committer: Canonical.com Patch Queue Manager
  • Date: 2008-09-22 06:45:55 UTC
  • mfrom: (3703.3.9 faster-empty-push)
  • Revision ID: pqm@pqm.ubuntu.com-20080922064555-jayr5evddyn8w7g6
Faster push when there are no new revisions,
        and when there are no local tags. (Andrew Bennetts)

Show diffs side-by-side

added added

removed removed

Lines of Context:
1802
1802
        result.source_branch = self
1803
1803
        result.target_branch = target
1804
1804
        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)
 
1805
        if result.old_revid != self.last_revision():
 
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
        if self._push_should_merge_tags():
 
1812
            result.tag_conflicts = self.tags.merge_to(target.tags, overwrite)
1812
1813
        result.new_revno, result.new_revid = target.last_revision_info()
1813
1814
        return result
1814
1815
 
 
1816
    def _push_should_merge_tags(self):
 
1817
        """Should _basic_push merge this branch's tags into the target?
 
1818
        
 
1819
        The default implementation returns False if this branch has no tags,
 
1820
        and True the rest of the time.  Subclasses may override this.
 
1821
        """
 
1822
        return self.tags.supports_tags() and self.tags.get_tag_dict()
 
1823
 
1815
1824
    def get_parent(self):
1816
1825
        """See Branch.get_parent."""
1817
1826
        parent = self._get_parent_location()