changeset 41201:6439cefaeb64

revlog: rename v to versionflags Single letter variables are harder to read. Differential Revision: https://phab.mercurial-scm.org/D5560
author Gregory Szorc <gregory.szorc@gmail.com>
date Wed, 09 Jan 2019 15:45:17 -0800
parents cecf3f8bccd3
children e7a2cc84dbc0
files mercurial/revlog.py
diffstat 1 files changed, 13 insertions(+), 13 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/revlog.py	Wed Jan 09 19:06:15 2019 -0800
+++ b/mercurial/revlog.py	Wed Jan 09 15:45:17 2019 -0800
@@ -388,13 +388,13 @@
 
         if 'revlogv2' in opts:
             # version 2 revlogs always use generaldelta.
-            v = REVLOGV2 | FLAG_GENERALDELTA | FLAG_INLINE_DATA
+            versionflags = REVLOGV2 | FLAG_GENERALDELTA | FLAG_INLINE_DATA
         elif 'revlogv1' in opts:
-            v = REVLOGV1 | FLAG_INLINE_DATA
+            versionflags = REVLOGV1 | FLAG_INLINE_DATA
             if 'generaldelta' in opts:
-                v |= FLAG_GENERALDELTA
+                versionflags |= FLAG_GENERALDELTA
         else:
-            v = REVLOG_DEFAULT_VERSION
+            versionflags = REVLOG_DEFAULT_VERSION
 
         if 'chunkcachesize' in opts:
             self._chunkcachesize = opts['chunkcachesize']
@@ -431,9 +431,9 @@
             raise error.RevlogError(_('revlog chunk cache size %r is not a '
                                       'power of 2') % self._chunkcachesize)
 
-        self._loadindex(v, mmapindexthreshold)
-
-    def _loadindex(self, v, mmapindexthreshold):
+        self._loadindex(versionflags, mmapindexthreshold)
+
+    def _loadindex(self, versionflags, mmapindexthreshold):
         indexdata = ''
         self._initempty = True
         try:
@@ -444,17 +444,17 @@
                 else:
                     indexdata = f.read()
             if len(indexdata) > 0:
-                v = versionformat_unpack(indexdata[:4])[0]
+                versionflags = versionformat_unpack(indexdata[:4])[0]
                 self._initempty = False
         except IOError as inst:
             if inst.errno != errno.ENOENT:
                 raise
 
-        self.version = v
-        self._inline = v & FLAG_INLINE_DATA
-        self._generaldelta = v & FLAG_GENERALDELTA
-        flags = v & ~0xFFFF
-        fmt = v & 0xFFFF
+        self.version = versionflags
+        self._inline = versionflags & FLAG_INLINE_DATA
+        self._generaldelta = versionflags & FLAG_GENERALDELTA
+        flags = versionflags & ~0xFFFF
+        fmt = versionflags & 0xFFFF
         if fmt == REVLOGV0:
             if flags:
                 raise error.RevlogError(_('unknown flags (%#04x) in version %d '