changeset 32307:3caec778774b

changelog: make sure datafile is 00changelog.d (API) 0ad0d26ff7 makes it possible for changelog datafile to be "00changelog.i.d", which is wrong. This patch adds an explicit datafile parameter to fix it.
author Jun Wu <quark@fb.com>
date Wed, 17 May 2017 20:14:27 -0700
parents 2d19664e257d
children e8569cc131d1
files mercurial/changelog.py mercurial/revlog.py
diffstat 2 files changed, 5 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/changelog.py	Wed May 17 23:01:56 2017 +0900
+++ b/mercurial/changelog.py	Wed May 17 20:14:27 2017 -0700
@@ -273,7 +273,9 @@
         else:
             indexfile = '00changelog.i'
 
-        revlog.revlog.__init__(self, opener, indexfile, checkambig=True)
+        datafile = '00changelog.d'
+        revlog.revlog.__init__(self, opener, indexfile, datafile=datafile,
+                               checkambig=True)
 
         if self._initempty:
             # changelogs don't benefit from generaldelta
--- a/mercurial/revlog.py	Wed May 17 23:01:56 2017 +0900
+++ b/mercurial/revlog.py	Wed May 17 20:14:27 2017 -0700
@@ -252,7 +252,7 @@
     If checkambig, indexfile is opened with checkambig=True at
     writing, to avoid file stat ambiguity.
     """
-    def __init__(self, opener, indexfile, checkambig=False):
+    def __init__(self, opener, indexfile, datafile=None, checkambig=False):
         """
         create a revlog object
 
@@ -260,7 +260,7 @@
         and can be used to implement COW semantics or the like.
         """
         self.indexfile = indexfile
-        self.datafile = indexfile[:-2] + ".d"
+        self.datafile = datafile or (indexfile[:-2] + ".d")
         self.opener = opener
         #  When True, indexfile is opened with checkambig=True at writing, to
         #  avoid file stat ambiguity.