# HG changeset patch # User Martin Geisler # Date 2009-08-26 22:01:03 # Node ID 4483af166c6130819edf011c8c99fcb2488d38e3 # Parent 2a514468772787b049216d1024bc98dde1f269da # Parent 3738c8cff1bf380ef20044b0ace1134e4e91997f Merge with crew-stable diff --git a/mercurial/hgweb/webcommands.py b/mercurial/hgweb/webcommands.py --- a/mercurial/hgweb/webcommands.py +++ b/mercurial/hgweb/webcommands.py @@ -236,7 +236,11 @@ def changeset(web, req, tmpl): parity=parity.next())) parity = paritygen(web.stripecount) - diffs = webutil.diffs(web.repo, tmpl, ctx, None, parity) + style = web.config('web', 'style', 'paper') + if 'style' in req.form: + style = req.form['style'][0] + + diffs = webutil.diffs(web.repo, tmpl, ctx, None, parity, style) return tmpl('changeset', diff=diffs, rev=ctx.rev(), @@ -474,7 +478,11 @@ def filediff(web, req, tmpl): # path already defined in except clause parity = paritygen(web.stripecount) - diffs = webutil.diffs(web.repo, tmpl, fctx or ctx, [path], parity) + style = web.config('web', 'style', 'paper') + if 'style' in req.form: + style = req.form['style'][0] + + diffs = webutil.diffs(web.repo, tmpl, fctx or ctx, [path], parity, style) rename = fctx and webutil.renamelink(fctx) or [] ctx = fctx and fctx or ctx return tmpl("filediff", diff --git a/mercurial/hgweb/webutil.py b/mercurial/hgweb/webutil.py --- a/mercurial/hgweb/webutil.py +++ b/mercurial/hgweb/webutil.py @@ -153,7 +153,7 @@ def listfilediffs(tmpl, files, node, max if len(files) > max: yield tmpl('fileellipses') -def diffs(repo, tmpl, ctx, files, parity): +def diffs(repo, tmpl, ctx, files, parity, style): def countgen(): start = 1 @@ -195,7 +195,7 @@ def diffs(repo, tmpl, ctx, files, parity yield tmpl('diffblock', parity=parity.next(), lines=prettyprintlines(''.join(block))) block = [] - if chunk.startswith('diff'): + if chunk.startswith('diff') and style != 'raw': chunk = ''.join(chunk.splitlines(True)[1:]) block.append(chunk) yield tmpl('diffblock', parity=parity.next(), diff --git a/tests/test-hgweb-commands.out b/tests/test-hgweb-commands.out --- a/tests/test-hgweb-commands.out +++ b/tests/test-hgweb-commands.out @@ -337,6 +337,7 @@ 200 Script output follows # Parent 2ef0ac749a14e4f57a5a822464a0902c6f7f448f Added tag 1.0 for changeset 2ef0ac749a14 +diff -r 2ef0ac749a14 -r a4f92ed23982 .hgtags --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/.hgtags Thu Jan 01 00:00:00 1970 +0000 @@ -0,0 +1,1 @@ @@ -451,6 +452,7 @@ files, or words in the commit message> $DAEMON_PIDS echo % revision "$TESTDIR/get-with-headers.py" localhost:$HGPORT '/rev/0' +echo % raw revision +"$TESTDIR/get-with-headers.py" localhost:$HGPORT '/raw-rev/0' + echo % diff removed file "$TESTDIR/get-with-headers.py" localhost:$HGPORT '/diff/tip/a' @@ -29,6 +32,9 @@ cat hg.pid >> $DAEMON_PIDS echo % revision "$TESTDIR/get-with-headers.py" localhost:$HGPORT '/rev/0' +echo % revision +"$TESTDIR/get-with-headers.py" localhost:$HGPORT '/raw-rev/0' + echo % diff removed file "$TESTDIR/get-with-headers.py" localhost:$HGPORT '/diff/tip/a' 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 @@ -95,6 +95,28 @@ files, or words in the commit message +% raw revision +200 Script output follows + + +# HG changeset patch +# User test +# Date 0 0 +# Node ID 0cd96de13884b090099512d4794ae87ad067ea8e + +a + +diff -r 000000000000 -r 0cd96de13884 a +--- /dev/null Thu Jan 01 00:00:00 1970 +0000 ++++ b/a Thu Jan 01 00:00:00 1970 +0000 +@@ -0,0 +1,1 @@ ++a +diff -r 000000000000 -r 0cd96de13884 b +--- /dev/null Thu Jan 01 00:00:00 1970 +0000 ++++ b/b Thu Jan 01 00:00:00 1970 +0000 +@@ -0,0 +1,1 @@ ++b + % diff removed file 200 Script output follows @@ -279,6 +301,30 @@ files, or words in the commit message +% revision +200 Script output follows + + +# HG changeset patch +# User test +# Date 0 0 +# Node ID 0cd96de13884b090099512d4794ae87ad067ea8e + +a + +diff --git a/a b/a +new file mode 100644 +--- /dev/null ++++ b/a +@@ -0,0 +1,1 @@ ++a +diff --git a/b b/b +new file mode 100644 +--- /dev/null ++++ b/b +@@ -0,0 +1,1 @@ ++b + % diff removed file 200 Script output follows diff --git a/tests/test-keyword.out b/tests/test-keyword.out --- a/tests/test-keyword.out +++ b/tests/test-keyword.out @@ -359,6 +359,7 @@ 200 Script output follows # Parent bb948857c743469b22bbf51f7ec8112279ca5d83 xa +diff -r bb948857c743 -r cfa68229c116 x/a --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/x/a Thu Jan 01 00:00:03 1970 +0000 @@ -0,0 +1,4 @@ @@ -371,6 +372,7 @@ xa 200 Script output follows +diff -r ef63ca68695b -r bb948857c743 a --- a/a Thu Jan 01 00:00:00 1970 +0000 +++ b/a Thu Jan 01 00:00:02 1970 +0000 @@ -1,3 +1,4 @@