Patchwork D11551: dirstate: remove a update_file's special case for `merged` file

login
register
mail settings
Submitter phabricator
Date Oct. 1, 2021, 6:40 p.m.
Message ID <differential-rev-PHID-DREV-le25h2zaylwq6knkqlow-req@mercurial-scm.org>
Download mbox | patch
Permalink /patch/49876/
State Superseded
Headers show

Comments

phabricator - Oct. 1, 2021, 6:40 p.m.
marmoute created this revision.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.

REVISION SUMMARY
  This case was fishy and can be dealt with by passing more accurate data a higher
  level.
  
  This clarify the API and prepare for a larger rework of the data we feeds to
  the dirstate.

REPOSITORY
  rHG Mercurial

BRANCH
  default

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

AFFECTED FILES
  mercurial/dirstatemap.py
  mercurial/mergestate.py

CHANGE DETAILS




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

Patch

diff --git a/mercurial/mergestate.py b/mercurial/mergestate.py
--- a/mercurial/mergestate.py
+++ b/mercurial/mergestate.py
@@ -821,8 +821,15 @@ 
         if branchmerge:
             # We've done a branch merge, mark this file as merged
             # so that we properly record the merger later
+            p1_tracked = f1 == f
+            p2_tracked = f2 == f
             repo.dirstate.update_file(
-                f, p1_tracked=True, wc_tracked=True, merged=True
+                f,
+                p1_tracked=p1_tracked,
+                p2_tracked=p2_tracked,
+                wc_tracked=True,
+                merged=p1_tracked,
+                clean_p2=not p1_tracked,
             )
             if f1 != f2:  # copy/rename
                 if move:
diff --git a/mercurial/dirstatemap.py b/mercurial/dirstatemap.py
--- a/mercurial/dirstatemap.py
+++ b/mercurial/dirstatemap.py
@@ -212,15 +212,7 @@ 
             self.copymap.pop(filename, None)
             return
         elif merged:
-            # XXX might be merged and removed ?
-            entry = self.get(filename)
-            if entry is None or not entry.tracked:
-                # XXX mostly replicate dirstate.other parent.  We should get
-                # the higher layer to pass us more reliable data where `merged`
-                # actually mean merged. Dropping this clause will show failure
-                # in `test-graft.t`
-                merged = False
-                clean_p2 = True
+            pass
         elif not (p1_tracked or p2_tracked) and wc_tracked:
             pass  # file is added, nothing special to adjust
         elif (p1_tracked or p2_tracked) and not wc_tracked: