Patchwork [1,of,3] import: factor out checkexact

login
register
mail settings
Submitter Pierre-Yves David
Date April 17, 2013, 8:57 a.m.
Message ID <9d42bbd12d4340f81f08.1366189066@crater1.logilab.fr>
Download mbox | patch
Permalink /patch/1378/
State Accepted
Commit 3af92401efb32d713a6ab9f905ef19c6911b8a5e
Headers show

Comments

Pierre-Yves David - April 17, 2013, 8:57 a.m.
# HG changeset patch
# User Pierre-Yves David <pierre-yves.david@logilab.fr>
# Date 1366186948 -7200
#      Wed Apr 17 10:22:28 2013 +0200
# Node ID 9d42bbd12d4340f81f080913d44f9fd212c6f30f
# Parent  ab04e87a5f3bcee588b72d615e1aeb42f10d3b99
import: factor out checkexact

The two call are strictly identical. We can simply move it after the if/else
clause.

Patch

diff --git a/mercurial/commands.py b/mercurial/commands.py
--- a/mercurial/commands.py
+++ b/mercurial/commands.py
@@ -3676,11 +3676,10 @@  def import_(ui, repo, patch1=None, *patc
                     else:
                         m = scmutil.matchfiles(repo, files or [])
                     n = repo.commit(message, opts.get('user') or user,
                                     opts.get('date') or date, match=m,
                                     editor=editor)
-                    checkexact(repo, n, nodeid)
             else:
                 if opts.get('exact') or opts.get('import_branch'):
                     branch = branch or 'default'
                 else:
                     branch = p1.branch()
@@ -3698,13 +3697,13 @@  def import_(ui, repo, patch1=None, *patc
                                               opts.get('date') or date,
                                               branch, files, store,
                                               editor=cmdutil.commiteditor)
                     repo.savecommitmessage(memctx.description())
                     n = memctx.commit()
-                    checkexact(repo, n, nodeid)
                 finally:
                     store.close()
+            checkexact(repo, n, nodeid)
             if n:
                 # i18n: refers to a short changeset id
                 msg = _('created %s') % short(n)
             return (msg, n)
         finally: