[PATCH 2 of 2 STABLE] strip: with --keep, consider all revs "removed" from the wcp (issue6270)

Pierre-Yves David pierre-yves.david at ens-lyon.org
Fri Sep 18 11:24:00 UTC 2020


# HG changeset patch
# User Pierre-Yves David <pierre-yves.david at octobus.net>
# Date 1600424428 -7200
#      Fri Sep 18 12:20:28 2020 +0200
# Branch stable
# Node ID 0ab4de944df3afdac347e1b365da4518c547528d
# Parent  dc7e034e4408b42fedf1233961acba1dd643d85e
# EXP-Topic issue6270
# Available At https://foss.heptapod.net/octobus/mercurial-devel/
#              hg pull https://foss.heptapod.net/octobus/mercurial-devel/ -r 0ab4de944df3
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.

diff --git a/hgext/strip.py b/hgext/strip.py
--- a/hgext/strip.py
+++ b/hgext/strip.py
@@ -254,7 +254,7 @@ def stripcmd(ui, repo, *revs, **opts):
 
             # 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
diff --git a/tests/test-strip.t b/tests/test-strip.t
--- a/tests/test-strip.t
+++ b/tests/test-strip.t
@@ -1179,7 +1179,11 @@ test stripping a working directory paren
 
 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 @@ BROKEN, The added file should move to un
      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




More information about the Mercurial-devel mailing list