view contrib/rewrite-log @ 4369:d7ad1e42a368

util._matcher: speed up regexp matching. In 4babaa52badf, Benoit made a change that substantially slows matching when a big .hgignore file is in play, because it calls into the regexp matching engine potentially hundreds of times per file to be matched. I've partly rolled back his change, so that we only call into the matcher once per file, but preserved the ability to report a meaningful error message if there's a syntax error in the regexp.
author Bryan O'Sullivan <bos@serpentine.com>
date Tue, 24 Apr 2007 10:53:25 -0700
parents 9ccc6be9ae4d
children
line wrap: on
line source

#!/usr/bin/env python
import sys, os
from mercurial import revlog, transaction, node, util

f = sys.argv[1]

r1 = revlog.revlog(util.opener(os.getcwd(), audit=False), f + ".i", f + ".d")
r2 = revlog.revlog(util.opener(os.getcwd(), audit=False), f + ".i2", f + ".d2")

tr = transaction.transaction(sys.stderr.write, open, "journal")

for i in xrange(r1.count()):
    n = r1.node(i)
    p1, p2 = r1.parents(n)
    l = r1.linkrev(n)
    t = r1.revision(n)
    n2 = r2.addrevision(t, tr, l, p1, p2)
tr.close()

os.rename(f + ".i", f + ".i.old")
os.rename(f + ".d", f + ".d.old")
os.rename(f + ".i2", f + ".i")
os.rename(f + ".d2", f + ".d")