diff --git a/hgext/beautifygraph.py b/hgext/beautifygraph.py --- a/hgext/beautifygraph.py +++ b/hgext/beautifygraph.py @@ -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': diff --git a/mercurial/hgweb/webutil.py b/mercurial/hgweb/webutil.py --- a/mercurial/hgweb/webutil.py +++ b/mercurial/hgweb/webutil.py @@ -936,5 +936,5 @@ def getgraphnode(repo, ctx): return templatekw.getgraphnodecurrent( - repo, ctx + repo, ctx, {} ) + templatekw.getgraphnodesymbol(ctx) diff --git a/mercurial/logcmdutil.py b/mercurial/logcmdutil.py --- a/mercurial/logcmdutil.py +++ b/mercurial/logcmdutil.py @@ -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) diff --git a/mercurial/templatekw.py b/mercurial/templatekw.py --- a/mercurial/templatekw.py +++ b/mercurial/templatekw.py @@ -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'' diff --git a/relnotes/next b/relnotes/next --- a/relnotes/next +++ b/relnotes/next @@ -1,5 +1,10 @@ == New Features == + * `hg log` now defaults to using an '%' symbol for parents of + unresolved merge conflicts. That includes unresolved conflicts + caused by e.g. `hg update --merge` and `hg graft`. '@' still takes + precedence, so when what used to be marked '@' still is. + * New `conflictparents()` revset returns the commits that are being merged, when there are conflicts. Also works for conflicts caused by e.g. `hg graft`. diff --git a/tests/test-backout.t b/tests/test-backout.t --- a/tests/test-backout.t +++ b/tests/test-backout.t @@ -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 diff --git a/tests/test-graft-interrupted.t b/tests/test-graft-interrupted.t --- a/tests/test-graft-interrupted.t +++ b/tests/test-graft-interrupted.t @@ -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 | | diff --git a/tests/test-rebase-collapse.t b/tests/test-rebase-collapse.t --- a/tests/test-rebase-collapse.t +++ b/tests/test-rebase-collapse.t @@ -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' | | diff --git a/tests/test-strip.t b/tests/test-strip.t --- a/tests/test-strip.t +++ b/tests/test-strip.t @@ -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 diff --git a/tests/test-update-branches.t b/tests/test-update-branches.t --- a/tests/test-update-branches.t +++ b/tests/test-update-branches.t @@ -254,7 +254,7 @@ | @ 4:d047485b3896 0:60829823a42a b1 | - | o 3:6efa171f091b 1:0786582aa4b1 + | % 3:6efa171f091b 1:0786582aa4b1 | | | | o 2:bd10386d478c | |/