diff --git a/mercurial/changelog.py b/mercurial/changelog.py --- a/mercurial/changelog.py +++ b/mercurial/changelog.py @@ -6,9 +6,8 @@ # of the GNU General Public License, incorporated herein by reference. from node import bin, hex, nullid -from revlog import revlog, RevlogError from i18n import _ -import util, error +import util, error, revlog def _string_escape(text): """ @@ -75,9 +74,9 @@ class appender: self.data.append(str(s)) self.offset += len(s) -class changelog(revlog): +class changelog(revlog.revlog): def __init__(self, opener): - revlog.__init__(self, opener, "00changelog.i") + revlog.revlog.__init__(self, opener, "00changelog.i") def delayupdate(self): "delay visibility of index updates to other readers" @@ -119,7 +118,7 @@ class changelog(revlog): def checkinlinesize(self, tr, fp=None): if self.opener == self._delayopener: return - return revlog.checkinlinesize(self, tr, fp) + return revlog.revlog.checkinlinesize(self, tr, fp) def decode_extra(self, text): extra = {} diff --git a/mercurial/filelog.py b/mercurial/filelog.py --- a/mercurial/filelog.py +++ b/mercurial/filelog.py @@ -5,12 +5,11 @@ # This software may be used and distributed according to the terms # of the GNU General Public License, incorporated herein by reference. -from node import bin, nullid -from revlog import revlog +import revlog -class filelog(revlog): +class filelog(revlog.revlog): def __init__(self, opener, path): - revlog.__init__(self, opener, + revlog.revlog.__init__(self, opener, "/".join(("data", self.encodedir(path + ".i")))) # This avoids a collision between a file named foo and a dir named @@ -55,11 +54,11 @@ class filelog(revlog): return self.addrevision(text, transaction, link, p1, p2) def renamed(self, node): - if self.parents(node)[0] != nullid: + if self.parents(node)[0] != revlog.nullid: return False m = self._readmeta(node) if m and "copy" in m: - return (m["copy"], bin(m["copyrev"])) + return (m["copy"], revlog.bin(m["copyrev"])) return False def size(self, rev): @@ -70,7 +69,7 @@ class filelog(revlog): if self.renamed(node): return len(self.read(node)) - return revlog.size(self, rev) + return revlog.revlog.size(self, rev) def cmp(self, node, text): """compare text with a given file revision""" @@ -80,4 +79,4 @@ class filelog(revlog): t2 = self.read(node) return t2 != text - return revlog.cmp(self, node, text) + return revlog.revlog.cmp(self, node, text) diff --git a/mercurial/manifest.py b/mercurial/manifest.py --- a/mercurial/manifest.py +++ b/mercurial/manifest.py @@ -5,10 +5,8 @@ # This software may be used and distributed according to the terms # of the GNU General Public License, incorporated herein by reference. -from node import bin, hex, nullid -from revlog import revlog from i18n import _ -import array, struct, mdiff, parsers, util, error +import array, struct, mdiff, parsers, util, error, revlog class manifestdict(dict): def __init__(self, mapping=None, flags=None): @@ -23,11 +21,11 @@ class manifestdict(dict): def copy(self): return manifestdict(dict.copy(self), dict.copy(self._flags)) -class manifest(revlog): +class manifest(revlog.revlog): def __init__(self, opener): self.mapcache = None self.listcache = None - revlog.__init__(self, opener, "00manifest.i") + revlog.revlog.__init__(self, opener, "00manifest.i") def parse(self, lines): mfdict = manifestdict() @@ -39,7 +37,8 @@ class manifest(revlog): return self.parse(mdiff.patchtext(self.revdiff(r - 1, r))) def read(self, node): - if node == nullid: return manifestdict() # don't upset local cache + if node == revlog.nullid: + return manifestdict() # don't upset local cache if self.mapcache and self.mapcache[0] == node: return self.mapcache[1] text = self.revision(node) @@ -101,7 +100,7 @@ class manifest(revlog): return None, None l = text[start:end] f, n = l.split('\0') - return bin(n[:40]), n[40:-1] + return revlog.bin(n[:40]), n[40:-1] def add(self, map, transaction, link, p1=None, p2=None, changed=None): @@ -136,7 +135,8 @@ class manifest(revlog): # if this is changed to support newlines in filenames, # be sure to check the templates/ dir again (especially *-raw.tmpl) - text = ["%s\000%s%s\n" % (f, hex(map[f]), map.flags(f)) + hex, flags = revlog.hex, map.flags + text = ["%s\000%s%s\n" % (f, hex(map[f]), flags(f)) for f in files] self.listcache = array.array('c', "".join(text)) cachedelta = None @@ -164,7 +164,7 @@ class manifest(revlog): # bs will either be the index of the item or the insert point start, end = self._search(addbuf, f, start) if w[1] == 0: - l = "%s\000%s%s\n" % (f, hex(map[f]), map.flags(f)) + l = "%s\000%s%s\n" % (f, revlog.hex(map[f]), map.flags(f)) else: l = "" if start == end and w[1] == 1: