py3: fix exception in pull when several things happen to a bookmark stable
authorValentin Gatien-Baron <vgatien-baron@janestreet.com>
Thu, 14 May 2020 10:24:52 -0400
branchstable
changeset 44824 f189c5280d48
parent 44821 edffab2cf0ea
child 44825 18e36ff8b414
py3: fix exception in pull when several things happen to a bookmark Specifically, when `changes` is: [(b'@upstream-committed', None, <function ui.status>, b'updating bookmark @upstream-committed\n'), (b'@upstream-committed', binary-node, <function ui.warn>, 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
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)