Patchwork [2,of,3] unbundle: move streamclone error case away from bundle[12] cases

login
register
mail settings
Submitter via Mercurial-devel
Date June 16, 2017, 9:26 p.m.
Message ID <ec1998992dd7989922a2.1497648398@martinvonz.svl.corp.google.com>
Download mbox | patch
Permalink /patch/21436/
State Accepted
Headers show

Comments

via Mercurial-devel - June 16, 2017, 9:26 p.m.
# HG changeset patch
# User Martin von Zweigbergk <martinvonz@google.com>
# Date 1497634694 25200
#      Fri Jun 16 10:38:14 2017 -0700
# Node ID ec1998992dd7989922a2cea054e2fd5c548879a0
# Parent  01e43f5ed3b796c8eeb629efc0a2dc2cc2be23b4
unbundle: move streamclone error case away from bundle[12] cases

The bundle1 and bundle2 cases are more similar, and having the
streamclone case in between is distracting.

Patch

diff --git a/mercurial/commands.py b/mercurial/commands.py
--- a/mercurial/commands.py
+++ b/mercurial/commands.py
@@ -5316,6 +5316,11 @@ 
         for fname in fnames:
             f = hg.openpath(ui, fname)
             gen = exchange.readbundle(ui, f, fname)
+            if isinstance(gen, streamclone.streamcloneapplier):
+                raise error.Abort(
+                        _('packed bundles cannot be applied with '
+                          '"hg unbundle"'),
+                        hint=_('use "hg debugapplystreamclonebundle"'))
             if isinstance(gen, bundle2.unbundle20):
                 with repo.transaction('unbundle') as tr:
                     try:
@@ -5331,11 +5336,6 @@ 
                 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)