diff mercurial/exchange.py @ 33055:18c2489ac96d

bundle: make applybundle() delegate v1 bundles to applybundle1()
author Martin von Zweigbergk <martinvonz@google.com>
date Thu, 22 Jun 2017 15:00:19 -0700
parents 2baef42a2881
children 78fc540c53e1
line wrap: on
line diff
--- a/mercurial/exchange.py	Thu Jun 22 21:27:57 2017 -0700
+++ b/mercurial/exchange.py	Thu Jun 22 15:00:19 2017 -0700
@@ -1448,8 +1448,8 @@
                            "changegroupsubset."))
     else:
         cg = pullop.remote.changegroupsubset(pullop.fetch, pullop.heads, 'pull')
-    bundleop = bundle2.applybundle1(pullop.repo, cg, tr, 'pull',
-                                    pullop.remote.url())
+    bundleop = bundle2.applybundle(pullop.repo, cg, tr, 'pull',
+                                   pullop.remote.url())
     pullop.cgresult = bundle2.combinechangegroupresults(bundleop)
 
 def _pullphase(pullop):
@@ -1738,7 +1738,7 @@
             # legacy case: bundle1 (changegroup 01)
             txnname = "\n".join([source, util.hidepassword(url)])
             with repo.lock(), repo.transaction(txnname) as tr:
-                op = bundle2.applybundle1(repo, cg, tr, source, url)
+                op = bundle2.applybundle(repo, cg, tr, source, url)
                 r = bundle2.combinechangegroupresults(op)
         else:
             r = None
@@ -1999,12 +1999,10 @@
             fh = urlmod.open(ui, url)
             cg = readbundle(ui, fh, 'stream')
 
-            if isinstance(cg, bundle2.unbundle20):
-                bundle2.applybundle(repo, cg, tr, 'clonebundles', url)
-            elif isinstance(cg, streamclone.streamcloneapplier):
+            if isinstance(cg, streamclone.streamcloneapplier):
                 cg.apply(repo)
             else:
-                bundle2.applybundle1(repo, cg, tr, 'clonebundles', url)
+                bundle2.applybundle(repo, cg, tr, 'clonebundles', url)
             return True
         except urlerr.httperror as e:
             ui.warn(_('HTTP error fetching bundle: %s\n') % str(e))