[PATCH 2 of 3] import: inline checkexact function

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


# HG changeset patch
# User Pierre-Yves David <pierre-yves.david at logilab.fr>
# Date 1366187114 -7200
#      Wed Apr 17 10:25:14 2013 +0200
# Node ID 66fdcdc7cb399d62bb7bcc4115df3a79c89196e8
# Parent  9d42bbd12d4340f81f080913d44f9fd212c6f30f
import: inline checkexact function

We have  sngle clal now. no need to make it a function.

diff --git a/mercurial/commands.py b/mercurial/commands.py
--- a/mercurial/commands.py
+++ b/mercurial/commands.py
@@ -3601,14 +3601,10 @@ def import_(ui, repo, patch1=None, *patc
     base = opts["base"]
     strip = opts["strip"]
     wlock = lock = tr = None
     msgs = []
 
-    def checkexact(repo, n, nodeid):
-        if opts.get('exact') and hex(n) != nodeid:
-            raise util.Abort(_('patch is damaged or loses information'))
-
     def tryone(ui, hunk, parents):
         tmpname, message, user, date, branch, nodeid, p1, p2 = \
             patch.extract(ui, hunk)
 
         if not tmpname:
@@ -3699,11 +3695,12 @@ def import_(ui, repo, patch1=None, *patc
                                               editor=cmdutil.commiteditor)
                     repo.savecommitmessage(memctx.description())
                     n = memctx.commit()
                 finally:
                     store.close()
-            checkexact(repo, n, nodeid)
+            if opts.get('exact') and hex(n) != nodeid:
+                raise util.Abort(_('patch is damaged or loses information'))
             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