From patchwork Thu Dec 31 06:47:17 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: [3,of,6,v2] import: refactor nocommit and importbranch handling From: timeless@mozdev.org X-Patchwork-Id: 12442 Message-Id: <0179b3fbf17aa787dce2.1451544437@waste.org> To: mercurial-devel@selenic.com Date: Thu, 31 Dec 2015 00:47:17 -0600 # HG changeset patch # User timeless # 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"))