comparison mercurial/localrepo.py @ 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 31393ec06cef
comparison
equal deleted inserted replaced
45196:c068e355cd71 45197:55464c0b3a89
3107 mn = ctx.manifestnode() 3107 mn = ctx.manifestnode()
3108 files = ctx.files() 3108 files = ctx.files()
3109 if writechangesetcopy: 3109 if writechangesetcopy:
3110 filesadded = ctx.filesadded() 3110 filesadded = ctx.filesadded()
3111 filesremoved = ctx.filesremoved() 3111 filesremoved = ctx.filesremoved()
3112 elif ctx.files(): 3112 elif not ctx.files():
3113 self.ui.debug(b'reusing manifest from p1 (no file change)\n')
3114 mn = p1.manifestnode()
3115 files = []
3116 else:
3113 m1ctx = p1.manifestctx() 3117 m1ctx = p1.manifestctx()
3114 m2ctx = p2.manifestctx() 3118 m2ctx = p2.manifestctx()
3115 mctx = m1ctx.copy() 3119 mctx = m1ctx.copy()
3116 3120
3117 m = mctx.read() 3121 m = mctx.read()
3203 self.ui.debug( 3207 self.ui.debug(
3204 b'reusing manifest from p1 (listed files ' 3208 b'reusing manifest from p1 (listed files '
3205 b'actually unchanged)\n' 3209 b'actually unchanged)\n'
3206 ) 3210 )
3207 mn = p1.manifestnode() 3211 mn = p1.manifestnode()
3208 else:
3209 self.ui.debug(b'reusing manifest from p1 (no file change)\n')
3210 mn = p1.manifestnode()
3211 files = []
3212 3212
3213 if writecopiesto == b'changeset-only': 3213 if writecopiesto == b'changeset-only':
3214 # If writing only to changeset extras, use None to indicate that 3214 # If writing only to changeset extras, use None to indicate that
3215 # no entry should be written. If writing to both, write an empty 3215 # no entry should be written. If writing to both, write an empty
3216 # entry to prevent the reader from falling back to reading 3216 # entry to prevent the reader from falling back to reading