Mercurial > public > mercurial-scm > hg-stable
diff mercurial/commands.py @ 26758:bde7ef23340d
commands: support consuming stream clone bundles
For the same reasons that we don't produce stream clone bundles with `hg
bundle`, we don't support consuming stream clone bundles with `hg
unbundle`. We introduce a complementary debug command for applying
stream clone bundles. This command is mostly to facilitate testing.
Although it may be used to manually apply stream clone bundles until a
more formal mechanism is (possibly) adopted.
author | Gregory Szorc <gregory.szorc@gmail.com> |
---|---|
date | Thu, 15 Oct 2015 13:43:18 -0700 |
parents | 43708f92f471 |
children | c0f475ac997e |
line wrap: on
line diff
--- a/mercurial/commands.py Sat Oct 17 11:40:29 2015 -0700 +++ b/mercurial/commands.py Thu Oct 15 13:43:18 2015 -0700 @@ -1978,6 +1978,13 @@ ui.write(_('bundle requirements: %s\n') % ', '.join(sorted(requirements))) +@command('debugapplystreamclonebundle', [], 'FILE') +def debugapplystreamclonebundle(ui, repo, fname): + """apply a stream clone bundle file""" + f = hg.openpath(ui, fname) + gen = exchange.readbundle(ui, f, fname) + gen.apply(repo) + @command('debugcheckstate', [], '') def debugcheckstate(ui, repo): """validate the correctness of the current dirstate""" @@ -6532,6 +6539,11 @@ changes = [r.get('return', 0) for r in op.records['changegroup']] modheads = changegroup.combineresults(changes) + elif isinstance(gen, streamclone.streamcloneapplier): + raise error.Abort( + _('packed bundles cannot be applied with ' + '"hg unbundle"'), + hint=_('use "hg debugapplystreamclonebundle"')) else: modheads = gen.apply(repo, 'unbundle', 'bundle:' + fname) finally: