[PATCH 6 of 6] py3: work around comparison between int and None in tagmerge

Yuya Nishihara yuya at tcha.org
Sun Mar 4 16:41:41 EST 2018


# HG changeset patch
# User Yuya Nishihara <yuya at tcha.org>
# Date 1520198590 18000
#      Sun Mar 04 16:23:10 2018 -0500
# Node ID 75ddae669c3dd713b44a4c87fcc17324ba26f37d
# Parent  8267c6e887a9473e849faf2ac2ab439b9cbffcbf
py3: work around comparison between int and None in tagmerge

diff --git a/contrib/python3-whitelist b/contrib/python3-whitelist
--- a/contrib/python3-whitelist
+++ b/contrib/python3-whitelist
@@ -359,6 +359,7 @@ test-status-terse.t
 test-strip-cross.t
 test-strip.t
 test-symlinks.t
+test-tag.t
 test-unamend.t
 test-uncommit.t
 test-unified-test.t
diff --git a/mercurial/tagmerge.py b/mercurial/tagmerge.py
--- a/mercurial/tagmerge.py
+++ b/mercurial/tagmerge.py
@@ -73,8 +73,6 @@
 
 from __future__ import absolute_import
 
-import operator
-
 from .i18n import _
 from .node import (
     hex,
@@ -164,7 +162,7 @@ def writemergedtags(fcd, mergedtags):
     # 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


More information about the Mercurial-devel mailing list