diff mercurial/tagmerge.py @ 36734:b77ff4fbe9ad

py3: work around comparison between int and None in tagmerge
author Yuya Nishihara <yuya@tcha.org>
date Sun, 04 Mar 2018 16:23:10 -0500
parents 66250de006c6
children 2372284d9457
line wrap: on
line diff
--- a/mercurial/tagmerge.py	Sun Mar 04 16:13:46 2018 -0500
+++ b/mercurial/tagmerge.py	Sun Mar 04 16:23:10 2018 -0500
@@ -73,8 +73,6 @@
 
 from __future__ import absolute_import
 
-import operator
-
 from .i18n import _
 from .node import (
     hex,
@@ -164,7 +162,7 @@
     # before writing them
     # the position is calculated to ensure that the diff of the merged .hgtags
     # file to the first parent's .hgtags file is as small as possible
-    finaltags.sort(key=operator.itemgetter(0))
+    finaltags.sort(key=lambda x: -1 if x[0] is None else x[0])
 
     # finally we can join the sorted groups to get the final contents of the
     # merged .hgtags file, and then write it to disk