# HG changeset patch # User Dirkjan Ochtman # Date 2009-11-06 21:46:46 # Node ID 0e080d519d1b546ead04d7efd9e2dbd589d6f878 # Parent 732fc0e9d411e0b94e56779d4ac053ceac0349e4 hgweb: treat rev as raw-rev if user agent is hg diff --git a/mercurial/hgweb/hgweb_mod.py b/mercurial/hgweb/hgweb_mod.py --- a/mercurial/hgweb/hgweb_mod.py +++ b/mercurial/hgweb/hgweb_mod.py @@ -151,6 +151,10 @@ class hgweb(object): if args: req.form['file'] = args + ua = req.env.get('HTTP_USER_AGENT', '') + if cmd == 'rev' and 'mercurial' in ua: + req.form['style'] = ['raw'] + if cmd == 'archive': fn = req.form['node'][0] for type_, spec in self.archive_specs.iteritems(): diff --git a/tests/test-hgweb-diffs b/tests/test-hgweb-diffs --- a/tests/test-hgweb-diffs +++ b/tests/test-hgweb-diffs @@ -38,5 +38,11 @@ echo % revision echo % diff removed file "$TESTDIR/get-with-headers.py" localhost:$HGPORT '/diff/tip/a' +cd .. +echo % test import rev as raw-rev +hg clone -r0 test test1 +cd test1 +hg import --exact http://localhost:$HGPORT/rev/1 + echo % errors -cat errors.log +cat ../test/errors.log diff --git a/tests/test-hgweb-diffs.out b/tests/test-hgweb-diffs.out --- a/tests/test-hgweb-diffs.out +++ b/tests/test-hgweb-diffs.out @@ -417,4 +417,13 @@ files, or words in the commit message +% test import rev as raw-rev +requesting all changes +adding changesets +adding manifests +adding file changes +added 1 changesets with 2 changes to 2 files +updating to branch default +2 files updated, 0 files merged, 0 files removed, 0 files unresolved +applying http://localhost:20059/rev/1 % errors