changeset 45238:31393ec06cef

commitctx: document a fast path in _filecommit This block cut off a lot of logic, documenting the why and how seems useful to future reader. 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/D8700
author Pierre-Yves David <pierre-yves.david@octobus.net>
date Mon, 06 Jul 2020 19:13:19 +0200
parents 86f9b25d750b
children ae5c1a3bc339
files mercurial/localrepo.py
diffstat 1 files changed, 3 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/localrepo.py	Tue Jul 21 13:36:48 2020 -0700
+++ b/mercurial/localrepo.py	Mon Jul 06 19:13:19 2020 +0200
@@ -2802,6 +2802,9 @@
             touched = 'added'
 
         if isinstance(fctx, context.filectx):
+            # This block fast path most comparisons which are usually done. It
+            # assumes that bare filectx is used and no merge happened, hence no
+            # need to create a new file revision in this case.
             node = fctx.filenode()
             if node in [fparent1, fparent2]:
                 self.ui.debug(b'reusing %s filelog entry\n' % fname)