changeset 32355:67026d65a4fc

revlog: rename constants (API) Feature flag constants don't need "NG" in the name because they will presumably apply to non-"NG" version revlogs. All feature flag constants should also share a similar naming convention to identify them as such. And, "RevlogNG" isn't a great internal name since it isn't obvious it maps to version 1 revlogs. Plus, "NG" (next generation) is only a good name as long as it is the latest version. Since we're talking about version 2, now is as good a time as any to move on from that naming.
author Gregory Szorc <gregory.szorc@gmail.com>
date Wed, 17 May 2017 19:52:18 -0700
parents 9f35c7836f60
children 7340465bd788
files hgext/censor.py mercurial/changelog.py mercurial/debugcommands.py mercurial/revlog.py
diffstat 4 files changed, 19 insertions(+), 19 deletions(-) [+]
line wrap: on
line diff
--- a/hgext/censor.py	Wed May 17 20:01:29 2017 -0700
+++ b/hgext/censor.py	Wed May 17 19:52:18 2017 -0700
@@ -102,7 +102,7 @@
             hint=_('clean/delete/update first'))
 
     flogv = flog.version & 0xFFFF
-    if flogv != revlog.REVLOGNG:
+    if flogv != revlog.REVLOGV1:
         raise error.Abort(
             _('censor does not support revlog version %d') % (flogv,))
 
@@ -117,7 +117,7 @@
     # Using two files instead of one makes it easy to rewrite entry-by-entry
     idxread = repo.svfs(flog.indexfile, 'r')
     idxwrite = repo.svfs(flog.indexfile, 'wb', atomictemp=True)
-    if flog.version & revlog.REVLOGNGINLINEDATA:
+    if flog.version & revlog.FLAG_INLINE_DATA:
         dataread, datawrite = idxread, idxwrite
     else:
         dataread = repo.svfs(flog.datafile, 'r')
--- a/mercurial/changelog.py	Wed May 17 20:01:29 2017 -0700
+++ b/mercurial/changelog.py	Wed May 17 19:52:18 2017 -0700
@@ -279,7 +279,7 @@
 
         if self._initempty:
             # changelogs don't benefit from generaldelta
-            self.version &= ~revlog.REVLOGGENERALDELTA
+            self.version &= ~revlog.FLAG_GENERALDELTA
             self._generaldelta = False
 
         # Delta chains for changelogs tend to be very small because entries
--- a/mercurial/debugcommands.py	Wed May 17 20:01:29 2017 -0700
+++ b/mercurial/debugcommands.py	Wed May 17 19:52:18 2017 -0700
@@ -561,7 +561,7 @@
     """
     r = cmdutil.openrevlog(repo, 'debugdeltachain', file_, opts)
     index = r.index
-    generaldelta = r.version & revlog.REVLOGGENERALDELTA
+    generaldelta = r.version & revlog.FLAG_GENERALDELTA
 
     def revinfo(rev):
         e = index[rev]
@@ -892,7 +892,7 @@
     if format not in (0, 1):
         raise error.Abort(_("unknown format %d") % format)
 
-    generaldelta = r.version & revlog.REVLOGGENERALDELTA
+    generaldelta = r.version & revlog.FLAG_GENERALDELTA
     if generaldelta:
         basehdr = ' delta'
     else:
@@ -1725,9 +1725,9 @@
     format = v & 0xFFFF
     flags = []
     gdelta = False
-    if v & revlog.REVLOGNGINLINEDATA:
+    if v & revlog.FLAG_INLINE_DATA:
         flags.append('inline')
-    if v & revlog.REVLOGGENERALDELTA:
+    if v & revlog.FLAG_GENERALDELTA:
         gdelta = True
         flags.append('generaldelta')
     if not flags:
--- a/mercurial/revlog.py	Wed May 17 20:01:29 2017 -0700
+++ b/mercurial/revlog.py	Wed May 17 19:52:18 2017 -0700
@@ -45,13 +45,13 @@
 
 # revlog header flags
 REVLOGV0 = 0
-REVLOGNG = 1
-REVLOGNGINLINEDATA = (1 << 16)
-REVLOGGENERALDELTA = (1 << 17)
-REVLOG_DEFAULT_FLAGS = REVLOGNGINLINEDATA
-REVLOG_DEFAULT_FORMAT = REVLOGNG
+REVLOGV1 = 1
+FLAG_INLINE_DATA = (1 << 16)
+FLAG_GENERALDELTA = (1 << 17)
+REVLOG_DEFAULT_FLAGS = FLAG_INLINE_DATA
+REVLOG_DEFAULT_FORMAT = REVLOGV1
 REVLOG_DEFAULT_VERSION = REVLOG_DEFAULT_FORMAT | REVLOG_DEFAULT_FLAGS
-REVLOGNG_FLAGS = REVLOGNGINLINEDATA | REVLOGGENERALDELTA
+REVLOGV1_FLAGS = FLAG_INLINE_DATA | FLAG_GENERALDELTA
 
 # revlog index flags
 REVIDX_ISCENSORED = (1 << 15) # revision has censor metadata, must be verified
@@ -288,7 +288,7 @@
         if opts is not None:
             if 'revlogv1' in opts:
                 if 'generaldelta' in opts:
-                    v |= REVLOGGENERALDELTA
+                    v |= FLAG_GENERALDELTA
             else:
                 v = 0
             if 'chunkcachesize' in opts:
@@ -322,17 +322,17 @@
                 raise
 
         self.version = v
-        self._inline = v & REVLOGNGINLINEDATA
-        self._generaldelta = v & REVLOGGENERALDELTA
+        self._inline = v & FLAG_INLINE_DATA
+        self._generaldelta = v & FLAG_GENERALDELTA
         flags = v & ~0xFFFF
         fmt = v & 0xFFFF
         if fmt == REVLOGV0 and flags:
             raise RevlogError(_("index %s unknown flags %#04x for format v0")
                               % (self.indexfile, flags >> 16))
-        elif fmt == REVLOGNG and flags & ~REVLOGNG_FLAGS:
+        elif fmt == REVLOGV1 and flags & ~REVLOGV1_FLAGS:
             raise RevlogError(_("index %s unknown flags %#04x for revlogng")
                               % (self.indexfile, flags >> 16))
-        elif fmt > REVLOGNG:
+        elif fmt > REVLOGV1:
             raise RevlogError(_("index %s unknown format %d")
                               % (self.indexfile, fmt))
 
@@ -1452,7 +1452,7 @@
 
         fp = self.opener(self.indexfile, 'w', atomictemp=True,
                          checkambig=self._checkambig)
-        self.version &= ~(REVLOGNGINLINEDATA)
+        self.version &= ~FLAG_INLINE_DATA
         self._inline = False
         for i in self:
             e = self._io.packentry(self.index[i], self.node, self.version, i)