diff --git a/mercurial/obsolete.py b/mercurial/obsolete.py --- a/mercurial/obsolete.py +++ b/mercurial/obsolete.py @@ -1030,7 +1030,9 @@ def _computecontentdivergentset(repo): if prec not in newermap: obsutil.successorssets(repo, prec, cache=newermap) newer = [n for n in newermap[prec] if n] - if len(newer) > 1: + # Strickly speaking, the len(newer) is not needed, but it speeds + # things up. + if len(newer) > 1 and any(n for n in newer if node not in n): divergent.add(rev) break toprocess.update(obsstore.predecessors.get(prec, ())) diff --git a/tests/test-obsmarker-template.t b/tests/test-obsmarker-template.t --- a/tests/test-obsmarker-template.t +++ b/tests/test-obsmarker-template.t @@ -2304,7 +2304,7 @@ Diverge one of the splitted commit $ hg up 6 --hidden 0 files updated, 0 files merged, 0 files removed, 0 files unresolved $ hg commit --amend -m "Add B only" - 4 new content-divergent changesets + 2 new content-divergent changesets $ hg log -G @ changeset: 9:0b997eb7ceee @@ -2325,7 +2325,7 @@ Diverge one of the splitted commit | * changeset: 7:ba2ed02b0c9a | | user: test | | date: Thu Jan 01 00:00:00 1970 +0000 - | | instability: orphan, content-divergent + | | instability: orphan | | summary: Add A,B,C | | | x changeset: 6:4a004186e638 @@ -2335,11 +2335,10 @@ Diverge one of the splitted commit | obsolete: rewritten using amend as 9:0b997eb7ceee | summary: Add A,B,C | - * changeset: 5:dd800401bd8c + o changeset: 5:dd800401bd8c | parent: 3:f897c6137566 | user: test | date: Thu Jan 01 00:00:00 1970 +0000 - | instability: content-divergent | summary: Add A,B,C | o changeset: 3:f897c6137566 @@ -2391,7 +2390,7 @@ Check templates | multi-line: 8:b18bc8331526 | multi-line: 9:0b997eb7ceee | json: [["b18bc8331526a22cbb1801022bd1555bf291c48b"], ["0b997eb7ceeee06200a02f8aab185979092d514e"]] - * dd800401bd8c + o dd800401bd8c | Predecessors: | semi-colon: | json: [] @@ -2424,7 +2423,7 @@ Check templates | | | x 4a004186e638 |/ Obsfate: rewritten using amend as 8:b18bc8331526 by test (at 1970-01-01 00:00 +0000); rewritten using amend as 9:0b997eb7ceee by test (at 1970-01-01 00:00 +0000); - * dd800401bd8c + o dd800401bd8c | o f897c6137566 | @@ -2464,7 +2463,7 @@ Check templates | multi-line: 8:b18bc8331526 | multi-line: 9:0b997eb7ceee | json: [["b18bc8331526a22cbb1801022bd1555bf291c48b"], ["0b997eb7ceeee06200a02f8aab185979092d514e"]] - * dd800401bd8c + o dd800401bd8c | Predecessors: 4:9bd10a0775e4 | semi-colon: 4:9bd10a0775e4 | json: ["9bd10a0775e478708cada5f176ec6de654359ce7"] @@ -2522,7 +2521,7 @@ Check templates | | | x 4a004186e638 |/ Obsfate: rewritten using amend as 8:b18bc8331526 by test (at 1970-01-01 00:00 +0000); rewritten using amend as 9:0b997eb7ceee by test (at 1970-01-01 00:00 +0000); - * dd800401bd8c + o dd800401bd8c | | x 9bd10a0775e4 |/ Obsfate: split as 5:dd800401bd8c, 6:4a004186e638, 7:ba2ed02b0c9a by test (at 1970-01-01 00:00 +0000); @@ -2543,7 +2542,7 @@ Check templates | | | x 4a004186e638 |/ Obsfate: [{"markers": [["4a004186e63889f20cb16434fcbd72220bd1eace", ["b18bc8331526a22cbb1801022bd1555bf291c48b"], 0, [["ef1", "1"], ["operation", "amend"], ["user", "test"]], [0.0, 0], null]], "successors": ["b18bc8331526a22cbb1801022bd1555bf291c48b"]}, {"markers": [["4a004186e63889f20cb16434fcbd72220bd1eace", ["0b997eb7ceeee06200a02f8aab185979092d514e"], 0, [["ef1", "1"], ["operation", "amend"], ["user", "test"]], [0.0, 0], null]], "successors": ["0b997eb7ceeee06200a02f8aab185979092d514e"]}] - * dd800401bd8c + o dd800401bd8c | | x 9bd10a0775e4 |/ Obsfate: [{"markers": [["9bd10a0775e478708cada5f176ec6de654359ce7", ["dd800401bd8c79d815329277739e433e883f784e", "4a004186e63889f20cb16434fcbd72220bd1eace", "ba2ed02b0c9a56b9fdbc4e79c7e57866984d8a1f"], 0, [["user", "test"]], [0.0, 0], null]], "successors": ["dd800401bd8c79d815329277739e433e883f784e", "4a004186e63889f20cb16434fcbd72220bd1eace", "ba2ed02b0c9a56b9fdbc4e79c7e57866984d8a1f"]}] @@ -2562,7 +2561,7 @@ Check templates $ hg rebase -r 7 -d 8 --config extensions.rebase= rebasing 7:ba2ed02b0c9a "Add A,B,C" $ hg tlog - * eceed8f98ffc + o eceed8f98ffc | Predecessors: 4:9bd10a0775e4 | semi-colon: 4:9bd10a0775e4 | json: ["9bd10a0775e478708cada5f176ec6de654359ce7"] @@ -2586,7 +2585,7 @@ Check templates | Successors: | multi-line: | json: [] - * dd800401bd8c + o dd800401bd8c | Predecessors: 4:9bd10a0775e4 | semi-colon: 4:9bd10a0775e4 | json: ["9bd10a0775e478708cada5f176ec6de654359ce7"] @@ -2621,13 +2620,13 @@ Check templates json: [] $ hg fatelog - * eceed8f98ffc + o eceed8f98ffc | | * 0b997eb7ceee | | * | b18bc8331526 |/ - * dd800401bd8c + o dd800401bd8c | | @ 9bd10a0775e4 |/ Obsfate: split using amend, rebase as 5:dd800401bd8c, 9:0b997eb7ceee, 10:eceed8f98ffc by test (at 1970-01-01 00:00 +0000); split using amend, rebase as 5:dd800401bd8c, 8:b18bc8331526, 10:eceed8f98ffc by test (at 1970-01-01 00:00 +0000); @@ -2639,7 +2638,7 @@ Check other fatelog implementations ----------------------------------- $ hg fatelogkw --hidden -q - * eceed8f98ffc + o eceed8f98ffc | | * 0b997eb7ceee | | @@ -2650,7 +2649,7 @@ Check other fatelog implementations | x 4a004186e638 |/ Obsfate: rewritten using amend as 8:b18bc8331526 | Obsfate: rewritten using amend as 9:0b997eb7ceee - * dd800401bd8c + o dd800401bd8c | | @ 9bd10a0775e4 |/ Obsfate: split as 5:dd800401bd8c, 6:4a004186e638, 7:ba2ed02b0c9a @@ -2664,7 +2663,7 @@ Check other fatelog implementations o ea207398892e $ hg fatelogkw --hidden - * eceed8f98ffc + o eceed8f98ffc | | * 0b997eb7ceee | | @@ -2675,7 +2674,7 @@ Check other fatelog implementations | x 4a004186e638 |/ Obsfate: rewritten using amend as 8:b18bc8331526 | Obsfate: rewritten using amend as 9:0b997eb7ceee - * dd800401bd8c + o dd800401bd8c | | @ 9bd10a0775e4 |/ Obsfate: split as 5:dd800401bd8c, 6:4a004186e638, 7:ba2ed02b0c9a @@ -2689,7 +2688,7 @@ Check other fatelog implementations o ea207398892e $ hg fatelogkw --hidden -v - * eceed8f98ffc + o eceed8f98ffc | | * 0b997eb7ceee | | @@ -2700,7 +2699,7 @@ Check other fatelog implementations | x 4a004186e638 |/ Obsfate: rewritten using amend as 8:b18bc8331526 by test (at 1970-01-01 00:00 +0000) | Obsfate: rewritten using amend as 9:0b997eb7ceee by test (at 1970-01-01 00:00 +0000) - * dd800401bd8c + o dd800401bd8c | | @ 9bd10a0775e4 |/ Obsfate: split as 5:dd800401bd8c, 6:4a004186e638, 7:ba2ed02b0c9a by test (at 1970-01-01 00:00 +0000) @@ -2714,12 +2713,11 @@ Check other fatelog implementations o ea207398892e $ hg log -G -T "default" --hidden - * changeset: 10:eceed8f98ffc + o changeset: 10:eceed8f98ffc | tag: tip | parent: 8:b18bc8331526 | user: test | date: Thu Jan 01 00:00:00 1970 +0000 - | instability: content-divergent | summary: Add A,B,C | | * changeset: 9:0b997eb7ceee @@ -2749,11 +2747,10 @@ Check other fatelog implementations | obsolete: rewritten using amend as 9:0b997eb7ceee | summary: Add A,B,C | - * changeset: 5:dd800401bd8c + o changeset: 5:dd800401bd8c | parent: 3:f897c6137566 | user: test | date: Thu Jan 01 00:00:00 1970 +0000 - | instability: content-divergent | summary: Add A,B,C | | @ changeset: 4:9bd10a0775e4 diff --git a/tests/test-obsolete-divergent.t b/tests/test-obsolete-divergent.t --- a/tests/test-obsolete-divergent.t +++ b/tests/test-obsolete-divergent.t @@ -466,7 +466,7 @@ Check more complex obsolescence graft (w 0 files updated, 0 files merged, 1 files removed, 0 files unresolved $ hg debugobsolete `getid A_5` `getid A_9` 1 new obsolescence markers - 4 new content-divergent changesets + 3 new content-divergent changesets $ hg log -G --hidden * 10:bed64f5d2f5a A_9 | @@ -480,7 +480,7 @@ Check more complex obsolescence graft (w |/ | x 5:6a411f0d7a0a A_4 [rewritten as 6:e442cfc57690] |/ - | * 4:01f36c5a8fda A_3 + | o 4:01f36c5a8fda A_3 |/ | x 3:392fd25390da A_2 [rewritten as 5:6a411f0d7a0a] |/ @@ -553,7 +553,6 @@ Check more complex obsolescence graft (w bed64f5d2f5a bed64f5d2f5a $ hg log -r 'contentdivergent()' - 4:01f36c5a8fda A_3 8:7ae126973a96 A_7 9:14608b260df8 A_8 10:bed64f5d2f5a A_9 @@ -719,7 +718,58 @@ successors-set. (report [A,B] not [A] + $ cd .. +Divergence introduced after a split +----------------------------------- + +Make sure divergence introduced in sucessors of a split does not spill to the +unrelated part. + + $ newcase split-unrelated-branch + $ hg debugobsolete `getid A_0` `getid A_1` `getid A_2` + 1 new obsolescence markers + obsoleted 1 changesets + $ hg up 'desc("A_2")' + 1 files updated, 0 files merged, 0 files removed, 0 files unresolved + $ hg commit --amend -m "A_3" + $ hg up 'desc("A_2")' --hidden + 0 files updated, 0 files merged, 0 files removed, 0 files unresolved + updated to hidden changeset 392fd25390da + (hidden revision '392fd25390da' was rewritten as: 4d672202d2fb) + $ hg commit --amend -m "A_4" --config experimental.evolution.allowdivergence=yes + 2 new content-divergent changesets + $ hg log -G --hidden + @ 5:6730f214b07b A_4 + | + | * 4:4d672202d2fb A_3 + |/ + | x 3:392fd25390da A_2 [rewritten using amend as 5:6730f214b07b; rewritten using amend as 4:4d672202d2fb] + |/ + | o 2:82623d38b9ba A_1 + |/ + | x 1:007dc284c1f8 A_0 [split as 2:82623d38b9ba, 3:392fd25390da] + |/ + o 0:d20a80d4def3 base + + $ hg debugsuccessorssets --hidden 'desc('A_0')' + 007dc284c1f8 + 82623d38b9ba 4d672202d2fb + 82623d38b9ba 6730f214b07b + $ hg debugsuccessorssets --hidden 'desc('A_1')' + 82623d38b9ba + 82623d38b9ba + $ hg debugsuccessorssets --hidden 'desc('A_2')' + 392fd25390da + 6730f214b07b + 4d672202d2fb + $ hg log -r 'contentdivergent()' + 4:4d672202d2fb A_3 + 5:6730f214b07b A_4 + $ cd .. + + + Use scmutil.cleanupnodes API to create divergence +================================================= $ hg init cleanupnodes $ cd cleanupnodes