Patchwork D3214: py3: use .startswith() instead of bytes[0]

login
register
mail settings
Submitter phabricator
Date April 10, 2018, 2:15 p.m.
Message ID <differential-rev-PHID-DREV-cfoxpgaac74p7twcdsiz-req@phab.mercurial-scm.org>
Download mbox | patch
Permalink /patch/30623/
State Superseded
Headers show

Comments

phabricator - April 10, 2018, 2:15 p.m.
pulkit created this revision.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.

REPOSITORY
  rHG Mercurial

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

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
@@ -658,10 +658,11 @@ 
         if not patchguards:
             return True, None
         guards = self.active()
-        exactneg = [g for g in patchguards if g[0] == '-' and g[1:] in guards]
+        exactneg = [g for g in patchguards
+                    if g.startswith('-') and g[1:] in guards]
         if exactneg:
             return False, repr(exactneg[0])
-        pos = [g for g in patchguards if g[0] == '+']
+        pos = [g for g in patchguards if g.startswith('+')]
         exactpos = [g for g in pos if g[1:] in guards]
         if pos:
             if exactpos: