Patchwork D8700: commitctx: document a fast path in _filecommit

login
register
mail settings
Submitter phabricator
Date July 8, 2020, 8:37 a.m.
Message ID <differential-rev-PHID-DREV-h7vhptzmpg4ylafhdnmo-req@mercurial-scm.org>
Download mbox | patch
Permalink /patch/46657/
State Superseded
Headers show

Comments

phabricator - July 8, 2020, 8:37 a.m.
marmoute created this revision.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.

REVISION SUMMARY
  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.

REPOSITORY
  rHG Mercurial

BRANCH
  default

REVISION DETAIL
  https://phab.mercurial-scm.org/D8700

AFFECTED FILES
  mercurial/localrepo.py

CHANGE DETAILS




To: marmoute, #hg-reviewers
Cc: mercurial-patches, mercurial-devel

Patch

diff --git a/mercurial/localrepo.py b/mercurial/localrepo.py
--- a/mercurial/localrepo.py
+++ b/mercurial/localrepo.py
@@ -2808,6 +2808,11 @@ 
         fparent1 = manifest1.get(fname, nullid)
         fparent2 = manifest2.get(fname, nullid)
         if isinstance(fctx, context.filectx):
+            # This block fast path most comparison, making the assumption that
+            # is a bare filectx is used, no merge happened on this file., and
+            # therefor they are chance of needing to a create a new file
+            # revision, even if the content was identical to one of the
+            # parents.
             node = fctx.filenode()
             if node in [fparent1, fparent2]:
                 self.ui.debug(b'reusing %s filelog entry\n' % fname)