##// END OF EJS Templates
revlog: kill from-style imports...
Matt Mackall -
r7634:14a4337a default
parent child Browse files
Show More
@@ -6,9 +6,8 b''
6 # of the GNU General Public License, incorporated herein by reference.
6 # of the GNU General Public License, incorporated herein by reference.
7
7
8 from node import bin, hex, nullid
8 from node import bin, hex, nullid
9 from revlog import revlog, RevlogError
10 from i18n import _
9 from i18n import _
11 import util, error
10 import util, error, revlog
12
11
13 def _string_escape(text):
12 def _string_escape(text):
14 """
13 """
@@ -75,9 +74,9 b' class appender:'
75 self.data.append(str(s))
74 self.data.append(str(s))
76 self.offset += len(s)
75 self.offset += len(s)
77
76
78 class changelog(revlog):
77 class changelog(revlog.revlog):
79 def __init__(self, opener):
78 def __init__(self, opener):
80 revlog.__init__(self, opener, "00changelog.i")
79 revlog.revlog.__init__(self, opener, "00changelog.i")
81
80
82 def delayupdate(self):
81 def delayupdate(self):
83 "delay visibility of index updates to other readers"
82 "delay visibility of index updates to other readers"
@@ -119,7 +118,7 b' class changelog(revlog):'
119 def checkinlinesize(self, tr, fp=None):
118 def checkinlinesize(self, tr, fp=None):
120 if self.opener == self._delayopener:
119 if self.opener == self._delayopener:
121 return
120 return
122 return revlog.checkinlinesize(self, tr, fp)
121 return revlog.revlog.checkinlinesize(self, tr, fp)
123
122
124 def decode_extra(self, text):
123 def decode_extra(self, text):
125 extra = {}
124 extra = {}
@@ -5,12 +5,11 b''
5 # This software may be used and distributed according to the terms
5 # This software may be used and distributed according to the terms
6 # of the GNU General Public License, incorporated herein by reference.
6 # of the GNU General Public License, incorporated herein by reference.
7
7
8 from node import bin, nullid
8 import revlog
9 from revlog import revlog
10
9
11 class filelog(revlog):
10 class filelog(revlog.revlog):
12 def __init__(self, opener, path):
11 def __init__(self, opener, path):
13 revlog.__init__(self, opener,
12 revlog.revlog.__init__(self, opener,
14 "/".join(("data", self.encodedir(path + ".i"))))
13 "/".join(("data", self.encodedir(path + ".i"))))
15
14
16 # This avoids a collision between a file named foo and a dir named
15 # This avoids a collision between a file named foo and a dir named
@@ -55,11 +54,11 b' class filelog(revlog):'
55 return self.addrevision(text, transaction, link, p1, p2)
54 return self.addrevision(text, transaction, link, p1, p2)
56
55
57 def renamed(self, node):
56 def renamed(self, node):
58 if self.parents(node)[0] != nullid:
57 if self.parents(node)[0] != revlog.nullid:
59 return False
58 return False
60 m = self._readmeta(node)
59 m = self._readmeta(node)
61 if m and "copy" in m:
60 if m and "copy" in m:
62 return (m["copy"], bin(m["copyrev"]))
61 return (m["copy"], revlog.bin(m["copyrev"]))
63 return False
62 return False
64
63
65 def size(self, rev):
64 def size(self, rev):
@@ -70,7 +69,7 b' class filelog(revlog):'
70 if self.renamed(node):
69 if self.renamed(node):
71 return len(self.read(node))
70 return len(self.read(node))
72
71
73 return revlog.size(self, rev)
72 return revlog.revlog.size(self, rev)
74
73
75 def cmp(self, node, text):
74 def cmp(self, node, text):
76 """compare text with a given file revision"""
75 """compare text with a given file revision"""
@@ -80,4 +79,4 b' class filelog(revlog):'
80 t2 = self.read(node)
79 t2 = self.read(node)
81 return t2 != text
80 return t2 != text
82
81
83 return revlog.cmp(self, node, text)
82 return revlog.revlog.cmp(self, node, text)
@@ -5,10 +5,8 b''
5 # This software may be used and distributed according to the terms
5 # This software may be used and distributed according to the terms
6 # of the GNU General Public License, incorporated herein by reference.
6 # of the GNU General Public License, incorporated herein by reference.
7
7
8 from node import bin, hex, nullid
9 from revlog import revlog
10 from i18n import _
8 from i18n import _
11 import array, struct, mdiff, parsers, util, error
9 import array, struct, mdiff, parsers, util, error, revlog
12
10
13 class manifestdict(dict):
11 class manifestdict(dict):
14 def __init__(self, mapping=None, flags=None):
12 def __init__(self, mapping=None, flags=None):
@@ -23,11 +21,11 b' class manifestdict(dict):'
23 def copy(self):
21 def copy(self):
24 return manifestdict(dict.copy(self), dict.copy(self._flags))
22 return manifestdict(dict.copy(self), dict.copy(self._flags))
25
23
26 class manifest(revlog):
24 class manifest(revlog.revlog):
27 def __init__(self, opener):
25 def __init__(self, opener):
28 self.mapcache = None
26 self.mapcache = None
29 self.listcache = None
27 self.listcache = None
30 revlog.__init__(self, opener, "00manifest.i")
28 revlog.revlog.__init__(self, opener, "00manifest.i")
31
29
32 def parse(self, lines):
30 def parse(self, lines):
33 mfdict = manifestdict()
31 mfdict = manifestdict()
@@ -39,7 +37,8 b' class manifest(revlog):'
39 return self.parse(mdiff.patchtext(self.revdiff(r - 1, r)))
37 return self.parse(mdiff.patchtext(self.revdiff(r - 1, r)))
40
38
41 def read(self, node):
39 def read(self, node):
42 if node == nullid: return manifestdict() # don't upset local cache
40 if node == revlog.nullid:
41 return manifestdict() # don't upset local cache
43 if self.mapcache and self.mapcache[0] == node:
42 if self.mapcache and self.mapcache[0] == node:
44 return self.mapcache[1]
43 return self.mapcache[1]
45 text = self.revision(node)
44 text = self.revision(node)
@@ -101,7 +100,7 b' class manifest(revlog):'
101 return None, None
100 return None, None
102 l = text[start:end]
101 l = text[start:end]
103 f, n = l.split('\0')
102 f, n = l.split('\0')
104 return bin(n[:40]), n[40:-1]
103 return revlog.bin(n[:40]), n[40:-1]
105
104
106 def add(self, map, transaction, link, p1=None, p2=None,
105 def add(self, map, transaction, link, p1=None, p2=None,
107 changed=None):
106 changed=None):
@@ -136,7 +135,8 b' class manifest(revlog):'
136
135
137 # if this is changed to support newlines in filenames,
136 # if this is changed to support newlines in filenames,
138 # be sure to check the templates/ dir again (especially *-raw.tmpl)
137 # be sure to check the templates/ dir again (especially *-raw.tmpl)
139 text = ["%s\000%s%s\n" % (f, hex(map[f]), map.flags(f))
138 hex, flags = revlog.hex, map.flags
139 text = ["%s\000%s%s\n" % (f, hex(map[f]), flags(f))
140 for f in files]
140 for f in files]
141 self.listcache = array.array('c', "".join(text))
141 self.listcache = array.array('c', "".join(text))
142 cachedelta = None
142 cachedelta = None
@@ -164,7 +164,7 b' class manifest(revlog):'
164 # bs will either be the index of the item or the insert point
164 # bs will either be the index of the item or the insert point
165 start, end = self._search(addbuf, f, start)
165 start, end = self._search(addbuf, f, start)
166 if w[1] == 0:
166 if w[1] == 0:
167 l = "%s\000%s%s\n" % (f, hex(map[f]), map.flags(f))
167 l = "%s\000%s%s\n" % (f, revlog.hex(map[f]), map.flags(f))
168 else:
168 else:
169 l = ""
169 l = ""
170 if start == end and w[1] == 1:
170 if start == end and w[1] == 1:
General Comments 0
You need to be logged in to leave comments. Login now