annotate contrib/rewrite-log @ 4865:439e2f2fde42

Fix inconsistency for the stream_out capability in hgweb During some experiments of mine, the uncompressed cloning could not be enabled for hgweb.cgi nor hgwebdir.cgi though the server claimed to be stream_out capable. The only solution was to enable it using the user's .hgrc file. This solution is not acceptable when publishing the repos through an HTTP server because the CGI runs as a www dedicated user whose's home hgrc file may not be accessible to users publishing their repos through their userdir. For such cases we could end up with this typical debug output: hg --debug clone --uncompressed http://server/hg/project destination directory: project sending capabilities command capabilities: lookup changegroupsubset stream=1 unbundle=HG10GZ,HG10BZ,HG10UN sending stream_out command abort: operation forbidden by server The error lies in the fact the hgweb object defines new accessors to the repo configuration that trust things by default (untrusted=True) but the streamclone:stream_out function uses the usual accessors to the repo.ui object, which do not trust by default (untrusted=False) Fix this inconsistency, adding a new parameter to the stream_out function. hgweb then forces a "trust by default" behavior.
author Edouard Gomez <ed.gomez@free.fr>
date Sat, 12 May 2007 00:41:30 +0200
parents 9ccc6be9ae4d
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
141
5f471a75d607 Simple script to recompress a log file
mpm@selenic.com
parents:
diff changeset
1 #!/usr/bin/env python
5f471a75d607 Simple script to recompress a log file
mpm@selenic.com
parents:
diff changeset
2 import sys, os
3711
9ccc6be9ae4d update rewrite-log for tip ; chmod it
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents: 3512
diff changeset
3 from mercurial import revlog, transaction, node, util
141
5f471a75d607 Simple script to recompress a log file
mpm@selenic.com
parents:
diff changeset
4
5f471a75d607 Simple script to recompress a log file
mpm@selenic.com
parents:
diff changeset
5 f = sys.argv[1]
5f471a75d607 Simple script to recompress a log file
mpm@selenic.com
parents:
diff changeset
6
3711
9ccc6be9ae4d update rewrite-log for tip ; chmod it
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents: 3512
diff changeset
7 r1 = revlog.revlog(util.opener(os.getcwd(), audit=False), f + ".i", f + ".d")
9ccc6be9ae4d update rewrite-log for tip ; chmod it
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents: 3512
diff changeset
8 r2 = revlog.revlog(util.opener(os.getcwd(), audit=False), f + ".i2", f + ".d2")
141
5f471a75d607 Simple script to recompress a log file
mpm@selenic.com
parents:
diff changeset
9
3711
9ccc6be9ae4d update rewrite-log for tip ; chmod it
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents: 3512
diff changeset
10 tr = transaction.transaction(sys.stderr.write, open, "journal")
141
5f471a75d607 Simple script to recompress a log file
mpm@selenic.com
parents:
diff changeset
11
5f471a75d607 Simple script to recompress a log file
mpm@selenic.com
parents:
diff changeset
12 for i in xrange(r1.count()):
5f471a75d607 Simple script to recompress a log file
mpm@selenic.com
parents:
diff changeset
13 n = r1.node(i)
5f471a75d607 Simple script to recompress a log file
mpm@selenic.com
parents:
diff changeset
14 p1, p2 = r1.parents(n)
5f471a75d607 Simple script to recompress a log file
mpm@selenic.com
parents:
diff changeset
15 l = r1.linkrev(n)
5f471a75d607 Simple script to recompress a log file
mpm@selenic.com
parents:
diff changeset
16 t = r1.revision(n)
5f471a75d607 Simple script to recompress a log file
mpm@selenic.com
parents:
diff changeset
17 n2 = r2.addrevision(t, tr, l, p1, p2)
5f471a75d607 Simple script to recompress a log file
mpm@selenic.com
parents:
diff changeset
18 tr.close()
5f471a75d607 Simple script to recompress a log file
mpm@selenic.com
parents:
diff changeset
19
5f471a75d607 Simple script to recompress a log file
mpm@selenic.com
parents:
diff changeset
20 os.rename(f + ".i", f + ".i.old")
5f471a75d607 Simple script to recompress a log file
mpm@selenic.com
parents:
diff changeset
21 os.rename(f + ".d", f + ".d.old")
5f471a75d607 Simple script to recompress a log file
mpm@selenic.com
parents:
diff changeset
22 os.rename(f + ".i2", f + ".i")
5f471a75d607 Simple script to recompress a log file
mpm@selenic.com
parents:
diff changeset
23 os.rename(f + ".d2", f + ".d")