Patchwork D9415: copies: fast path no-op merge

login
register
mail settings
Submitter phabricator
Date Nov. 27, 2020, 4:11 p.m.
Message ID <differential-rev-PHID-DREV-7lz55dwiyqfhel7uj7ho-req@mercurial-scm.org>
Download mbox | patch
Permalink /patch/47694/
State Superseded
Headers show

Comments

phabricator - Nov. 27, 2020, 4:11 p.m.
Alphare created this revision.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.

REVISION SUMMARY
  If the two sides of the merge are the same (they come an unaltered common
  ancestors) we don't need any merging.

REPOSITORY
  rHG Mercurial

BRANCH
  default

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

AFFECTED FILES
  mercurial/copies.py

CHANGE DETAILS




To: Alphare, #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
@@ -391,6 +391,9 @@ 
             othercopies = all_copies.get(c)
             if othercopies is None:
                 all_copies[c] = newcopies
+            elif newcopies is othercopies:
+                # nothing to merge:
+                pass
             else:
                 # we are the second parent to work on c, we need to merge our
                 # work with the other.