py3: workaround comparing NoneType and integers
Comparing None with integers was fine in Python 2 but returns error in Python 3
which is nice. This patch replaces None with -1 where sorting is done and some
related logic.
Differential Revision: https://phab.mercurial-scm.org/D3219
--- a/hgext/mq.py Tue Apr 10 18:57:56 2018 +0530
+++ b/hgext/mq.py Tue Apr 10 19:21:16 2018 +0530
@@ -1022,9 +1022,17 @@
unknown = []
- for (i, p) in sorted([(self.findseries(p), p) for p in patches],
- reverse=True):
- if i is not None:
+ sortedseries = []
+ for p in patches:
+ idx = self.findseries(p)
+ if idx is None:
+ sortedseries.append((-1, p))
+ else:
+ sortedseries.append((idx, p))
+
+ sortedseries.sort(reverse=True)
+ for (i, p) in sortedseries:
+ if i != -1:
del self.fullseries[i]
else:
unknown.append(p)