strip: with --keep, consider all revs "removed" from the wcp (issue6270) stable
authorPierre-Yves David <pierre-yves.david@octobus.net>
Fri, 18 Sep 2020 12:20:28 +0200
branchstable
changeset 45509 2bc978921e8a
parent 45508 27822b8436bf
child 45514 93a0f3ba36bb
child 45522 5a555d6e0d90
strip: with --keep, consider all revs "removed" from the wcp (issue6270) The current code was blink to change from other branches when stripping merges that are ancestors of the working copy parents.
hgext/strip.py
tests/test-strip.t
--- a/hgext/strip.py	Fri Sep 18 12:10:12 2020 +0200
+++ b/hgext/strip.py	Fri Sep 18 12:20:28 2020 +0200
@@ -254,7 +254,7 @@
 
             # only reset the dirstate for files that would actually change
             # between the working context and uctx
-            descendantrevs = repo.revs(b"%d::.", uctx.rev())
+            descendantrevs = repo.revs(b"only(., %d)", uctx.rev())
             changedfiles = []
             for rev in descendantrevs:
                 # blindly reset the files, regardless of what actually changed
--- a/tests/test-strip.t	Fri Sep 18 12:10:12 2020 +0200
+++ b/tests/test-strip.t	Fri Sep 18 12:20:28 2020 +0200
@@ -1179,7 +1179,11 @@
 
 stripping a set containing a merge properly reset file content, including items on other branches
 
-BROKEN, The added file should move to unknown, which is the behavior we have been seeing for other `hg strip --keep` call.
+The added file is moved to unknown, which is the behavior we have been seeing for other `hg strip --keep` call.
+
+stripping a set containing a merge properly reset file content, including items on other branches
+
+The added file is moved to unknown, which is the behavior we have been seeing for other `hg strip --keep` call.
 
   $ hg unbundle -u $TESTTMP/issue4736/.hg/strip-backup/35358f982181-a6f020aa-backup.hg
   adding changesets
@@ -1260,13 +1264,10 @@
      summary:     commitA
   
 
-BROKEN: 'bar.txt' cannot possibly be clean since it is not part of the current
-working copy parents.
-
   $ hg status -A
+  ? bar.txt
   C a
   C b
-  C bar.txt
   C foo.txt
   $ cat bar.txt
   bar