diff tests/test-evolve-content-divergent-corner-cases.t @ 5293:13376ca93fa3

evolve: always create commit when resolving divergence When resolving content-divergence, the final commit we create may end up empty (which means that Mercurial won't even create it). We've had code for handling that in evolve ever since 41bf6c27a122 (evolve: stabilize now handle conflicting changeset, 2012-08-23). However, that resolved the issue by marking on the divergent commits as successor. As Pierre-Yves has pointed out (in other code reviews), we should instead be creating a new successor. So that's what this patch does. It does that by setting `ui.allowemptycommit` while creating the final commit. However, that is not enough, because we may end up creating the same nodeid as already existed (we'd then end up trying to mark the "new" commit a successor of itself). To solve that, we add some salt to the commit extras. That salt affects lots of tests.
author Martin von Zweigbergk <martinvonz@google.com>
date Thu, 30 Apr 2020 10:05:14 -0700
parents c834fdb87f90
children 142827ad86f3
line wrap: on
line diff
--- a/tests/test-evolve-content-divergent-corner-cases.t	Tue May 05 16:29:52 2020 +0800
+++ b/tests/test-evolve-content-divergent-corner-cases.t	Thu Apr 30 10:05:14 2020 -0700
@@ -79,25 +79,25 @@
   with: [3] divergent
   base: [1] added b
   1 files updated, 0 files merged, 0 files removed, 0 files unresolved
-  working directory is now at 45bf1312f454
+  working directory is now at cfcd9a3d0588
   $ hg log -G
-  @  4:45bf1312f454@default(draft) divergent []
+  @  4:cfcd9a3d0588@default(draft) divergent []
   |
   o  0:9092f1db7931@default(draft) added a []
   
   $ hg debugobsolete
   5f6d8a4bf34ab274ccc9f631c2536964b8a3666d 8374d2ddc3a4d48428c3d2f80e4fc86f13736f96 0 (Thu Jan 01 00:00:00 1970 +0000) {'ef1': '9', 'operation': 'prune', 'user': 'test'}
   5f6d8a4bf34ab274ccc9f631c2536964b8a3666d 593c57f2117e33dd0884382f02789d948f548557 0 (Thu Jan 01 00:00:00 1970 +0000) {'ef1': '9', 'operation': 'prune', 'user': 'test'}
-  593c57f2117e33dd0884382f02789d948f548557 45bf1312f45468b76158b33f8426e6530c8b35b1 0 (Thu Jan 01 00:00:00 1970 +0000) {'ef1': '8', 'operation': 'evolve', 'user': 'test'}
-  8374d2ddc3a4d48428c3d2f80e4fc86f13736f96 45bf1312f45468b76158b33f8426e6530c8b35b1 0 (Thu Jan 01 00:00:00 1970 +0000) {'ef1': '8', 'operation': 'evolve', 'user': 'test'}
+  593c57f2117e33dd0884382f02789d948f548557 cfcd9a3d0588dd3abd278373246f2bdd6a646647 0 (Thu Jan 01 00:00:00 1970 +0000) {'ef1': '10', 'operation': 'evolve', 'user': 'test'}
+  8374d2ddc3a4d48428c3d2f80e4fc86f13736f96 cfcd9a3d0588dd3abd278373246f2bdd6a646647 0 (Thu Jan 01 00:00:00 1970 +0000) {'ef1': '10', 'operation': 'evolve', 'user': 'test'}
   $ hg obslog --all
-  @    45bf1312f454 (4) divergent
+  @    cfcd9a3d0588 (4) divergent
   |\
   x |  593c57f2117e (2) divergent
-  | |    amended(content) as 45bf1312f454 using evolve by test (Thu Jan 01 00:00:00 1970 +0000)
+  | |    rewritten(meta, content) as cfcd9a3d0588 using evolve by test (Thu Jan 01 00:00:00 1970 +0000)
   | |
   | x  8374d2ddc3a4 (3) divergent
-  |/     amended(content) as 45bf1312f454 using evolve by test (Thu Jan 01 00:00:00 1970 +0000)
+  |/     rewritten(meta, content) as cfcd9a3d0588 using evolve by test (Thu Jan 01 00:00:00 1970 +0000)
   |
   x  5f6d8a4bf34a (1) added b
        rewritten(description, content) as 593c57f2117e using prune by test (Thu Jan 01 00:00:00 1970 +0000)
@@ -132,7 +132,7 @@
   |/
   | o  5:48819a835615@default(draft) add _c []
   |/
-  | o  4:45bf1312f454@default(draft) divergent []
+  | o  4:cfcd9a3d0588@default(draft) divergent []
   |/
   o  0:9092f1db7931@default(draft) added a []
   
@@ -148,7 +148,7 @@
   |
   | *  6:e3ff64ce8d4c@default(draft) add cdivergent1 [content-divergent]
   |/
-  | o  4:45bf1312f454@default(draft) divergent []
+  | o  4:cfcd9a3d0588@default(draft) divergent []
   |/
   o  0:9092f1db7931@default(draft) added a []
   
@@ -157,31 +157,32 @@
   with: [7] add _c
   base: [5] add _c
   0 files updated, 0 files merged, 0 files removed, 0 files unresolved
-  nothing changed
-  working directory is now at e3ff64ce8d4c
+  working directory is now at c7cbb2f2c5ac
 
   $ hg log -G
-  @  6:e3ff64ce8d4c@default(draft) add cdivergent1 []
+  @  8:c7cbb2f2c5ac@default(draft) add cdivergent1 []
   |
-  | o  4:45bf1312f454@default(draft) divergent []
+  | o  4:cfcd9a3d0588@default(draft) divergent []
   |/
   o  0:9092f1db7931@default(draft) added a []
   
   $ hg debugobsolete
   5f6d8a4bf34ab274ccc9f631c2536964b8a3666d 8374d2ddc3a4d48428c3d2f80e4fc86f13736f96 0 (Thu Jan 01 00:00:00 1970 +0000) {'ef1': '9', 'operation': 'prune', 'user': 'test'}
   5f6d8a4bf34ab274ccc9f631c2536964b8a3666d 593c57f2117e33dd0884382f02789d948f548557 0 (Thu Jan 01 00:00:00 1970 +0000) {'ef1': '9', 'operation': 'prune', 'user': 'test'}
-  593c57f2117e33dd0884382f02789d948f548557 45bf1312f45468b76158b33f8426e6530c8b35b1 0 (Thu Jan 01 00:00:00 1970 +0000) {'ef1': '8', 'operation': 'evolve', 'user': 'test'}
-  8374d2ddc3a4d48428c3d2f80e4fc86f13736f96 45bf1312f45468b76158b33f8426e6530c8b35b1 0 (Thu Jan 01 00:00:00 1970 +0000) {'ef1': '8', 'operation': 'evolve', 'user': 'test'}
+  593c57f2117e33dd0884382f02789d948f548557 cfcd9a3d0588dd3abd278373246f2bdd6a646647 0 (Thu Jan 01 00:00:00 1970 +0000) {'ef1': '10', 'operation': 'evolve', 'user': 'test'}
+  8374d2ddc3a4d48428c3d2f80e4fc86f13736f96 cfcd9a3d0588dd3abd278373246f2bdd6a646647 0 (Thu Jan 01 00:00:00 1970 +0000) {'ef1': '10', 'operation': 'evolve', 'user': 'test'}
   48819a83561596ef0aeac4082eaaa8afe4320f3a b2ae71172042972a8e8d2bc11e2b2fe4e0c3aa49 0 (Thu Jan 01 00:00:00 1970 +0000) {'ef1': '8', 'operation': 'prune', 'user': 'test'}
   48819a83561596ef0aeac4082eaaa8afe4320f3a e3ff64ce8d4ce33b40d9f367a8ec472fec588ca3 0 (Thu Jan 01 00:00:00 1970 +0000) {'ef1': '9', 'operation': 'prune', 'user': 'test'}
-  b2ae71172042972a8e8d2bc11e2b2fe4e0c3aa49 e3ff64ce8d4ce33b40d9f367a8ec472fec588ca3 0 (Thu Jan 01 00:00:00 1970 +0000) {'ef1': '1', 'operation': 'evolve', 'user': 'test'}
-BROKEN: We should have created a new commit as successor instead of reusing
-revision 6
+  e3ff64ce8d4ce33b40d9f367a8ec472fec588ca3 c7cbb2f2c5ac9b4f3433a08a51527d6544d79096 0 (Thu Jan 01 00:00:00 1970 +0000) {'ef1': '2', 'operation': 'evolve', 'user': 'test'}
+  b2ae71172042972a8e8d2bc11e2b2fe4e0c3aa49 c7cbb2f2c5ac9b4f3433a08a51527d6544d79096 0 (Thu Jan 01 00:00:00 1970 +0000) {'ef1': '3', 'operation': 'evolve', 'user': 'test'}
   $ hg obslog --all
-  @    e3ff64ce8d4c (6) add cdivergent1
+  @    c7cbb2f2c5ac (8) add cdivergent1
   |\
-  | x  b2ae71172042 (7) add _c
-  |/     reworded(description) as e3ff64ce8d4c using evolve by test (Thu Jan 01 00:00:00 1970 +0000)
+  x |  b2ae71172042 (7) add _c
+  | |    rewritten(description, meta) as c7cbb2f2c5ac using evolve by test (Thu Jan 01 00:00:00 1970 +0000)
+  | |
+  | x  e3ff64ce8d4c (6) add cdivergent1
+  |/     meta-changed(meta) as c7cbb2f2c5ac using evolve by test (Thu Jan 01 00:00:00 1970 +0000)
   |
   x  48819a835615 (5) add _c
        amended(content) as b2ae71172042 using prune by test (Thu Jan 01 00:00:00 1970 +0000)
@@ -253,26 +254,26 @@
   with: [3] bdivergent
   base: [1] add _b
   1 files updated, 0 files merged, 0 files removed, 0 files unresolved
-  working directory is now at 73ff357d3975
+  working directory is now at e9189d547f9f
 
   $ hg log -G
-  @  4:73ff357d3975@default(draft) bdivergent []
+  @  4:e9189d547f9f@default(draft) bdivergent []
   |
   o  0:135f39f4bd78@default(draft) add _a []
   
   $ hg debugobsolete
   37445b16603b50165d5eb80735fb986c72a2dac1 6b096fb450709a194b21fb9b192fe9b1572c4af0 0 (Thu Jan 01 00:00:00 1970 +0000) {'ef1': '9', 'operation': 'prune', 'user': 'test'}
   37445b16603b50165d5eb80735fb986c72a2dac1 05a6b6a9e633802d2bdd06e6d292982a767d930e 0 (Thu Jan 01 00:00:00 1970 +0000) {'ef1': '9', 'operation': 'prune', 'user': 'test'}
-  05a6b6a9e633802d2bdd06e6d292982a767d930e 73ff357d3975b9f319b59fd5853abc3c8294ae89 0 (Thu Jan 01 00:00:00 1970 +0000) {'ef1': '8', 'operation': 'evolve', 'user': 'test'}
-  6b096fb450709a194b21fb9b192fe9b1572c4af0 73ff357d3975b9f319b59fd5853abc3c8294ae89 0 (Thu Jan 01 00:00:00 1970 +0000) {'ef1': '8', 'operation': 'evolve', 'user': 'test'}
+  05a6b6a9e633802d2bdd06e6d292982a767d930e e9189d547f9f578af31ea4ff8be2ba3a8bd95e7a 0 (Thu Jan 01 00:00:00 1970 +0000) {'ef1': '10', 'operation': 'evolve', 'user': 'test'}
+  6b096fb450709a194b21fb9b192fe9b1572c4af0 e9189d547f9f578af31ea4ff8be2ba3a8bd95e7a 0 (Thu Jan 01 00:00:00 1970 +0000) {'ef1': '10', 'operation': 'evolve', 'user': 'test'}
   $ hg obslog --all
-  @    73ff357d3975 (4) bdivergent
+  @    e9189d547f9f (4) bdivergent
   |\
   x |  05a6b6a9e633 (2) bdivergent
-  | |    amended(content) as 73ff357d3975 using evolve by test (Thu Jan 01 00:00:00 1970 +0000)
+  | |    rewritten(meta, content) as e9189d547f9f using evolve by test (Thu Jan 01 00:00:00 1970 +0000)
   | |
   | x  6b096fb45070 (3) bdivergent
-  |/     amended(content) as 73ff357d3975 using evolve by test (Thu Jan 01 00:00:00 1970 +0000)
+  |/     rewritten(meta, content) as e9189d547f9f using evolve by test (Thu Jan 01 00:00:00 1970 +0000)
   |
   x  37445b16603b (1) add _b
        rewritten(description, content) as 05a6b6a9e633 using prune by test (Thu Jan 01 00:00:00 1970 +0000)
@@ -355,10 +356,10 @@
   You can use (c)hanged version, leave (d)eleted, or leave (u)nresolved.
   What do you want to do? c
   0 files updated, 1 files merged, 0 files removed, 0 files unresolved
-  working directory is now at eb6357cd41b6
+  working directory is now at 5deaa504a865
 
   $ hg glog -l1
-  @  9:eb6357cd41b6 updated e
+  @  9:5deaa504a865 updated e
   |   () [default] draft
   ~
 
@@ -368,16 +369,16 @@
   9150fe93bec603cd88d05cda9f6ff13420cb53e9 0 {155349b645beebee15325a9a22dd0c9ef8fbbbd3} (Thu Jan 01 00:00:00 1970 +0000) {'ef1': '0', 'operation': 'prune', 'user': 'test'}
   ff6f7cd76a7c97d938e8fe87f0fc816b66929435 0ceb21ca2557a61433f097e4d64024e37cae2c10 0 (Thu Jan 01 00:00:00 1970 +0000) {'ef1': '4', 'operation': 'evolve', 'user': 'test'}
   de4ea3103326293994c634101e780724346ee89f a2465d1d56d1aee8ed90d2292978456d2be6f7b9 0 (Thu Jan 01 00:00:00 1970 +0000) {'ef1': '4', 'operation': 'evolve', 'user': 'test'}
-  0ceb21ca2557a61433f097e4d64024e37cae2c10 eb6357cd41b6a6ec2f12e81cf96eaeeb54b057d2 0 (Thu Jan 01 00:00:00 1970 +0000) {'ef1': '8', 'operation': 'evolve', 'user': 'test'}
-  a2465d1d56d1aee8ed90d2292978456d2be6f7b9 eb6357cd41b6a6ec2f12e81cf96eaeeb54b057d2 0 (Thu Jan 01 00:00:00 1970 +0000) {'ef1': '0', 'operation': 'evolve', 'user': 'test'}
+  0ceb21ca2557a61433f097e4d64024e37cae2c10 5deaa504a865ac3f3fe772c50a583a427aa76449 0 (Thu Jan 01 00:00:00 1970 +0000) {'ef1': '10', 'operation': 'evolve', 'user': 'test'}
+  a2465d1d56d1aee8ed90d2292978456d2be6f7b9 5deaa504a865ac3f3fe772c50a583a427aa76449 0 (Thu Jan 01 00:00:00 1970 +0000) {'ef1': '2', 'operation': 'evolve', 'user': 'test'}
   $ hg obslog --all
-  @    eb6357cd41b6 (9) updated e
+  @    5deaa504a865 (9) updated e
   |\
   x |  0ceb21ca2557 (7) updated e
-  | |    amended(content) as eb6357cd41b6 using evolve by test (Thu Jan 01 00:00:00 1970 +0000)
+  | |    rewritten(meta, content) as 5deaa504a865 using evolve by test (Thu Jan 01 00:00:00 1970 +0000)
   | |
   | x  a2465d1d56d1 (8) updated e
-  | |    rewritten as eb6357cd41b6 using evolve by test (Thu Jan 01 00:00:00 1970 +0000)
+  | |    meta-changed(meta) as 5deaa504a865 using evolve by test (Thu Jan 01 00:00:00 1970 +0000)
   | |
   | x  de4ea3103326 (6) updated e
   | |    rebased(parent) as a2465d1d56d1 using evolve by test (Thu Jan 01 00:00:00 1970 +0000)
@@ -440,9 +441,9 @@
   with: [3] delete a
   base: [1] delete a
   1 files updated, 0 files merged, 0 files removed, 0 files unresolved
-  working directory is now at 7ca6a9fafcf6
+  working directory is now at 48942a623d38
   $ hg glog
-  @  4:7ca6a9fafcf6 delete a
+  @  4:48942a623d38 delete a
   |   () [default] draft
   o  0:75d2b02c4a5c initial
       () [default] draft
@@ -458,16 +459,16 @@
   $ hg debugobsolete
   dff6e52f5e419381c070159c8038ac948f59283f 0825dcee2670349e749f1df45857fca34f61e350 0 (Thu Jan 01 00:00:00 1970 +0000) {'ef1': '8', 'operation': 'amend', 'user': 'test'}
   dff6e52f5e419381c070159c8038ac948f59283f 92ecd58f9b05d6c0a1c3833a79359eea4b0268ff 0 (Thu Jan 01 00:00:00 1970 +0000) {'ef1': '8', 'operation': 'amend', 'user': 'test'}
-  0825dcee2670349e749f1df45857fca34f61e350 7ca6a9fafcf619820b754070ac0b447651005422 0 (Thu Jan 01 00:00:00 1970 +0000) {'ef1': '8', 'operation': 'evolve', 'user': 'test'}
-  92ecd58f9b05d6c0a1c3833a79359eea4b0268ff 7ca6a9fafcf619820b754070ac0b447651005422 0 (Thu Jan 01 00:00:00 1970 +0000) {'ef1': '8', 'operation': 'evolve', 'user': 'test'}
+  0825dcee2670349e749f1df45857fca34f61e350 48942a623d383b1ff275f1194ead88d2e697b18b 0 (Thu Jan 01 00:00:00 1970 +0000) {'ef1': '10', 'operation': 'evolve', 'user': 'test'}
+  92ecd58f9b05d6c0a1c3833a79359eea4b0268ff 48942a623d383b1ff275f1194ead88d2e697b18b 0 (Thu Jan 01 00:00:00 1970 +0000) {'ef1': '10', 'operation': 'evolve', 'user': 'test'}
   $ hg obslog --all
-  @    7ca6a9fafcf6 (4) delete a
+  @    48942a623d38 (4) delete a
   |\
   x |  0825dcee2670 (2) delete a
-  | |    amended(content) as 7ca6a9fafcf6 using evolve by test (Thu Jan 01 00:00:00 1970 +0000)
+  | |    rewritten(meta, content) as 48942a623d38 using evolve by test (Thu Jan 01 00:00:00 1970 +0000)
   | |
   | x  92ecd58f9b05 (3) delete a
-  |/     amended(content) as 7ca6a9fafcf6 using evolve by test (Thu Jan 01 00:00:00 1970 +0000)
+  |/     rewritten(meta, content) as 48942a623d38 using evolve by test (Thu Jan 01 00:00:00 1970 +0000)
   |
   x  dff6e52f5e41 (1) delete a
        amended(content) as 0825dcee2670 using amend by test (Thu Jan 01 00:00:00 1970 +0000)