Mercurial > hg-stable
changeset 4607:49dcac6ede26
dirstate: fold parse into read
author | Matt Mackall <mpm@selenic.com> |
---|---|
date | Mon, 18 Jun 2007 13:24:33 -0500 |
parents | 2651099c5018 |
children | 220211b88656 |
files | mercurial/dirstate.py |
diffstat | 1 files changed, 14 insertions(+), 14 deletions(-) [+] |
line wrap: on
line diff
--- a/mercurial/dirstate.py Mon Jun 18 13:24:33 2007 -0500 +++ b/mercurial/dirstate.py Mon Jun 18 13:24:33 2007 -0500 @@ -204,11 +204,22 @@ except KeyError: return "?" - def parse(self, st): + def read(self): + self.map = {} + self.copymap = {} + self.pl = [nullid, nullid] + try: + st = self.opener("dirstate").read() + except IOError, err: + if err.errno != errno.ENOENT: raise + return + if not st: + return + self.pl = [st[:20], st[20: 40]] # deref fields so they will be local in loop - map = self.map + dmap = self.map copymap = self.copymap format = self.format unpack = struct.unpack @@ -226,20 +237,9 @@ if '\0' in f: f, c = f.split('\0') copymap[f] = c - map[f] = e[:4] + dmap[f] = e[:4] pos = newpos - def read(self): - self.map = {} - self.copymap = {} - self.pl = [nullid, nullid] - try: - st = self.opener("dirstate").read() - if st: - self.parse(st) - except IOError, err: - if err.errno != errno.ENOENT: raise - def reload(self): for a in "map copymap _branch pl dirs".split(): if hasattr(self, a):