# HG changeset patch # User Valentin Gatien-Baron # Date 1589466292 14400 # Node ID f189c5280d48853f09a5b04fd5fe8c3c0adbf505 # Parent edffab2cf0ead5140fdaa391c1c827ddc53dfe35 py3: fix exception in pull when several things happen to a bookmark Specifically, when `changes` is: [(b'@upstream-committed', None, , b'updating bookmark @upstream-committed\n'), (b'@upstream-committed', binary-node, , b'divergent bookmark @ stored as @upstream-committed\n')] sorting the list raises: TypeError: '<' not supported between instances of 'bytes' and 'NoneType' Differential Revision: https://phab.mercurial-scm.org/D8523 diff -r edffab2cf0ea -r f189c5280d48 mercurial/bookmarks.py --- a/mercurial/bookmarks.py Tue May 12 22:20:56 2020 +0200 +++ b/mercurial/bookmarks.py Thu May 14 10:24:52 2020 -0400 @@ -754,7 +754,8 @@ if changed: tr = trfunc() changes = [] - for b, node, writer, msg in sorted(changed): + key = lambda t: (t[0], t[1] or b'') + for b, node, writer, msg in sorted(changed, key=key): changes.append((b, node)) writer(msg) localmarks.applychanges(repo, tr, changes)