# HG changeset patch # User Matt Mackall # Date 1238780258 18000 # Node ID 94d7e14cfa423fa773e17aec99cc9a2cbdeb24b4 # Parent e9b48afd0e788b09b640636ba1f9545c8f32fbe0 pure/parsers: fix circular imports, import mercurial modules properly diff -r e9b48afd0e78 -r 94d7e14cfa42 mercurial/pure/parsers.py --- 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)