graphlog: use '%' only if there are *unresolved* conflicts
In
14d0e89520a2, I made graphlog use '%' for the "other" context when
there's an existing merge state. However, that has confused many
people because it shows up even if all conflicts are already resolved,
which makes it show up even after e.g. `hg update -m` with
automatically resolved conflicts. This patch makes it so we show the
'%' only if there still unresolved conflicts.
This patch replaces my earlier attempt in D8930, where I decided to
automatically clear the mergestate if there are no remaining
conflicts. That had the problem that it wouldn't let the user
re-resolve the conflicts using `hg resolve`.
Note that an in-progress "proper" merge (one that will result in a
commit with two parents, such as after `hg merge`) will already have
two dirstate parents before the commit happens. That means that both
sides of the merge will get drawn as '@' in the graph, since "is
dirstate parent" takes precedence over "is involved in merge
conflict".
Differential Revision: https://phab.mercurial-scm.org/D9007
--- a/mercurial/templatekw.py Wed Aug 26 17:24:22 2020 +0530
+++ b/mercurial/templatekw.py Thu Sep 10 13:12:34 2020 -0700
@@ -422,7 +422,7 @@
from . import mergestate as mergestatemod
mergestate = mergestatemod.mergestate.read(repo)
- if mergestate.active():
+ if mergestate.unresolvedcount():
merge_nodes = (mergestate.local, mergestate.other)
else:
merge_nodes = ()
--- a/tests/test-graft-interrupted.t Wed Aug 26 17:24:22 2020 +0530
+++ b/tests/test-graft-interrupted.t Thu Sep 10 13:12:34 2020 -0700
@@ -622,7 +622,7 @@
$ hg log -GT "{rev}:{node|short} {desc}\n"
@ 4:2aa9ad1006ff B in file a
|
- | % 3:09e253b87e17 A in file a
+ | o 3:09e253b87e17 A in file a
| |
| o 2:d36c0562f908 c
| |
@@ -669,7 +669,7 @@
$ hg log -GT "{rev}:{node|short} {desc}\n"
@ 4:2aa9ad1006ff B in file a
|
- | % 3:09e253b87e17 A in file a
+ | o 3:09e253b87e17 A in file a
| |
| o 2:d36c0562f908 c
| |
@@ -712,7 +712,7 @@
$ hg log -GT "{rev}:{node|short} {desc}\n"
@ 4:2aa9ad1006ff B in file a
|
- | % 3:09e253b87e17 A in file a
+ | o 3:09e253b87e17 A in file a
| |
| o 2:d36c0562f908 c
| |
--- a/tests/test-rebase-collapse.t Wed Aug 26 17:24:22 2020 +0530
+++ b/tests/test-rebase-collapse.t Thu Sep 10 13:12:34 2020 -0700
@@ -762,7 +762,7 @@
abort: edit failed: false exited with status 1
[255]
$ hg tglog
- % 3: 63668d570d21 'C'
+ o 3: 63668d570d21 'C'
|
| @ 2: 82b8abf9c185 'D'
| |