changeset 26579:dc2b8c005697

cmdutil: stop tryimportone from using dirstateguard (BC) There is no user of 'cmdutil.tryimportone()' other than 'commands.import_()', which can restore dirstate at failure of applying patches by transaction or dirstateguard. Therefore, it is reasonable to stop 'tryimportone()' from using redundant 'dirstateguard', even though it changes behavior of 'tryimportone()'. After this patch, 3rd party extensions should use 'dirstateguard' or so explicitly, if they want to restore dirstate at failure of importing a patch.
author FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
date Fri, 09 Oct 2015 03:53:46 +0900
parents 8bd2759f1fa7
children 4688945f316c
files mercurial/cmdutil.py
diffstat 1 files changed, 0 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/cmdutil.py	Fri Oct 09 03:53:46 2015 +0900
+++ b/mercurial/cmdutil.py	Fri Oct 09 03:53:46 2015 +0900
@@ -890,7 +890,6 @@
     msg = _('applied to working directory')
 
     rejects = False
-    dsguard = None
 
     try:
         cmdline_message = logmessage(ui, opts)
@@ -932,7 +931,6 @@
 
         n = None
         if update:
-            dsguard = dirstateguard(repo, 'tryimportone')
             if p1 != parents[0]:
                 updatefunc(repo, p1.node())
             if p2 != parents[1]:
@@ -983,7 +981,6 @@
                         extrapostimportmap[idfunc](repo[n])
                 finally:
                     repo.ui.restoreconfig(allowemptyback)
-            dsguard.close()
         else:
             if opts.get('exact') or opts.get('import_branch'):
                 branch = branch or 'default'
@@ -1021,7 +1018,6 @@
             msg = _('created %s') % short(n)
         return (msg, n, rejects)
     finally:
-        lockmod.release(dsguard)
         os.unlink(tmpname)
 
 # facility to let extensions include additional data in an exported patch