revert: detect files added during a merge
authorPierre-Yves David <pierre-yves.david@fb.com>
Tue, 24 Jun 2014 17:28:20 +0100
changeset 22209 06fbd9518bc5
parent 22208 d3659b3795e9
child 22210 537f55a27101
revert: detect files added during a merge In case of merge, file that are actually added can be reported as modified. This is currently handled by special-case code. We detect it beforehand instead. This will lets use remove the special-case code at some point in the future.
mercurial/cmdutil.py
--- a/mercurial/cmdutil.py	Sat Aug 02 11:32:24 2014 -0700
+++ b/mercurial/cmdutil.py	Tue Jun 24 17:28:20 2014 +0100
@@ -2435,6 +2435,17 @@
             # So we just put them all in the same group.
             dsadded = added
 
+        # in case of merge, files that are actually added can be reported as
+        # modified, we need to post process the result
+        if p2 != nullid:
+            if pmf is None:
+                # only need parent manifest in the merge case,
+                # so do not read by default
+                pmf = repo[parent].manifest()
+            mergeadd = dsmodified - set(pmf)
+            dsadded |= mergeadd
+            dsmodified -= mergeadd
+
         # if f is a rename, update `names` to also revert the source
         cwd = repo.getcwd()
         for f in dsadded: