Patchwork D9141: copies: move `merged` testing sooner

login
register
mail settings
Submitter phabricator
Date Oct. 1, 2020, 2:09 p.m.
Message ID <differential-rev-PHID-DREV-ekhxuikuq5szz3a3lzpc-req@mercurial-scm.org>
Download mbox | patch
Permalink /patch/47361/
State Superseded
Headers show

Comments

phabricator - Oct. 1, 2020, 2:09 p.m.
marmoute created this revision.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.

REVISION SUMMARY
  previously `is_merged` was an expensive callback. Now that all this data is
  pre-computed, this is is a simple membership testing.
  
  So it is probably cheaper than the membership testing.

REPOSITORY
  rHG Mercurial

BRANCH
  default

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

AFFECTED FILES
  mercurial/copies.py

CHANGE DETAILS




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

Patch

diff --git a/mercurial/copies.py b/mercurial/copies.py
--- a/mercurial/copies.py
+++ b/mercurial/copies.py
@@ -397,9 +397,9 @@ 
                 and dest in changes.salvaged
             ):
                 minor[dest] = value
-            elif not isancestor(new_tt, other_tt):
+            elif changes is not None and dest in changes.merged:
                 minor[dest] = value
-            elif changes is not None and dest in changes.merged:
+            elif not isancestor(new_tt, other_tt):
                 minor[dest] = value