~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/remote.py

  • Committer: Andrew Bennetts
  • Date: 2009-07-27 05:24:02 UTC
  • mfrom: (4570 +trunk)
  • mto: This revision was merged to the branch mainline in revision 4573.
  • Revision ID: andrew.bennetts@canonical.com-20090727052402-e3vakc2pnq0y66gm
Merge bzr.dev.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
# Copyright (C) 2006, 2007, 2008 Canonical Ltd
 
1
# Copyright (C) 2006, 2007, 2008, 2009 Canonical Ltd
2
2
#
3
3
# This program is free software; you can redistribute it and/or modify
4
4
# it under the terms of the GNU General Public License as published by
14
14
# along with this program; if not, write to the Free Software
15
15
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
16
16
 
17
 
# TODO: At some point, handle upgrades by just passing the whole request
18
 
# across to run on the server.
19
 
 
20
17
import bz2
21
18
 
22
19
from bzrlib import (
27
24
    debug,
28
25
    errors,
29
26
    graph,
 
27
    lock,
30
28
    lockdir,
31
29
    repository,
32
30
    revision,
819
817
            result.add(_mod_revision.NULL_REVISION)
820
818
        return result
821
819
 
 
820
    def _has_same_fallbacks(self, other_repo):
 
821
        """Returns true if the repositories have the same fallbacks."""
 
822
        # XXX: copied from Repository; it should be unified into a base class
 
823
        # <https://bugs.edge.launchpad.net/bzr/+bug/401622>
 
824
        my_fb = self._fallback_repositories
 
825
        other_fb = other_repo._fallback_repositories
 
826
        if len(my_fb) != len(other_fb):
 
827
            return False
 
828
        for f, g in zip(my_fb, other_fb):
 
829
            if not f.has_same_location(g):
 
830
                return False
 
831
        return True
 
832
 
822
833
    def has_same_location(self, other):
 
834
        # TODO: Move to RepositoryBase and unify with the regular Repository
 
835
        # one; unfortunately the tests rely on slightly different behaviour at
 
836
        # present -- mbp 20090710
823
837
        return (self.__class__ is other.__class__ and
824
838
                self.bzrdir.transport.base == other.bzrdir.transport.base)
825
839
 
1031
1045
 
1032
1046
    def unlock(self):
1033
1047
        if not self._lock_count:
1034
 
            raise errors.LockNotHeld(self)
 
1048
            return lock.cant_unlock_not_held(self)
1035
1049
        self._lock_count -= 1
1036
1050
        if self._lock_count > 0:
1037
1051
            return
1236
1250
            raise errors.InternalBzrError(
1237
1251
                "May not fetch while in a write group.")
1238
1252
        # fast path same-url fetch operations
1239
 
        if self.has_same_location(source) and fetch_spec is None:
 
1253
        if (self.has_same_location(source)
 
1254
            and fetch_spec is None
 
1255
            and self._has_same_fallbacks(source)):
1240
1256
            # check that last_revision is in 'from' and then return a
1241
1257
            # no-operation.
1242
1258
            if (revision_id is not None and