Patchwork D5612: fastannotate: slice strings to get single character

login
register
mail settings
Submitter phabricator
Date Jan. 16, 2019, 5:22 p.m.
Message ID <43743e2ea6cedafab46271b84c0b4166@localhost.localdomain>
Download mbox | patch
Permalink /patch/37832/
State Not Applicable
Headers show

Comments

phabricator - Jan. 16, 2019, 5:22 p.m.
This revision was automatically updated to reflect the committed changes.
Closed by commit rHGe40b7a504b1d: fastannotate: slice strings to get single character (authored by durin42, committed by ).

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D5612?vs=13273&id=13292

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

AFFECTED FILES
  hgext/fastannotate/formatter.py
  hgext/fastannotate/protocol.py

CHANGE DETAILS




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

Patch

diff --git a/hgext/fastannotate/protocol.py b/hgext/fastannotate/protocol.py
--- a/hgext/fastannotate/protocol.py
+++ b/hgext/fastannotate/protocol.py
@@ -98,7 +98,7 @@ 
     state = 0 # 0: vfspath, 1: size
     vfspath = size = ''
     while i < l:
-        ch = payload[i]
+        ch = payload[i:i + 1]
         if ch == '\0':
             if state == 1:
                 result[vfspath] = buffer(payload, i + 1, int(size))
diff --git a/hgext/fastannotate/formatter.py b/hgext/fastannotate/formatter.py
--- a/hgext/fastannotate/formatter.py
+++ b/hgext/fastannotate/formatter.py
@@ -103,7 +103,7 @@ 
                         result += ': ' + self.ui.label('-' + lines[i],
                                                        'diff.deleted')
 
-            if result[-1] != '\n':
+            if result[-1:] != '\n':
                 result += '\n'
 
         self.ui.write(result)