Commit a35fbdd3 authored by Anton Shestakov's avatar Anton Shestakov
Browse files

obslog: make obslog --no-origin -f work with multiple successor sets

When trying to sort multiple successor sets, this block of code used to fail
with:

- TypeError: '<' not supported between instances of 'dict' and 'dict' (on py3)
- TypeError: cannot compare sets using cmp() (on py2)

So for sorted() to work properly, we need to remove dicts and sets from the
data.

--HG--
branch : stable
parent c2eea89b3f74
Pipeline #6109 canceled with stage
......@@ -219,9 +219,14 @@ def _fatemarkers(repo, ctx, filternonlocal):
r = obsutil.successorsandmarkers(repo, ctx)
if r is None:
r = []
for succset in sorted(r):
if succset[b'markers']:
yield (succset[b'successors'], succset[b'markers'])
# replacing dicts and sets, they can't be compared
data = [
(succset[b'successors'], tuple(sorted(succset[b'markers'])))
for succset in r
]
for (nodes, markers) in sorted(data):
if markers:
yield (nodes, markers)
else:
markers = successors.get(ctx.node(), ())
for marker in sorted(markers):
......
......@@ -98,6 +98,11 @@ Check that obslog on the divergent revision shows both destinations
+A1
$ hg obslog --hidden 'desc(A0)' --no-origin -f
x 471f378eab4c (1) A0
reworded(description) as 65b757b745b9 using amend by test (Thu Jan 01 00:00:00 1970 +0000)
reworded(description) as fdf9bde5129a using amend by test (Thu Jan 01 00:00:00 1970 +0000)
Check that with all option, every changeset is shown
$ hg obslog --hidden --all 471f378eab4c --patch
......@@ -123,6 +128,15 @@ Check that with all option, every changeset is shown
|
x 471f378eab4c (1) A0
$ hg obslog --hidden --all 'desc(A0)' --no-origin -f
@ 65b757b745b9 (3) A2
|
| * fdf9bde5129a (2) A1
|/
x 471f378eab4c (1) A0
reworded(description) as 65b757b745b9 using amend by test (Thu Jan 01 00:00:00 1970 +0000)
reworded(description) as fdf9bde5129a using amend by test (Thu Jan 01 00:00:00 1970 +0000)
$ hg obslog --hidden 471f378eab4c --no-graph --no-origin -Tjson | python -m json.tool
[
{
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment