diff hgext/fastannotate/revmap.py @ 43076:2372284d9457

formatting: blacken the codebase This is using my patch to black (https://github.com/psf/black/pull/826) so we don't un-wrap collection literals. Done with: hg files 'set:**.py - mercurial/thirdparty/** - "contrib/python-zstandard/**"' | xargs black -S # skip-blame mass-reformatting only # no-check-commit reformats foo_bar functions Differential Revision: https://phab.mercurial-scm.org/D6971
author Augie Fackler <augie@google.com>
date Sun, 06 Oct 2019 09:45:02 -0400
parents 4eaf7197a740
children 687b865b95ad
line wrap: on
line diff
--- a/hgext/fastannotate/revmap.py	Sat Oct 05 10:29:34 2019 -0400
+++ b/hgext/fastannotate/revmap.py	Sun Oct 06 09:45:02 2019 -0400
@@ -47,6 +47,7 @@
 # len(mercurial.node.nullid)
 _hshlen = 20
 
+
 class revmap(object):
     """trivial hg bin hash - linelog rev bidirectional map
 
@@ -157,15 +158,16 @@
         """write the state down to the file"""
         if not self.path:
             return
-        if self._lastmaxrev == -1: # write the entire file
+        if self._lastmaxrev == -1:  # write the entire file
             with open(self.path, 'wb') as f:
                 f.write(self.HEADER)
                 for i in pycompat.xrange(1, len(self._rev2hsh)):
                     self._writerev(i, f)
-        else: # append incrementally
+        else:  # append incrementally
             with open(self.path, 'ab') as f:
-                for i in pycompat.xrange(self._lastmaxrev + 1,
-                                         len(self._rev2hsh)):
+                for i in pycompat.xrange(
+                    self._lastmaxrev + 1, len(self._rev2hsh)
+                ):
                     self._writerev(i, f)
         self._lastmaxrev = self.maxrev
 
@@ -217,7 +219,7 @@
         buf = ''
         while True:
             ch = f.read(1)
-            if not ch: # unexpected eof
+            if not ch:  # unexpected eof
                 raise error.CorruptedFileError()
             if ch == '\0':
                 break
@@ -229,9 +231,9 @@
         test if (node, path) is in the map, and is not in a side branch.
         f can be either a tuple of (node, path), or a fctx.
         """
-        if isinstance(f, tuple): # f: (node, path)
+        if isinstance(f, tuple):  # f: (node, path)
             hsh, path = f
-        else: # f: fctx
+        else:  # f: fctx
             hsh, path = f.node(), f.path()
         rev = self.hsh2rev(hsh)
         if rev is None:
@@ -240,6 +242,7 @@
             return False
         return (self.rev2flag(rev) & sidebranchflag) == 0
 
+
 def getlastnode(path):
     """return the last hash in a revmap, without loading its full content.
     this is equivalent to `m = revmap(path); m.rev2hsh(m.maxrev)`, but faster.