revlog: don't pass datafile as an argument
authorMatt Mackall <mpm@selenic.com>
Thu, 22 Mar 2007 19:12:03 -0500
changeset 4257 1b5c38e9d7aa
parent 4256 fe0fe0b4d73b
child 4258 b11a2fb59cf5
revlog: don't pass datafile as an argument
mercurial/bundlerepo.py
mercurial/changelog.py
mercurial/commands.py
mercurial/filelog.py
mercurial/manifest.py
mercurial/revlog.py
--- a/mercurial/bundlerepo.py	Tue Mar 20 22:21:05 2007 -0300
+++ b/mercurial/bundlerepo.py	Thu Mar 22 19:12:03 2007 -0500
@@ -17,7 +17,7 @@
 import localrepo, changelog, manifest, filelog, revlog
 
 class bundlerevlog(revlog.revlog):
-    def __init__(self, opener, indexfile, datafile, bundlefile,
+    def __init__(self, opener, indexfile, bundlefile,
                  linkmapper=None):
         # How it works:
         # to retrieve a revision, we need to know the offset of
@@ -28,7 +28,7 @@
         # len(index[r]). If the tuple is bigger than 7, it is a bundle
         # (it is bigger since we store the node to which the delta is)
         #
-        revlog.revlog.__init__(self, opener, indexfile, datafile)
+        revlog.revlog.__init__(self, opener, indexfile)
         self.bundlefile = bundlefile
         self.basemap = {}
         def chunkpositer():
@@ -140,20 +140,19 @@
 class bundlechangelog(bundlerevlog, changelog.changelog):
     def __init__(self, opener, bundlefile):
         changelog.changelog.__init__(self, opener)
-        bundlerevlog.__init__(self, opener, self.indexfile, self.datafile,
-                              bundlefile)
+        bundlerevlog.__init__(self, opener, self.indexfile, bundlefile)
 
 class bundlemanifest(bundlerevlog, manifest.manifest):
     def __init__(self, opener, bundlefile, linkmapper):
         manifest.manifest.__init__(self, opener)
-        bundlerevlog.__init__(self, opener, self.indexfile, self.datafile,
-                              bundlefile, linkmapper)
+        bundlerevlog.__init__(self, opener, self.indexfile, bundlefile,
+                              linkmapper)
 
 class bundlefilelog(bundlerevlog, filelog.filelog):
     def __init__(self, opener, path, bundlefile, linkmapper):
         filelog.filelog.__init__(self, opener, path)
-        bundlerevlog.__init__(self, opener, self.indexfile, self.datafile,
-                              bundlefile, linkmapper)
+        bundlerevlog.__init__(self, opener, self.indexfile, bundlefile,
+                              linkmapper)
 
 class bundlerepository(localrepo.localrepository):
     def __init__(self, ui, path, bundlename):
--- a/mercurial/changelog.py	Tue Mar 20 22:21:05 2007 -0300
+++ b/mercurial/changelog.py	Thu Mar 22 19:12:03 2007 -0500
@@ -28,8 +28,7 @@
 
 class changelog(revlog):
     def __init__(self, opener, defversion=REVLOGV0):
-        revlog.__init__(self, opener, "00changelog.i", "00changelog.d",
-                        defversion)
+        revlog.__init__(self, opener, "00changelog.i", defversion)
 
     def decode_extra(self, text):
         extra = {}
--- a/mercurial/commands.py	Tue Mar 20 22:21:05 2007 -0300
+++ b/mercurial/commands.py	Thu Mar 22 19:12:03 2007 -0500
@@ -666,7 +666,7 @@
 
 def debugancestor(ui, index, rev1, rev2):
     """find the ancestor revision of two revisions in a given index"""
-    r = revlog.revlog(util.opener(os.getcwd(), audit=False), index, "", 0)
+    r = revlog.revlog(util.opener(os.getcwd(), audit=False), index, 0)
     a = r.ancestor(r.lookup(rev1), r.lookup(rev2))
     ui.write("%d:%s\n" % (r.rev(a), hex(a)))
 
@@ -796,7 +796,7 @@
 def debugdata(ui, file_, rev):
     """dump the contents of an data file revision"""
     r = revlog.revlog(util.opener(os.getcwd(), audit=False),
-                      file_[:-2] + ".i", file_, 0)
+                      file_[:-2] + ".i", 0)
     try:
         ui.write(r.revision(r.lookup(rev)))
     except KeyError:
@@ -816,7 +816,7 @@
 
 def debugindex(ui, file_):
     """dump the contents of an index file"""
-    r = revlog.revlog(util.opener(os.getcwd(), audit=False), file_, "", 0)
+    r = revlog.revlog(util.opener(os.getcwd(), audit=False), file_, 0)
     ui.write("   rev    offset  length   base linkrev" +
              " nodeid       p1           p2\n")
     for i in xrange(r.count()):
@@ -828,7 +828,7 @@
 
 def debugindexdot(ui, file_):
     """dump an index DAG as a .dot file"""
-    r = revlog.revlog(util.opener(os.getcwd(), audit=False), file_, "", 0)
+    r = revlog.revlog(util.opener(os.getcwd(), audit=False), file_, 0)
     ui.write("digraph G {\n")
     for i in xrange(r.count()):
         node = r.node(i)
--- a/mercurial/filelog.py	Tue Mar 20 22:21:05 2007 -0300
+++ b/mercurial/filelog.py	Thu Mar 22 19:12:03 2007 -0500
@@ -12,7 +12,6 @@
     def __init__(self, opener, path, defversion=REVLOG_DEFAULT_VERSION):
         revlog.__init__(self, opener,
                         "/".join(("data", self.encodedir(path + ".i"))),
-                        "/".join(("data", self.encodedir(path + ".d"))),
                         defversion)
 
     # This avoids a collision between a file named foo and a dir named
--- a/mercurial/manifest.py	Tue Mar 20 22:21:05 2007 -0300
+++ b/mercurial/manifest.py	Thu Mar 22 19:12:03 2007 -0500
@@ -38,8 +38,7 @@
     def __init__(self, opener, defversion=REVLOGV0):
         self.mapcache = None
         self.listcache = None
-        revlog.__init__(self, opener, "00manifest.i", "00manifest.d",
-                        defversion)
+        revlog.__init__(self, opener, "00manifest.i", defversion)
 
     def parselines(self, lines):
         for l in lines.splitlines(1):
--- a/mercurial/revlog.py	Tue Mar 20 22:21:05 2007 -0300
+++ b/mercurial/revlog.py	Thu Mar 22 19:12:03 2007 -0500
@@ -311,8 +311,7 @@
     remove data, and can use some simple techniques to avoid the need
     for locking while reading.
     """
-    def __init__(self, opener, indexfile, datafile,
-                 defversion=REVLOG_DEFAULT_VERSION):
+    def __init__(self, opener, indexfile, defversion=REVLOG_DEFAULT_VERSION):
         """
         create a revlog object
 
@@ -320,7 +319,7 @@
         and can be used to implement COW semantics or the like.
         """
         self.indexfile = indexfile
-        self.datafile = datafile
+        self.datafile = indexfile[:-2] + ".d"
         self.opener = opener
 
         self.indexstat = None