~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/remote.py

  • Committer: Andrew Bennetts
  • Date: 2008-05-22 05:58:50 UTC
  • mto: (3452.2.9 inter-remote-pack)
  • mto: This revision was merged to the branch mainline in revision 3511.
  • Revision ID: andrew.bennetts@canonical.com-20080522055850-um0u9dj5jpkptkuq
Some small tweaks and comments.

Show diffs side-by-side

added added

removed removed

Lines of Context:
42
42
from bzrlib.pack import ContainerPushParser
43
43
from bzrlib.smart import client, vfs
44
44
from bzrlib.revision import ensure_null, NULL_REVISION
45
 
from bzrlib.trace import mutter, mutter_callsite, note, warning
 
45
from bzrlib.trace import mutter, note, warning
46
46
 
47
47
# Note: RemoteBzrDirFormat is in bzrdir.py
48
48
 
1334
1334
    def _clear_cached_state(self):
1335
1335
        super(RemoteBranch, self)._clear_cached_state()
1336
1336
        self._last_revision_info_cache = None
 
1337
        if self._real_branch is not None:
 
1338
            self._real_branch._clear_cached_state()
1337
1339
        
1338
1340
    @property
1339
1341
    def control_files(self):
1606
1608
 
1607
1609
    def generate_revision_history(self, revision_id, last_rev=None,
1608
1610
                                  other_branch=None):
 
1611
        self._clear_cached_state()
1609
1612
        self._ensure_real()
1610
1613
        return self._real_branch.generate_revision_history(
1611
1614
            revision_id, last_rev=last_rev, other_branch=other_branch)
1621
1624
 
1622
1625
    def update_revisions(self, other, stop_revision=None, overwrite=False):
1623
1626
        if overwrite:
 
1627
            self._clear_cached_state()
1624
1628
            self._ensure_real()
1625
1629
            return self._real_branch.update_revisions(
1626
1630
                other, stop_revision=stop_revision, overwrite=True)
1627
 
        from bzrlib import revision as _mod_revision
 
1631
        # XXX: this code is substantially copy-and-pasted from
 
1632
        # Branch.update_revisions.  This is however much faster than calling
 
1633
        # the same code on _real_branch, because it will use RPCs and cache
 
1634
        # results.
1628
1635
        other.lock_read()
1629
1636
        try:
1630
1637
            other_last_revno, other_last_revision = other.last_revision_info()
1631
1638
            if stop_revision is None:
1632
1639
                stop_revision = other_last_revision
1633
 
                if _mod_revision.is_null(stop_revision):
 
1640
                if revision.is_null(stop_revision):
1634
1641
                    # if there are no commits, we're done.
1635
1642
                    return
1636
1643
            # whats the current last revision, before we fetch [and change it
1637
1644
            # possibly]
1638
 
            last_rev = _mod_revision.ensure_null(self.last_revision())
 
1645
            last_rev = revision.ensure_null(self.last_revision())
1639
1646
            # we fetch here so that we don't process data twice in the common
1640
1647
            # case of having something to pull, and so that the check for 
1641
1648
            # already merged can operate on the just fetched graph, which will
1657
1664
                self.set_last_revision_info(other_last_revno,
1658
1665
                                            other_last_revision)
1659
1666
            else:
 
1667
                # XXX: In Branch.update_revisions this code is more
 
1668
                # complicated.  Here we just allow the remote side to generate
 
1669
                # the new history for us.
1660
1670
                self._set_last_revision(stop_revision)
1661
1671
        finally:
1662
1672
            other.unlock()