Mercurial > public > mercurial-scm > hg-stable
diff mercurial/exchange.py @ 26643:d2e16419d3f4
clonebundle: support bundle2
exchange.readbundle() can return 2 different types. We weren't handling
the bundle2 case. Handle it.
At some point we'll likely want a generic API for applying a bundle from
a file handle. For now, create another one-off until we figure out what
the unified bundle API should look like (addressing this is a can of
worms I don't want to open right now).
author | Gregory Szorc <gregory.szorc@gmail.com> |
---|---|
date | Tue, 13 Oct 2015 10:41:54 -0700 |
parents | b13fdcc4e700 |
children | 74de1c59f71c |
line wrap: on
line diff
--- a/mercurial/exchange.py Mon Oct 05 21:31:32 2015 -0700 +++ b/mercurial/exchange.py Tue Oct 13 10:41:54 2015 -0700 @@ -1653,7 +1653,11 @@ try: fh = urlmod.open(ui, url) cg = readbundle(ui, fh, 'stream') - changegroup.addchangegroup(repo, cg, 'clonebundles', url) + + if isinstance(cg, bundle2.unbundle20): + bundle2.processbundle(repo, cg, lambda: tr) + else: + changegroup.addchangegroup(repo, cg, 'clonebundles', url) tr.close() return True except urllib2.HTTPError as e: