changeset 26459:3b28ffde133a

streamclone: move streamin() into maybeperformstreamclone() streamin() only had a single consumer. And it always only ever will because it is strongly coupled with the current, soon-to-be-superseded-by-bundle2 functionality. The return value has been dropped because nobody was using it.
author Gregory Szorc <gregory.szorc@gmail.com>
date Fri, 02 Oct 2015 23:08:15 -0700
parents 362793295640
children 79ef867538ea
files mercurial/streamclone.py
diffstat 1 files changed, 21 insertions(+), 25 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/streamclone.py	Sun Oct 04 11:20:52 2015 -0700
+++ b/mercurial/streamclone.py	Fri Oct 02 23:08:15 2015 -0700
@@ -77,7 +77,27 @@
     if not supported:
         return
 
-    streamin(repo, remote, requirements)
+    # Save remote branchmap. We will use it later to speed up branchcache
+    # creation.
+    rbranchmap = None
+    if remote.capable('branchmap'):
+        rbranchmap = remote.branchmap()
+
+    fp = remote.stream_out()
+    l = fp.readline()
+    try:
+        resp = int(l)
+    except ValueError:
+        raise error.ResponseError(
+            _('unexpected response from remote server:'), l)
+    if resp == 1:
+        raise util.Abort(_('operation forbidden by server'))
+    elif resp == 2:
+        raise util.Abort(_('locking the remote repository failed'))
+    elif resp != 0:
+        raise util.Abort(_('the server sent an unknown error code'))
+
+    applyremotedata(repo, requirements, rbranchmap, fp)
 
 def allowservergeneration(ui):
     """Whether streaming clones are allowed from the server."""
@@ -211,30 +231,6 @@
     finally:
         lock.release()
 
-def streamin(repo, remote, remotereqs):
-    # Save remote branchmap. We will use it later
-    # to speed up branchcache creation
-    rbranchmap = None
-    if remote.capable("branchmap"):
-        rbranchmap = remote.branchmap()
-
-    fp = remote.stream_out()
-    l = fp.readline()
-    try:
-        resp = int(l)
-    except ValueError:
-        raise error.ResponseError(
-            _('unexpected response from remote server:'), l)
-    if resp == 1:
-        raise util.Abort(_('operation forbidden by server'))
-    elif resp == 2:
-        raise util.Abort(_('locking the remote repository failed'))
-    elif resp != 0:
-        raise util.Abort(_('the server sent an unknown error code'))
-
-    applyremotedata(repo, remotereqs, rbranchmap, fp)
-    return len(repo.heads()) + 1
-
 def applyremotedata(repo, remotereqs, remotebranchmap, fp):
     """Apply stream clone data to a repository.