# HG changeset patch # User Pierre-Yves David # Date 1594068409 -7200 # Node ID 55464c0b3a89c52672e1fe816fddf4e391a51768 # Parent c068e355cd71b30f5f9a0cb20ff82956b7b14acd commitctx: move a tiny else clause above the very long one This is simple to have all the simple case unfold before the 100+ line one. Otherwise it is hard to relate the `else` to the initial conditionnal. This is part of a larger refactoring/cleanup of the commitctx code to clarify and augment the logic gathering metadata useful for copy tracing. The current code is a tad too long and entangled to make such update easy. We start with easy and small cleanup. Differential Revision: https://phab.mercurial-scm.org/D8708 diff -r c068e355cd71 -r 55464c0b3a89 mercurial/localrepo.py --- a/mercurial/localrepo.py Mon Jul 06 22:37:53 2020 +0200 +++ b/mercurial/localrepo.py Mon Jul 06 22:46:49 2020 +0200 @@ -3109,7 +3109,11 @@ if writechangesetcopy: filesadded = ctx.filesadded() filesremoved = ctx.filesremoved() - elif ctx.files(): + elif not ctx.files(): + self.ui.debug(b'reusing manifest from p1 (no file change)\n') + mn = p1.manifestnode() + files = [] + else: m1ctx = p1.manifestctx() m2ctx = p2.manifestctx() mctx = m1ctx.copy() @@ -3205,10 +3209,6 @@ b'actually unchanged)\n' ) mn = p1.manifestnode() - else: - self.ui.debug(b'reusing manifest from p1 (no file change)\n') - mn = p1.manifestnode() - files = [] if writecopiesto == b'changeset-only': # If writing only to changeset extras, use None to indicate that