changeset 45238:bd7515273fd6

commitctx: gather more preparation code within the lock context This is a small change that exist mostly for clarification. I am about to move a large amount of code in its own function. having all that code next to each other will make the next changeset clearer.
author Pierre-Yves David <pierre-yves.david@octobus.net>
date Thu, 23 Jul 2020 23:58:23 +0200
parents 39f4ec4039a8
children 13814622b3b1
files mercurial/commit.py
diffstat 1 files changed, 7 insertions(+), 7 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/commit.py	Thu Jul 23 23:40:59 2020 +0200
+++ b/mercurial/commit.py	Thu Jul 23 23:58:23 2020 +0200
@@ -63,14 +63,14 @@
     p1, p2 = ctx.p1(), ctx.p2()
     user = ctx.user()
 
-    writechangesetcopy, writefilecopymeta = _write_copy_meta(repo)
+    with repo.lock(), repo.transaction(b"commit") as tr:
+        writechangesetcopy, writefilecopymeta = _write_copy_meta(repo)
 
-    p1copies, p2copies = None, None
-    if writechangesetcopy:
-        p1copies = ctx.p1copies()
-        p2copies = ctx.p2copies()
-    filesadded, filesremoved = None, None
-    with repo.lock(), repo.transaction(b"commit") as tr:
+        p1copies, p2copies = None, None
+        if writechangesetcopy:
+            p1copies = ctx.p1copies()
+            p2copies = ctx.p2copies()
+        filesadded, filesremoved = None, None
         if ctx.manifestnode():
             # reuse an existing manifest revision
             repo.ui.debug(b'reusing known manifest\n')