[PATCH 3 of 5] import: refactor nocommit and importbranch handling
timeless
timeless at mozdev.org
Wed Dec 30 16:47:49 CST 2015
# HG changeset patch
# User timeless <timeless at mozdev.org>
# Date 1451509671 0
# Wed Dec 30 21:07:51 2015 +0000
# Node ID 0179b3fbf17aa787dce200d03d2deb924246fda5
# Parent 442c96941ae7ae28748567ab6c45f4ad448afb20
import: refactor nocommit and importbranch handling
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"))
More information about the Mercurial-devel
mailing list