diff --git a/hgext/censor.py b/hgext/censor.py --- a/hgext/censor.py +++ b/hgext/censor.py @@ -34,12 +34,15 @@ error, filelog, lock as lockmod, + policy, registrar, revlog, scmutil, util, ) +parsers = policy.importmod(r'parsers') + cmdtable = {} command = registrar.command(cmdtable) # Note for extension authors: ONLY specify testedwith = 'ships-with-hg-core' for @@ -138,14 +141,20 @@ The newdata argument, if given, is a tuple of three positive integers: (new compressed, new uncompressed, added flag bits). """ - offlags, comp, uncomp, base, link, p1, p2, nodeid = flog.index[r] - flags = revlog.gettype(offlags) + idx = flog.index[r] + flags = revlog.gettype(idx.offsetflags) + comp = idx.chunklength + uncomp = idx.rawlength + if newdata: comp, uncomp, nflags = newdata flags |= nflags + offlags = revlog.offset_type(newoffs, flags) - e = (offlags, comp, uncomp, r, link, p1, p2, nodeid) - idxwrite.write(rio.packentry(e, None, flog.version, r)) + entry = parsers.IndexV1Entry(offlags, comp, uncomp, r, + idx.linkrev, idx.p1rev, idx.p2rev, + idx.node) + idxwrite.write(rio.packentry(entry, None, flog.version, r)) idxread.seek(rio.size, 1) def rewrite(r, offs, data, nflags=revlog.REVIDX_DEFAULT_FLAGS): diff --git a/mercurial/revlog.py b/mercurial/revlog.py --- a/mercurial/revlog.py +++ b/mercurial/revlog.py @@ -293,11 +293,12 @@ return index, nodemap, None def packentry(self, entry, node, version, rev): - if gettype(entry[0]): + if gettype(entry.offsetflags): raise RevlogError(_('index entry flags need revlog version 1')) - e2 = (getoffset(entry[0]), entry[1], entry[3], entry[4], - node(entry[5]), node(entry[6]), entry[7]) - return indexformatv0_pack(*e2) + return indexformatv0_pack(entry.offsetflags, entry.chunklength, + entry.baserev, entry.linkrev, + node(entry.p1rev), node(entry.p2rev), + entry.node) # index ng: # 6 bytes: offset @@ -329,7 +330,9 @@ return index, getattr(index, 'nodemap', None), cache def packentry(self, entry, node, version, rev): - p = indexformatng_pack(*entry) + p = indexformatng_pack(entry.offsetflags, entry.chunklength, + entry.rawlength, entry.baserev, entry.linkrev, + entry.p1rev, entry.p2rev, entry.node) if rev == 0: p = versionformat_pack(version) + p[4:] return p @@ -1990,8 +1993,8 @@ l = len(data[1]) + len(data[0]) base = chainbase = curr - e = (offset_type(offset, flags), l, textlen, - base, link, p1r, p2r, node) + e = parsers.IndexV1Entry(offset_type(offset, flags), l, textlen, + base, link, p1r, p2r, node) self.index.insert(-1, e) self.nodemap[node] = curr