graphlog: use '%' for other context in merge conflict
This lets the user more easily find the commit that is involved in the
conflict, such as the source of `hg update -m` or the commit being
grafted by `hg graft`.
Differential Revision: https://phab.mercurial-scm.org/D8043
--- a/hgext/beautifygraph.py Wed Jan 29 14:42:54 2020 -0800
+++ b/hgext/beautifygraph.py Tue Jan 28 21:49:50 2020 -0800
@@ -71,6 +71,8 @@
return b'\xE2\x97\x8B' # U+25CB ○
if node == b'@':
return b'\xE2\x97\x8D' # U+25CD ◍
+ if node == b'%':
+ return b'\xE2\x97\x8D' # U+25CE ◎
if node == b'*':
return b'\xE2\x88\x97' # U+2217 ∗
if node == b'x':
--- a/mercurial/hgweb/webutil.py Wed Jan 29 14:42:54 2020 -0800
+++ b/mercurial/hgweb/webutil.py Tue Jan 28 21:49:50 2020 -0800
@@ -936,5 +936,5 @@
def getgraphnode(repo, ctx):
return templatekw.getgraphnodecurrent(
- repo, ctx
+ repo, ctx, {}
) + templatekw.getgraphnodesymbol(ctx)
--- a/mercurial/logcmdutil.py Wed Jan 29 14:42:54 2020 -0800
+++ b/mercurial/logcmdutil.py Tue Jan 28 21:49:50 2020 -0800
@@ -1004,7 +1004,7 @@
ui, spec, defaults=templatekw.keywords, resources=tres
)
- def formatnode(repo, ctx):
+ def formatnode(repo, ctx, cache):
props = {b'ctx': ctx, b'repo': repo}
return templ.renderdefault(props)
@@ -1038,8 +1038,9 @@
# experimental config: experimental.graphshorten
state.graphshorten = ui.configbool(b'experimental', b'graphshorten')
+ formatnode_cache = {}
for rev, type, ctx, parents in dag:
- char = formatnode(repo, ctx)
+ char = formatnode(repo, ctx, formatnode_cache)
copies = getcopies(ctx) if getcopies else None
edges = edgefn(type, char, state, rev, parents)
firstedge = next(edges)
--- a/mercurial/templatekw.py Wed Jan 29 14:42:54 2020 -0800
+++ b/mercurial/templatekw.py Tue Jan 28 21:49:50 2020 -0800
@@ -396,26 +396,38 @@
return templateutil.compatfileslist(context, mapping, b'file', ctx.files())
-@templatekeyword(b'graphnode', requires={b'repo', b'ctx'})
+@templatekeyword(b'graphnode', requires={b'repo', b'ctx', b'cache'})
def showgraphnode(context, mapping):
"""String. The character representing the changeset node in an ASCII
revision graph."""
repo = context.resource(mapping, b'repo')
ctx = context.resource(mapping, b'ctx')
- return getgraphnode(repo, ctx)
+ cache = context.resource(mapping, b'cache')
+ return getgraphnode(repo, ctx, cache)
-def getgraphnode(repo, ctx):
- return getgraphnodecurrent(repo, ctx) or getgraphnodesymbol(ctx)
+def getgraphnode(repo, ctx, cache):
+ return getgraphnodecurrent(repo, ctx, cache) or getgraphnodesymbol(ctx)
-def getgraphnodecurrent(repo, ctx):
+def getgraphnodecurrent(repo, ctx, cache):
wpnodes = repo.dirstate.parents()
if wpnodes[1] == nullid:
wpnodes = wpnodes[:1]
if ctx.node() in wpnodes:
return b'@'
else:
+ merge_nodes = cache.get(b'merge_nodes', ())
+ if not merge_nodes:
+ from . import merge
+
+ mergestate = merge.mergestate.read(repo)
+ if mergestate.active():
+ merge_nodes = (mergestate.local, mergestate.other)
+ cache[b'merge_nodes'] = merge_nodes
+
+ if ctx.node() in merge_nodes:
+ return b'%'
return b''
--- a/relnotes/next Wed Jan 29 14:42:54 2020 -0800
+++ b/relnotes/next Tue Jan 28 21:49:50 2020 -0800
@@ -3,7 +3,12 @@
* `hg purge`/`hg clean` can now delete ignored files instead of
untracked files, with the new -i flag.
- * New `conflictlocal()` and `conflictother()` revsets returns the
+ * `hg log` now defaults to using an '%' symbol for commits involved
+ in unresolved merge conflicts. That includes unresolved conflicts
+ caused by e.g. `hg update --merge` and `hg graft`. '@' still takes
+ precedence, so what used to be marked '@' still is.
+
+ * New `conflictlocal()` and `conflictother()` revsets return the
commits that are being merged, when there are conflicts. Also works
for conflicts caused by e.g. `hg graft`.
--- a/tests/test-backout.t Wed Jan 29 14:42:54 2020 -0800
+++ b/tests/test-backout.t Tue Jan 28 21:49:50 2020 -0800
@@ -103,7 +103,7 @@
| date: Thu Jan 01 00:00:02 1970 +0000
| summary: grapes
|
- o changeset: 1:22cb4f70d813
+ % changeset: 1:22cb4f70d813
| user: test
| date: Thu Jan 01 00:00:01 1970 +0000
| summary: chair
@@ -748,7 +748,7 @@
| date: Thu Jan 01 00:00:00 1970 +0000
| summary: capital three
|
- o changeset: 0:a30dd8addae3
+ % changeset: 0:a30dd8addae3
user: test
date: Thu Jan 01 00:00:00 1970 +0000
summary: initial
--- a/tests/test-graft-interrupted.t Wed Jan 29 14:42:54 2020 -0800
+++ b/tests/test-graft-interrupted.t Tue Jan 28 21:49:50 2020 -0800
@@ -431,7 +431,7 @@
$ hg log -GT "{rev}:{node|short} {desc}"
@ 6:6ec71c037d94 added x
|
- | o 5:36b793615f78 added foo to c
+ | % 5:36b793615f78 added foo to c
| |
| | o 4:863a25e1a9ea added x
| |/
@@ -622,7 +622,7 @@
$ hg log -GT "{rev}:{node|short} {desc}\n"
@ 4:2aa9ad1006ff B in file a
|
- | o 3:09e253b87e17 A in file a
+ | % 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
|
- | o 3:09e253b87e17 A in file a
+ | % 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
|
- | o 3:09e253b87e17 A in file a
+ | % 3:09e253b87e17 A in file a
| |
| o 2:d36c0562f908 c
| |
--- a/tests/test-rebase-collapse.t Wed Jan 29 14:42:54 2020 -0800
+++ b/tests/test-rebase-collapse.t Tue Jan 28 21:49:50 2020 -0800
@@ -762,7 +762,7 @@
abort: edit failed: false exited with status 1
[255]
$ hg tglog
- o 3: 63668d570d21 'C'
+ % 3: 63668d570d21 'C'
|
| @ 2: 82b8abf9c185 'D'
| |
--- a/tests/test-strip.t Wed Jan 29 14:42:54 2020 -0800
+++ b/tests/test-strip.t Tue Jan 28 21:49:50 2020 -0800
@@ -598,7 +598,7 @@
| date: Thu Jan 01 00:00:00 1970 +0000
| summary: b
|
- o changeset: 0:9ab35a2d17cb
+ % changeset: 0:9ab35a2d17cb
user: test
date: Thu Jan 01 00:00:00 1970 +0000
summary: a
--- a/tests/test-update-branches.t Wed Jan 29 14:42:54 2020 -0800
+++ b/tests/test-update-branches.t Tue Jan 28 21:49:50 2020 -0800
@@ -254,7 +254,7 @@
|
@ 4:d047485b3896 0:60829823a42a b1
|
- | o 3:6efa171f091b 1:0786582aa4b1
+ | % 3:6efa171f091b 1:0786582aa4b1
| |
| | o 2:bd10386d478c
| |/