diff mercurial/dagop.py @ 43077:687b865b95ad

formatting: byteify all mercurial/ and hgext/ string literals Done with python3.7 contrib/byteify-strings.py -i $(hg files 'set:mercurial/**.py - mercurial/thirdparty/** + hgext/**.py - hgext/fsmonitor/pywatchman/** - mercurial/__init__.py') black -l 80 -t py33 -S $(hg files 'set:**.py - mercurial/thirdparty/** - "contrib/python-zstandard/**" - hgext/fsmonitor/pywatchman/**') # skip-blame mass-reformatting only Differential Revision: https://phab.mercurial-scm.org/D6972
author Augie Fackler <augie@google.com>
date Sun, 06 Oct 2019 09:48:39 -0400
parents 2372284d9457
children 7cd5c0968139
line wrap: on
line diff
--- a/mercurial/dagop.py	Sun Oct 06 09:45:02 2019 -0400
+++ b/mercurial/dagop.py	Sun Oct 06 09:48:39 2019 -0400
@@ -43,7 +43,7 @@
     if stopdepth == 0:
         return
     if stopdepth < 0:
-        raise error.ProgrammingError('negative stopdepth')
+        raise error.ProgrammingError(b'negative stopdepth')
     if reverse:
         heapsign = -1  # max heap
     else:
@@ -330,7 +330,7 @@
     """
     blocks = mdiff.allblocks(fctx1.data(), fctx2.data(), diffopts)
     filteredblocks, linerange1 = mdiff.blocksinrange(blocks, linerange2)
-    diffinrange = any(stype == '!' for _, stype in filteredblocks)
+    diffinrange = any(stype == b'!' for _, stype in filteredblocks)
     return diffinrange, linerange1
 
 
@@ -428,9 +428,9 @@
 
 
 def _countlines(text):
-    if text.endswith("\n"):
-        return text.count("\n")
-    return text.count("\n") + int(bool(text))
+    if text.endswith(b"\n"):
+        return text.count(b"\n")
+    return text.count(b"\n") + int(bool(text))
 
 
 def _decoratelines(text, fctx):
@@ -464,7 +464,7 @@
         for (a1, a2, b1, b2), t in blocks:
             # Changed blocks ('!') or blocks made only of blank lines ('~')
             # belong to the child.
-            if t == '=':
+            if t == b'=':
                 child.fctxs[b1:b2] = parent.fctxs[a1:a2]
                 child.linenos[b1:b2] = parent.linenos[a1:a2]
                 child.skips[b1:b2] = parent.skips[a1:a2]