changeset 26449:89b7a7883aee

exchange: move stream clone logic into pull code path Stream clones are a special case of clones. Clones are a special case of pull. Most of the logic for deciding what to do at pull time is in exchange.py. It makes sense for the stream clone determination to live there as well. This patch moves the calling of the stream clone code into pull(). The checks in streamclone.canperformstreamclone() ensure that we don't perform a stream clone unless it is possible. A future patch will convert maybeperformstreamclone() to accept a pullop to make it consistent with everything else in pull(). It will also grow some functionality (in case you doubted the necessity of a 4 line function).
author Gregory Szorc <gregory.szorc@gmail.com>
date Fri, 02 Oct 2015 23:04:52 -0700
parents e05fd574c922
children 1138e1d05207
files mercurial/exchange.py mercurial/localrepo.py
diffstat 2 files changed, 4 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/exchange.py	Fri Oct 02 22:16:34 2015 -0700
+++ b/mercurial/exchange.py	Fri Oct 02 23:04:52 2015 -0700
@@ -11,6 +11,7 @@
 import util, scmutil, changegroup, base85, error
 import discovery, phases, obsolete, bookmarks as bookmod, bundle2, pushkey
 import lock as lockmod
+import streamclone
 import tags
 
 def readbundle(ui, fh, fname, vfs=None):
@@ -963,6 +964,9 @@
     lock = pullop.repo.lock()
     try:
         pullop.trmanager = transactionmanager(repo, 'pull', remote.url())
+        streamclone.maybeperformstreamclone(pullop.repo, pullop.remote,
+                                            pullop.heads,
+                                            pullop.streamclonerequested)
         _pulldiscovery(pullop)
         if _canusebundle2(pullop):
             _pullbundle2(pullop)
--- a/mercurial/localrepo.py	Fri Oct 02 22:16:34 2015 -0700
+++ b/mercurial/localrepo.py	Fri Oct 02 23:04:52 2015 -0700
@@ -19,7 +19,6 @@
 import weakref, errno, os, time, inspect, random
 import branchmap, pathutil
 import namespaces
-import streamclone
 propertycache = util.propertycache
 filecache = scmutil.filecache
 
@@ -1794,8 +1793,6 @@
         keyword arguments:
         heads: list of revs to clone (forces use of pull)
         stream: use streaming clone if possible'''
-        streamclone.maybeperformstreamclone(self, remote, heads, stream)
-
         # internal config: ui.quietbookmarkmove
         quiet = self.ui.backupconfig('ui', 'quietbookmarkmove')
         try: