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

login
register
mail settings
Submitter Yuya Nishihara
Date March 4, 2018, 9:41 p.m.
Message ID <75ddae669c3dd713b44a.1520199701@mimosa>
Download mbox | patch
Permalink /patch/29007/
State Accepted
Headers show

Comments

Yuya Nishihara - March 4, 2018, 9:41 p.m.
# HG changeset patch
# User Yuya Nishihara <yuya@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

Patch

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