contrib/rewrite-log
author Martin Geisler <mg@lazybytes.net>
Tue, 01 Dec 2009 00:43:21 +0100
branchstable
changeset 9971 fa99480d5135
parent 3711 9ccc6be9ae4d
permissions -rwxr-xr-x
doc/Makefile: ensure C locale The man pages can actually be translated by building them in a different locale. However, the man pages contain internal links to certain sections, and when the section titles are translated, the links change too. So it is currently not recommended to build the man pages in anything by the "C" locale.

#!/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")