[PATCH 1 of 3] import: factor out checkexact

pierre-yves.david at logilab.fr pierre-yves.david at logilab.fr
Wed Apr 17 03:57:46 CDT 2013


# HG changeset patch
# User Pierre-Yves David <pierre-yves.david at 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.

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:


More information about the Mercurial-devel mailing list