localrepo: remove clone method by hoisting into hg.py
authorAugie Fackler <augie@google.com>
Wed, 11 Nov 2015 19:47:49 -0500
changeset 27165 70884715725e
parent 27164 88d5db4b155c
child 27166 263db31329a6
localrepo: remove clone method by hoisting into hg.py hg.py was the only remaining caller of localrepo.clone(), so it's time to move some more behavior out of localrepo.
mercurial/hg.py
mercurial/localrepo.py
--- a/mercurial/hg.py	Tue Dec 01 09:48:38 2015 -0800
+++ b/mercurial/hg.py	Wed Nov 11 19:47:49 2015 -0500
@@ -546,13 +546,22 @@
                                        "support clone by revision"))
                 revs = [srcpeer.lookup(r) for r in rev]
                 checkout = revs[0]
-            if destpeer.local():
+            local = destpeer.local()
+            if local:
                 if not stream:
                     if pull:
                         stream = False
                     else:
                         stream = None
-                destpeer.local().clone(srcpeer, heads=revs, stream=stream)
+                # internal config: ui.quietbookmarkmove
+                quiet = local.ui.backupconfig('ui', 'quietbookmarkmove')
+                try:
+                    local.ui.setconfig(
+                        'ui', 'quietbookmarkmove', True, 'clone')
+                    exchange.pull(local, srcpeer, revs,
+                                  streamclonerequested=stream)
+                finally:
+                    local.ui.restoreconfig(quiet)
             elif srcrepo:
                 exchange.push(srcrepo, destpeer, revs=revs,
                               bookmarks=srcrepo._bookmarks.keys())
--- a/mercurial/localrepo.py	Tue Dec 01 09:48:38 2015 -0800
+++ b/mercurial/localrepo.py	Wed Nov 11 19:47:49 2015 -0500
@@ -1856,22 +1856,6 @@
         """
         return util.hooks()
 
-    def clone(self, remote, heads=[], stream=None):
-        '''clone remote repository.
-
-        keyword arguments:
-        heads: list of revs to clone (forces use of pull)
-        stream: use streaming clone if possible'''
-        # internal config: ui.quietbookmarkmove
-        quiet = self.ui.backupconfig('ui', 'quietbookmarkmove')
-        try:
-            self.ui.setconfig('ui', 'quietbookmarkmove', True, 'clone')
-            pullop = exchange.pull(self, remote, heads,
-                                   streamclonerequested=stream)
-            return pullop.cgresult
-        finally:
-            self.ui.restoreconfig(quiet)
-
     def pushkey(self, namespace, key, old, new):
         try:
             tr = self.currenttransaction()