Patchwork [4,of,4,modernize-streamclone] exchange: add "streaming all changes" to bundle2 pulling

login
register
mail settings
Submitter Gregory Szorc
Date Oct. 5, 2015, 2:32 a.m.
Message ID <52d5ad50be88cca77394.1444012360@126.1.168.192.in-addr.arpa>
Download mbox | patch
Permalink /patch/10803/
State Accepted
Headers show

Comments

Gregory Szorc - Oct. 5, 2015, 2:32 a.m.
# HG changeset patch
# User Gregory Szorc <gregory.szorc@gmail.com>
# Date 1443985904 25200
#      Sun Oct 04 12:11:44 2015 -0700
# Node ID 52d5ad50be88cca773942a53a8acfbe86c52c464
# Parent  7c7141ed5c21ddb9332ccc626ad5ac1c17f7eebb
exchange: add "streaming all changes" to bundle2 pulling

This is the beginning of client-side support for performing a stream
clone using bundle2. The main bundle2 pull function checks whether to
perform a streaming clone and outputs a message if so.

While we have a duplicate message, it seems easier to have all the
bundle2 console writing in one location and in an easy-to-read
conditional block.

Patch

diff --git a/mercurial/exchange.py b/mercurial/exchange.py
--- a/mercurial/exchange.py
+++ b/mercurial/exchange.py
@@ -1065,8 +1065,11 @@  def _pullbundle2(pullop):
     """pull data using bundle2
 
     For now, the only supported data are changegroup."""
     kwargs = {'bundlecaps': caps20to10(pullop.repo)}
+
+    streaming, streamreqs = streamclone.canperformstreamclone(pullop)
+
     # pulling changegroup
     pullop.stepsdone.add('changegroup')
 
     kwargs['common'] = pullop.common
@@ -1077,9 +1080,11 @@  def _pullbundle2(pullop):
         if pullop.remotebookmarks is None:
             # make sure to always includes bookmark data when migrating
             # `hg incoming --bundle` to using this function.
             kwargs['listkeys'].append('bookmarks')
-    if not pullop.fetch:
+    if streaming:
+        pullop.repo.ui.status(_('streaming all changes\n'))
+    elif not pullop.fetch:
         pullop.repo.ui.status(_("no changes found\n"))
         pullop.cgresult = 0
     else:
         if pullop.heads is None and list(pullop.common) == [nullid]: