changeset 38682:88efb7d6bcb6

phases: remove excessive optimization from newheads() (issue5939) This function is intended to compute 'heads(::heads - roots::)', but it failed because 'heads + parents(roots)' missed sibling branches of the roots. That's why the public heads slipped down from D to B in the example added by 2a227782e754 "tests: add test demonstrating phase loss when cloning": > E draft > |\Z draft > | Y draft > D | public > | X draft > C/ public > B public > A public where heads = {E, Z}, roots = {X}
author Yuya Nishihara <yuya@tcha.org>
date Sat, 14 Jul 2018 13:19:18 +0900
parents 8eeed92475d5
children ddd2165438cd
files mercurial/phases.py tests/test-phases-exchange.t
diffstat 2 files changed, 13 insertions(+), 12 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/phases.py	Sun Jul 15 15:48:18 2018 +0530
+++ b/mercurial/phases.py	Sat Jul 14 13:19:18 2018 +0900
@@ -665,8 +665,7 @@
     * `heads`: define the first subset
     * `roots`: define the second we subtract from the first"""
     repo = repo.unfiltered()
-    revset = repo.set('heads((%ln + parents(%ln)) - (%ln::%ln))',
-                      heads, roots, roots, heads)
+    revset = repo.set('heads(::%ln - (%ln::%ln))', heads, roots, heads)
     return [c.node() for c in revset]
 
 
--- a/tests/test-phases-exchange.t	Sun Jul 15 15:48:18 2018 +0530
+++ b/tests/test-phases-exchange.t	Sat Jul 14 13:19:18 2018 +0900
@@ -1478,7 +1478,8 @@
   $ killdaemons.py
 
 With legacy listkeys over bundle2
-TODO issue 5939: public phase lost on 26805 and f5853
+(issue 5939: public phase was lost on 26805 and f5853 before, due to a bug
+of phase heads computation)
 
   $ hg -R mergetest --config devel.legacy.exchange=phases serve -p $HGPORT -d --pid-file=hg.pid
   $ cat hg.pid >> $DAEMON_PIDS
@@ -1492,9 +1493,9 @@
   new changesets 426bada5c675:bb94757e651a
   test-debug-phase: new rev 0:  x -> 0
   test-debug-phase: new rev 1:  x -> 0
-  test-debug-phase: new rev 2:  x -> 1
+  test-debug-phase: new rev 2:  x -> 0
   test-debug-phase: new rev 3:  x -> 1
-  test-debug-phase: new rev 4:  x -> 1
+  test-debug-phase: new rev 4:  x -> 0
   test-debug-phase: new rev 5:  x -> 1
   test-debug-phase: new rev 6:  x -> 1
   test-debug-phase: new rev 7:  x -> 1
@@ -1506,11 +1507,11 @@
   |/|
   o |  13b7b draft
   | |
-  | o  f5853 draft
+  | o  f5853 public
   | |
   o |  c67c4 draft
   | |
-  | o  26805 draft
+  | o  26805 public
   |/
   o  11247 public
   |
@@ -1519,7 +1520,8 @@
   $ killdaemons.py
 
 Without bundle2
-TODO issue 5939: public phase lost on 26805 and f5853
+(issue 5939: public phase was lost on 26805 and f5853 before, due to a bug
+of phase heads computation)
 
   $ hg -R mergetest serve -p $HGPORT -d --pid-file=hg.pid
   $ cat hg.pid >> $DAEMON_PIDS
@@ -1533,9 +1535,9 @@
   new changesets 426bada5c675:bb94757e651a
   test-debug-phase: new rev 0:  x -> 0
   test-debug-phase: new rev 1:  x -> 0
-  test-debug-phase: new rev 2:  x -> 1
+  test-debug-phase: new rev 2:  x -> 0
   test-debug-phase: new rev 3:  x -> 1
-  test-debug-phase: new rev 4:  x -> 1
+  test-debug-phase: new rev 4:  x -> 0
   test-debug-phase: new rev 5:  x -> 1
   test-debug-phase: new rev 6:  x -> 1
   test-debug-phase: new rev 7:  x -> 1
@@ -1547,11 +1549,11 @@
   |/|
   o |  13b7b draft
   | |
-  | o  f5853 draft
+  | o  f5853 public
   | |
   o |  c67c4 draft
   | |
-  | o  26805 draft
+  | o  26805 public
   |/
   o  11247 public
   |