Details
Details
- Reviewers
- None
- Group Reviewers
hg-reviewers - Commits
- rHGfa6cdd6668e1: py3: use .startswith() instead of bytes[0]
Diff Detail
Diff Detail
- Repository
- rHG Mercurial
- Lint
Lint Skipped - Unit
Unit Tests Skipped
hg-reviewers |
Lint Skipped |
Unit Tests Skipped |
def pushable(self, idx): | def pushable(self, idx): | ||||
if isinstance(idx, bytes): | if isinstance(idx, bytes): | ||||
idx = self.series.index(idx) | idx = self.series.index(idx) | ||||
patchguards = self.seriesguards[idx] | patchguards = self.seriesguards[idx] | ||||
if not patchguards: | if not patchguards: | ||||
return True, None | return True, None | ||||
guards = self.active() | 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: | if exactneg: | ||||
return False, repr(exactneg[0]) | 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] | exactpos = [g for g in pos if g[1:] in guards] | ||||
if pos: | if pos: | ||||
if exactpos: | if exactpos: | ||||
return True, repr(exactpos[0]) | return True, repr(exactpos[0]) | ||||
return False, ' '.join(map(repr, pos)) | return False, ' '.join(map(repr, pos)) | ||||
return True, '' | return True, '' | ||||
def explainpushable(self, idx, all_patches=False): | def explainpushable(self, idx, all_patches=False): |