Patchwork [2,of,5] unbundle: create transaction for bundle1 unbundling earlier

login
register
mail settings
Submitter via Mercurial-devel
Date June 18, 2017, 7:02 a.m.
Message ID <b6b0928d0128d2b424b4.1497769345@martinvonz.svl.corp.google.com>
Download mbox | patch
Permalink /patch/21475/
State Accepted
Headers show

Comments

via Mercurial-devel - June 18, 2017, 7:02 a.m.
# HG changeset patch
# User Martin von Zweigbergk <martinvonz@google.com>
# Date 1497590301 25200
#      Thu Jun 15 22:18:21 2017 -0700
# Node ID b6b0928d0128d2b424b40bf4c4d2a59acc20f9ac
# Parent  c0f6614c4c95281e7188879cd430ce0208680f2c
unbundle: create transaction for bundle1 unbundling earlier

See earlier patch for motivation.

Patch

diff --git a/mercurial/commands.py b/mercurial/commands.py
--- a/mercurial/commands.py
+++ b/mercurial/commands.py
@@ -5321,12 +5321,13 @@ 
                         _('packed bundles cannot be applied with '
                           '"hg unbundle"'),
                         hint=_('use "hg debugapplystreamclonebundle"'))
+            url = 'bundle:' + fname
             if isinstance(gen, bundle2.unbundle20):
                 with repo.transaction('unbundle') as tr:
                     try:
                         op = bundle2.applybundle(repo, gen, tr,
                                                  source='unbundle',
-                                                 url='bundle:' + fname)
+                                                 url=url)
                     except error.BundleUnknownFeatureError as exc:
                         raise error.Abort(
                             _('%s: unknown bundle feature, %s') % (fname, exc),
@@ -5337,7 +5338,9 @@ 
                            for r in op.records['changegroup']]
                 modheads = changegroup.combineresults(changes)
             else:
-                modheads = gen.apply(repo, 'unbundle', 'bundle:' + fname)
+                txnname = 'unbundle\n%s' % util.hidepassword(url)
+                with repo.transaction(txnname):
+                    modheads = gen.apply(repo, 'unbundle', url)
 
     return postincoming(ui, repo, modheads, opts.get(r'update'), None, None)