Patchwork [1,of,2] hg.clone: set 'stream' depending on whether --pull was requested or not

login
register
mail settings
Submitter Siddharth Agarwal
Date Dec. 12, 2014, 10:27 p.m.
Message ID <7fe7768d79b0021324ac.1418423222@devbig136.prn2.facebook.com>
Download mbox | patch
Permalink /patch/7066/
State Accepted
Headers show

Comments

Siddharth Agarwal - Dec. 12, 2014, 10:27 p.m.
# HG changeset patch
# User Siddharth Agarwal <sid0@fb.com>
# Date 1418421776 28800
#      Fri Dec 12 14:02:56 2014 -0800
# Node ID 7fe7768d79b0021324ac19d4d0a161d709b93ade
# Parent  416c133145ee78c8e83865b7370e185eed69c1be
hg.clone: set 'stream' depending on whether --pull was requested or not

In an upcoming patch we'll differentiate between the two in localrepo.

Patch

diff --git a/mercurial/hg.py b/mercurial/hg.py
--- a/mercurial/hg.py
+++ b/mercurial/hg.py
@@ -284,7 +284,8 @@ 
     dest: URL of destination repository to create (defaults to base
     name of source repository)
 
-    pull: always pull from source repository, even in local case
+    pull: always pull from source repository, even in local case or if the
+    server prefers streaming
 
     stream: stream raw data uncompressed from repository (fast over
     LAN, slow over WAN)
@@ -420,6 +421,11 @@ 
                 revs = [srcpeer.lookup(r) for r in rev]
                 checkout = revs[0]
             if destpeer.local():
+                if not stream:
+                    if pull:
+                        stream = False
+                    else:
+                        stream = None
                 destpeer.local().clone(srcpeer, heads=revs, stream=stream)
             elif srcrepo:
                 exchange.push(srcrepo, destpeer, revs=revs,