Show More
@@ -155,31 +155,41 b' class dirstate(object):' | |||
|
155 | 155 | if self.map is None: |
|
156 | 156 | self.read() |
|
157 | 157 | |
|
158 |
def re |
|
|
159 | self.map = {} | |
|
160 | self.pl = [nullid, nullid] | |
|
161 | try: | |
|
162 | st = self.opener("dirstate").read() | |
|
163 | if not st: return | |
|
164 | except: return | |
|
165 | ||
|
158 | def parse(self, st): | |
|
166 | 159 | self.pl = [st[:20], st[20: 40]] |
|
167 | 160 | |
|
161 | # deref fields so they will be local in loop | |
|
162 | map = self.map | |
|
163 | copies = self.copies | |
|
164 | format = self.format | |
|
165 | unpack = struct.unpack | |
|
166 | ||
|
168 | 167 | pos = 40 |
|
169 |
e_size = struct.calcsize( |
|
|
168 | e_size = struct.calcsize(format) | |
|
169 | ||
|
170 | 170 | while pos < len(st): |
|
171 | 171 | newpos = pos + e_size |
|
172 |
e = |
|
|
172 | e = unpack(format, st[pos:newpos]) | |
|
173 | 173 | l = e[4] |
|
174 | 174 | pos = newpos |
|
175 | 175 | newpos = pos + l |
|
176 | 176 | f = st[pos:newpos] |
|
177 | 177 | if '\0' in f: |
|
178 | 178 | f, c = f.split('\0') |
|
179 |
|
|
|
180 |
|
|
|
179 | copies[f] = c | |
|
180 | map[f] = e[:4] | |
|
181 | 181 | pos = newpos |
|
182 | 182 | |
|
183 | def read(self): | |
|
184 | self.map = {} | |
|
185 | self.pl = [nullid, nullid] | |
|
186 | try: | |
|
187 | st = self.opener("dirstate").read() | |
|
188 | if st: | |
|
189 | self.parse(st) | |
|
190 | except IOError, err: | |
|
191 | if err.errno != errno.ENOENT: raise | |
|
192 | ||
|
183 | 193 | def copy(self, source, dest): |
|
184 | 194 | self.lazyread() |
|
185 | 195 | self.markdirty() |
General Comments 0
You need to be logged in to leave comments.
Login now