peer: remove cancopy from peer api; use directly on repo instead
authorSune Foldager <cryo@cyanite.org>
Fri, 13 Jul 2012 21:52:37 +0200
changeset 17194 32a6a33b9a355ceafb2c6cdeed88ebb63a6cbfc9
parent 17193 1d710fe5ee0e99a724311724dda32289b0733c61
child 17195 48c232873a543111100776d1baa47c4bc1538060
push id1
push usergszorc@mozilla.com
push dateWed, 18 Mar 2015 16:34:57 +0000
peer: remove cancopy from peer api; use directly on repo instead
mercurial/hg.py
mercurial/localrepo.py
mercurial/peer.py
--- a/mercurial/hg.py
+++ b/mercurial/hg.py
@@ -297,17 +297,18 @@ def clone(ui, peeropts, source, dest=Non
         abspath = origsource
         if islocal(origsource):
             abspath = os.path.abspath(util.urllocalpath(origsource))
 
         if islocal(dest):
             dircleanup = DirCleanup(dest)
 
         copy = False
-        if srcpeer.cancopy() and islocal(dest) and not srcrepo.revs("secret()"):
+        if (srcrepo and srcrepo.cancopy() and islocal(dest)
+            and not srcrepo.revs("secret()")):
             copy = not pull and not rev
 
         if copy:
             try:
                 # we use a lock here because if we race with commit, we
                 # can end up with extra data in the cloned revlogs that's
                 # not pointed to by changesets, thus causing verify to
                 # fail
--- a/mercurial/localrepo.py
+++ b/mercurial/localrepo.py
@@ -41,19 +41,16 @@ class localpeer(peer.peerrepository):
         self._repo.close()
 
     def _capabilities(self):
         return self._caps
 
     def local(self):
         return self._repo
 
-    def cancopy(self):
-        return self._repo.cancopy() # so bundlerepo can override
-
     def canpush(self):
         return True
 
     def url(self):
         return self._repo.url()
 
     def lookup(self, key):
         return self._repo.lookup(key)
--- a/mercurial/peer.py
+++ b/mercurial/peer.py
@@ -37,16 +37,13 @@ class peerrepository(object):
         return None
 
     def peer(self):
         return self
 
     def peer(self):
         return self
 
-    def cancopy(self):
-        return False
-
     def canpush(self):
         return True
 
     def close(self):
         pass