[PATCH 1 of 2] phases: remove excessive optimization from newheads() (issue5939)
Yuya Nishihara
yuya at tcha.org
Sat Jul 14 05:43:02 UTC 2018
# HG changeset patch
# User Yuya Nishihara <yuya at tcha.org>
# Date 1531541958 -32400
# Sat Jul 14 13:19:18 2018 +0900
# Node ID c8f181c48ae26247478aea82c8d2ab2f886831f9
# Parent d5b851a39710f8415f98575e4f00396fe7ee2809
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}
diff --git a/mercurial/phases.py b/mercurial/phases.py
--- a/mercurial/phases.py
+++ b/mercurial/phases.py
@@ -665,8 +665,7 @@ def newheads(repo, heads, roots):
* `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]
diff --git a/tests/test-phases-exchange.t b/tests/test-phases-exchange.t
--- a/tests/test-phases-exchange.t
+++ b/tests/test-phases-exchange.t
@@ -1478,7 +1478,8 @@ Works with default settings
$ 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 @@ TODO issue 5939: public phase lost on 26
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 @@ TODO issue 5939: public phase lost on 26
|/|
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 @@ TODO issue 5939: public phase lost on 26
$ 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 @@ TODO issue 5939: public phase lost on 26
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 @@ TODO issue 5939: public phase lost on 26
|/|
o | 13b7b draft
| |
- | o f5853 draft
+ | o f5853 public
| |
o | c67c4 draft
| |
- | o 26805 draft
+ | o 26805 public
|/
o 11247 public
|
More information about the Mercurial-devel
mailing list