changeset 45065:b8f4ead9fa49

commitctx: reorder some conditional for efficiency in _filecommit Checking if a dict is empty will be faster than comparing text. I don't expect it to be a huge performance win, but still a good (but gratuitous) cleanup to do while we are at it. 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/D8701
author Pierre-Yves David <pierre-yves.david@octobus.net>
date Mon, 06 Jul 2020 19:16:04 +0200
parents 41b32cbc53f8
children 5a80915e99ce
files mercurial/localrepo.py
diffstat 1 files changed, 1 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/localrepo.py	Mon Jul 06 18:52:19 2020 +0200
+++ b/mercurial/localrepo.py	Mon Jul 06 19:16:04 2020 +0200
@@ -2899,7 +2899,7 @@
 
         # is the file changed?
         text = fctx.data()
-        if fparent2 != nullid or flog.cmp(fparent1, text) or meta:
+        if fparent2 != nullid or meta or flog.cmp(fparent1, text):
             changelist.append(fname)
             return flog.add(text, meta, tr, linkrev, fparent1, fparent2)
         # are just the flags changed during merge?