Patchwork D8701: commitctx: reorder some conditional for efficiency in _filecommit

login
register
mail settings
Submitter phabricator
Date July 8, 2020, 8:37 a.m.
Message ID <differential-rev-PHID-DREV-b2zn2hof3wdat4zi7nld-req@mercurial-scm.org>
Download mbox | patch
Permalink /patch/46658/
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
  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.

REPOSITORY
  rHG Mercurial

BRANCH
  default

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

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
@@ -2904,7 +2904,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?