D833: exchange: perform stream clone with clone bundle with --uncompressed

indygreg (Gregory Szorc) phabricator at mercurial-scm.org
Sat Sep 30 09:57:14 EDT 2017


This revision was automatically updated to reflect the committed changes.
Closed by commit rHGff406f3e57b2: exchange: perform stream clone with clone bundle with --uncompressed (authored by indygreg, committed by ).

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D833?vs=2141&id=2195

REVISION DETAIL
  https://phab.mercurial-scm.org/D833

AFFECTED FILES
  mercurial/exchange.py
  tests/test-clonebundles.t

CHANGE DETAILS

diff --git a/tests/test-clonebundles.t b/tests/test-clonebundles.t
--- a/tests/test-clonebundles.t
+++ b/tests/test-clonebundles.t
@@ -441,6 +441,8 @@
   > EOF
 
   $ hg clone -U --uncompressed http://localhost:$HGPORT uncompressed-gzip
+  no compatible clone bundles available on server; falling back to regular clone
+  (you may want to report this to the server operator)
   streaming all changes
   4 files to transfer, 613 bytes of data
   transferred 613 bytes in * seconds (*) (glob)
@@ -454,6 +456,8 @@
   > EOF
 
   $ hg clone -U --uncompressed http://localhost:$HGPORT uncompressed-no-bundlespec
+  no compatible clone bundles available on server; falling back to regular clone
+  (you may want to report this to the server operator)
   streaming all changes
   4 files to transfer, 613 bytes of data
   transferred 613 bytes in * seconds (*) (glob)
@@ -468,9 +472,10 @@
   > EOF
 
   $ hg clone -U --uncompressed http://localhost:$HGPORT uncompressed-gzip-packed
-  streaming all changes
+  applying clone bundle from http://localhost:$HGPORT1/packed.hg
   4 files to transfer, 613 bytes of data
   transferred 613 bytes in * seconds (*) (glob)
+  finished applying clone bundle
   searching for changes
   no changes found
 
@@ -482,9 +487,10 @@
   > EOF
 
   $ hg clone -U --uncompressed http://localhost:$HGPORT uncompressed-gzip-packed-requirements
-  streaming all changes
+  applying clone bundle from http://localhost:$HGPORT1/packed.hg
   4 files to transfer, 613 bytes of data
   transferred 613 bytes in * seconds (*) (glob)
+  finished applying clone bundle
   searching for changes
   no changes found
 
@@ -496,6 +502,8 @@
   > EOF
 
   $ hg clone -U --uncompressed http://localhost:$HGPORT uncompressed-gzip-packed-unsupported-requirements
+  no compatible clone bundles available on server; falling back to regular clone
+  (you may want to report this to the server operator)
   streaming all changes
   4 files to transfer, 613 bytes of data
   transferred 613 bytes in * seconds (*) (glob)
diff --git a/mercurial/exchange.py b/mercurial/exchange.py
--- a/mercurial/exchange.py
+++ b/mercurial/exchange.py
@@ -1239,10 +1239,10 @@
         wlock = pullop.repo.wlock()
         lock = pullop.repo.lock()
         pullop.trmanager = transactionmanager(repo, 'pull', remote.url())
-        streamclone.maybeperformlegacystreamclone(pullop)
         # This should ideally be in _pullbundle2(). However, it needs to run
         # before discovery to avoid extra work.
         _maybeapplyclonebundle(pullop)
+        streamclone.maybeperformlegacystreamclone(pullop)
         _pulldiscovery(pullop)
         if pullop.canusebundle2:
             _pullbundle2(pullop)
@@ -1864,7 +1864,9 @@
                        'falling back to regular clone\n'))
         return
 
-    entries = filterclonebundleentries(repo, entries)
+    entries = filterclonebundleentries(
+        repo, entries, streamclonerequested=pullop.streamclonerequested)
+
     if not entries:
         # There is a thundering herd concern here. However, if a server
         # operator doesn't advertise bundles appropriate for its clients,
@@ -1933,7 +1935,7 @@
 
     return m
 
-def filterclonebundleentries(repo, entries):
+def filterclonebundleentries(repo, entries, streamclonerequested=False):
     """Remove incompatible clone bundle manifest entries.
 
     Accepts a list of entries parsed with ``parseclonebundlesmanifest``
@@ -1948,14 +1950,28 @@
         spec = entry.get('BUNDLESPEC')
         if spec:
             try:
-                parsebundlespec(repo, spec, strict=True)
+                comp, version, params = parsebundlespec(repo, spec, strict=True)
+
+                # If a stream clone was requested, filter out non-streamclone
+                # entries.
+                if streamclonerequested and (comp != 'UN' or version != 's1'):
+                    repo.ui.debug('filtering %s because not a stream clone\n' %
+                                  entry['URL'])
+                    continue
+
             except error.InvalidBundleSpecification as e:
                 repo.ui.debug(str(e) + '\n')
                 continue
             except error.UnsupportedBundleSpecification as e:
                 repo.ui.debug('filtering %s because unsupported bundle '
                               'spec: %s\n' % (entry['URL'], str(e)))
                 continue
+        # If we don't have a spec and requested a stream clone, we don't know
+        # what the entry is so don't attempt to apply it.
+        elif streamclonerequested:
+            repo.ui.debug('filtering %s because cannot determine if a stream '
+                          'clone bundle\n' % entry['URL'])
+            continue
 
         if 'REQUIRESNI' in entry and not sslutil.hassni:
             repo.ui.debug('filtering %s because SNI not supported\n' %



To: indygreg, #hg-reviewers, krbullock
Cc: krbullock, mercurial-devel


More information about the Mercurial-devel mailing list