Patchwork [1,of,3] localrepo: remove clone method by hoisting into hg.py

login
register
mail settings
Submitter Augie Fackler
Date Dec. 1, 2015, 5:20 p.m.
Message ID <0c344df84bde07b11cfc.1448990433@arthedain.pit.corp.google.com>
Download mbox | patch
Permalink /patch/11709/
State Accepted
Delegated to: Yuya Nishihara
Headers show

Comments

Augie Fackler - Dec. 1, 2015, 5:20 p.m.
# HG changeset patch
# User Augie Fackler <augie@google.com>
# Date 1447289269 18000
#      Wed Nov 11 19:47:49 2015 -0500
# Node ID 0c344df84bde07b11cfcb3167ac6f806f2505350
# Parent  36c88b371ca08c137d5a081a4092973e9b1bae16
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.

Patch

diff --git a/mercurial/hg.py b/mercurial/hg.py
--- a/mercurial/hg.py
+++ b/mercurial/hg.py
@@ -546,13 +546,22 @@  def clone(ui, peeropts, source, dest=Non
                                        "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())
diff --git a/mercurial/localrepo.py b/mercurial/localrepo.py
--- a/mercurial/localrepo.py
+++ b/mercurial/localrepo.py
@@ -1856,22 +1856,6 @@  class localrepository(object):
         """
         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()