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

login
register
mail settings
Submitter phabricator
Date June 11, 2019, 12:51 p.m.
Message ID <differential-rev-PHID-DREV-nxhigzjrc6dx5x3zepne-req@phab.mercurial-scm.org>
Download mbox | patch
Permalink /patch/40421/
State Superseded
Headers show

Comments

phabricator - June 11, 2019, 12:51 p.m.
pulkit created this revision.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.

REVISION SUMMARY
  Doing bytes[0] will return the ascii value of that position which breaks
  comparison with a bytechar.
  
  This makes test-absorb.t work again on py3.

REPOSITORY
  rHG Mercurial

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

AFFECTED FILES
  hgext/absorb.py

CHANGE DETAILS




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

Patch

diff --git a/hgext/absorb.py b/hgext/absorb.py
--- a/hgext/absorb.py
+++ b/hgext/absorb.py
@@ -871,7 +871,7 @@ 
     patchlines = mdiff.splitnewlines(buf.getvalue())
     # hunk.prettystr() will update hunk.removed
     a2 = a1 + hunk.removed
-    blines = [l[1:] for l in patchlines[1:] if l[0] != '-']
+    blines = [l[1:] for l in patchlines[1:] if not l.startswith('-')]
     return path, (a1, a2, blines)
 
 def overlaydiffcontext(ctx, chunks):