changeset 25758:c5dfa47ad7ee

cmdutil: put recordfunc invocation into wlock scope for consistency Before this patch, 'recordfunc()' for interactive hunk selection does below outside wlock scope at 'hg commit -i' and so on: - backup files, which may be partially changed - apply selected hunks on files - restore files from backup-ed ones These should be executed inside wlock scope for consistency. To put them into wlock scope without largely changing indents in 'recordfunc()', this patch adds another wrapper function. This patch is also a preparation for subsequent patch fixing the issue to correctly recognize partially committed files as "modified".
author FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
date Wed, 08 Jul 2015 17:01:09 +0900
parents 4d1382fd96ff
children ff11c1565c04
files mercurial/cmdutil.py
diffstat 1 files changed, 8 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/cmdutil.py	Wed Jul 08 17:01:09 2015 +0900
+++ b/mercurial/cmdutil.py	Wed Jul 08 17:01:09 2015 +0900
@@ -220,7 +220,14 @@
             except OSError:
                 pass
 
-    return commit(ui, repo, recordfunc, pats, opts)
+    def recordinwlock(ui, repo, message, match, opts):
+        wlock = repo.wlock()
+        try:
+            return recordfunc(ui, repo, message, match, opts)
+        finally:
+            wlock.release()
+
+    return commit(ui, repo, recordinwlock, pats, opts)
 
 def findpossible(cmd, table, strict=False):
     """