changeset 45197:55464c0b3a89

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
author Pierre-Yves David <pierre-yves.david@octobus.net>
date Mon, 06 Jul 2020 22:46:49 +0200
parents c068e355cd71
children e2ec36167151
files mercurial/localrepo.py
diffstat 1 files changed, 5 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- 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