Mercurial > hg-stable
changeset 7945:94d7e14cfa42
pure/parsers: fix circular imports, import mercurial modules properly
author | Matt Mackall <mpm@selenic.com> |
---|---|
date | Fri, 03 Apr 2009 12:37:38 -0500 |
parents | e9b48afd0e78 |
children | 9d36291f787a |
files | mercurial/pure/parsers.py |
diffstat | 1 files changed, 15 insertions(+), 6 deletions(-) [+] |
line wrap: on
line diff
--- a/mercurial/pure/parsers.py Fri Apr 03 12:37:30 2009 -0500 +++ b/mercurial/pure/parsers.py Fri Apr 03 12:37:38 2009 -0500 @@ -5,8 +5,9 @@ # 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, nullrev -import revlog, dirstate, struct, util, zlib +from mercurial.node import bin, nullid, nullrev +from mercurial import util +import struct, zlib _pack = struct.pack _unpack = struct.unpack @@ -24,7 +25,14 @@ mfdict[f] = bin(n) def parse_index(data, inline): - indexformatng = revlog.indexformatng + def gettype(q): + return int(q & 0xFFFF) + + def offset_type(offset, type): + return long(long(offset) << 16 | type) + + indexformatng = ">Qiiiiii20s12x" + s = struct.calcsize(indexformatng) index = [] cache = None @@ -52,8 +60,8 @@ off += s e = list(index[0]) - type = revlog.gettype(e[0]) - e[0] = revlog.offset_type(0, type) + type = gettype(e[0]) + e[0] = offset_type(0, type) index[0] = tuple(e) # add the magic null revision at -1 @@ -64,7 +72,8 @@ def parse_dirstate(dmap, copymap, st): parents = [st[:20], st[20: 40]] # deref fields so they will be local in loop - e_size = struct.calcsize(dirstate._format) + format = ">cllll" + e_size = struct.calcsize(format) pos1 = 40 l = len(st)