pick: don't create any successors when there were no changes (issue6093) stable
authorAnton Shestakov <av6@dwimlabs.net>
Mon, 07 Oct 2019 14:38:56 +0700
branchstable
changeset 4891 a9929dd36405
parent 4890 a8fa397795c1
child 4892 38079b848657
child 4895 92d617c7be66
pick: don't create any successors when there were no changes (issue6093) For example, when a changeset that user is trying to pick was already grafted or rebased (and no obsmarkers were created), pick will naturally say that there's no changes to commit and will not create the new commit. In that case it should not mark any changeset as a successor of the picked changeset, because the actual file changes were already there before picking. Technically, pick could (and did before this patch) mark the wdir commit as a successor of picked changeset (may be useful in the most trivial cases when e.g. wdir is a graft of the required change), but there are cases when the picked change is introduced in an ancestor of wdir, or even in multiple ancestors piece by piece. Pick definitely shouldn't be trying to guess something this complicated, so with this patch it always marks the picked change as pruned if it gave no changes to commit.
CHANGELOG
hgext3rd/evolve/cmdrewrite.py
tests/test-pick.t
--- a/CHANGELOG	Sat Oct 05 14:26:19 2019 -0400
+++ b/CHANGELOG	Mon Oct 07 14:38:56 2019 +0700
@@ -1,6 +1,11 @@
 Changelog
 =========
 
+9.2.2 - in progress
+-------------------
+
+  * pick: don't create any successors when there were no changes (issue6093),
+
 9.2.1 -- 2019-10-05
 -------------------
 
--- a/hgext3rd/evolve/cmdrewrite.py	Sat Oct 05 14:26:19 2019 -0400
+++ b/hgext3rd/evolve/cmdrewrite.py	Mon Oct 07 14:38:56 2019 +0700
@@ -1519,8 +1519,11 @@
 
         if pickstate:
             pickstate.delete()
-        newctx = repo[newnode] if newnode else pctx
-        replacements = {origctx.node(): [newctx.node()]}
+        if newnode is None:
+            replacements = {origctx.node(): []}
+        else:
+            newctx = repo[newnode]
+            replacements = {origctx.node(): [newctx.node()]}
         scmutil.cleanupnodes(repo, replacements, operation=b"pick")
 
         if newnode is None:
--- a/tests/test-pick.t	Sat Oct 05 14:26:19 2019 -0400
+++ b/tests/test-pick.t	Mon Oct 07 14:38:56 2019 +0700
@@ -172,6 +172,17 @@
   |
   o  0:1f0dee641bb7 add a
   
+
+there were no changes to commit, so there shouldn't be any predecessors of 6,
+and 2 should say it was pruned (issue6093)
+
+  $ hg olog --all --hidden -r 2+6
+  x  4538525df7e2 (2) add c
+       pruned using pick by test (Thu Jan 01 00:00:00 1970 +0000)
+  
+  @  c4636a81ebeb (6) add c
+  
+
 interrupted pick
 
   $ hg up d46dc301d92f