Patchwork [3,of,6,v2] import: refactor nocommit and importbranch handling

login
register
mail settings
Submitter timeless@mozdev.org
Date Dec. 31, 2015, 6:47 a.m.
Message ID <0179b3fbf17aa787dce2.1451544437@waste.org>
Download mbox | patch
Permalink /patch/12442/
State Accepted
Delegated to: Yuya Nishihara
Headers show

Comments

timeless@mozdev.org - Dec. 31, 2015, 6:47 a.m.
# HG changeset patch
# User timeless <timeless@mozdev.org>
# Date 1451509671 0
#      Wed Dec 30 21:07:51 2015 +0000
# Node ID 0179b3fbf17aa787dce200d03d2deb924246fda5
# Parent  442c96941ae7ae28748567ab6c45f4ad448afb20
import: refactor nocommit and importbranch handling

Patch

diff --git a/mercurial/cmdutil.py b/mercurial/cmdutil.py
--- a/mercurial/cmdutil.py
+++ b/mercurial/cmdutil.py
@@ -877,6 +877,8 @@ 
     p1 = extractdata.get('p1')
     p2 = extractdata.get('p2')
 
+    nocommit = opts.get('no_commit')
+    importbranch = opts.get('import_branch')
     update = not opts.get('bypass')
     strip = opts["strip"]
     prefix = opts["prefix"]
@@ -931,7 +933,7 @@ 
             if p2 != parents[1]:
                 repo.setparents(p1.node(), p2.node())
 
-            if opts.get('exact') or opts.get('import_branch'):
+            if opts.get('exact') or importbranch:
                 repo.dirstate.setbranch(branch or 'default')
 
             partial = opts.get('partial', False)
@@ -946,7 +948,7 @@ 
                     rejects = True
 
             files = list(files)
-            if opts.get('no_commit'):
+            if nocommit:
                 if message:
                     msgs.append(message)
             else:
@@ -977,7 +979,7 @@ 
                 finally:
                     repo.ui.restoreconfig(allowemptyback)
         else:
-            if opts.get('exact') or opts.get('import_branch'):
+            if opts.get('exact') or importbranch:
                 branch = branch or 'default'
             else:
                 branch = p1.branch()
@@ -1002,7 +1004,7 @@ 
                 n = memctx.commit()
             finally:
                 store.close()
-        if opts.get('exact') and opts.get('no_commit'):
+        if opts.get('exact') and nocommit:
             # --exact with --no-commit is still useful in that it does merge
             # and branch bits
             ui.warn(_("warning: can't check exact import with --no-commit\n"))