# HG changeset patch # User Pierre-Yves David <pierre-yves.da...@octobus.net> # Date 1595541503 -7200 # Thu Jul 23 23:58:23 2020 +0200 # Node ID 8c926a9ea89ea18ba068fd59314b73d7f6f7db27 # Parent 8bd4fa80f2550e94ab3592ae6543649bf8af5449 # EXP-Topic commitctx-cleanup-2 # Available At https://foss.heptapod.net/octobus/mercurial-devel/ # hg pull https://foss.heptapod.net/octobus/mercurial-devel/ -r 8c926a9ea89e 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. diff --git a/mercurial/commit.py b/mercurial/commit.py --- a/mercurial/commit.py +++ b/mercurial/commit.py @@ -63,14 +63,14 @@ def commitctx(repo, ctx, error=False, or 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') _______________________________________________ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel