Patchwork D3219: py3: workaround comparing NoneType and integers

login
register
mail settings
Submitter phabricator
Date April 11, 2018, 12:32 p.m.
Message ID <eafd5ae2c9351b641fb5a5c03ea244c2@localhost.localdomain>
Download mbox | patch
Permalink /patch/30691/
State Not Applicable
Headers show

Comments

phabricator - April 11, 2018, 12:32 p.m.
This revision was automatically updated to reflect the committed changes.
Closed by commit rHGa7de62adcf03: py3: workaround comparing NoneType and integers (authored by pulkit, committed by ).

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D3219?vs=7931&id=7971

REVISION DETAIL
  https://phab.mercurial-scm.org/D3219

AFFECTED FILES
  hgext/mq.py

CHANGE DETAILS




To: pulkit, #hg-reviewers
Cc: mercurial-devel

Patch

diff --git a/hgext/mq.py b/hgext/mq.py
--- a/hgext/mq.py
+++ b/hgext/mq.py
@@ -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)