diff mercurial/revlog.py @ 32347: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 bd872f64a8ba
children 67026d65a4fc
line wrap: on
line diff
--- 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.