comparison hgext/mq.py @ 37520:fa6cdd6668e1

py3: use .startswith() instead of bytes[0] Differential Revision: https://phab.mercurial-scm.org/D3214
author Pulkit Goyal <7895pulkit@gmail.com>
date Tue, 10 Apr 2018 18:55:35 +0530
parents 76823340a899
children 2d00058ac2f8
comparison
equal deleted inserted replaced
37519:3740d1abde44 37520:fa6cdd6668e1
656 idx = self.series.index(idx) 656 idx = self.series.index(idx)
657 patchguards = self.seriesguards[idx] 657 patchguards = self.seriesguards[idx]
658 if not patchguards: 658 if not patchguards:
659 return True, None 659 return True, None
660 guards = self.active() 660 guards = self.active()
661 exactneg = [g for g in patchguards if g[0] == '-' and g[1:] in guards] 661 exactneg = [g for g in patchguards
662 if g.startswith('-') and g[1:] in guards]
662 if exactneg: 663 if exactneg:
663 return False, repr(exactneg[0]) 664 return False, repr(exactneg[0])
664 pos = [g for g in patchguards if g[0] == '+'] 665 pos = [g for g in patchguards if g.startswith('+')]
665 exactpos = [g for g in pos if g[1:] in guards] 666 exactpos = [g for g in pos if g[1:] in guards]
666 if pos: 667 if pos:
667 if exactpos: 668 if exactpos:
668 return True, repr(exactpos[0]) 669 return True, repr(exactpos[0])
669 return False, ' '.join(map(repr, pos)) 670 return False, ' '.join(map(repr, pos))