changeset 9404:4483af166c61

Merge with crew-stable
author Martin Geisler <mg@lazybytes.net>
date Thu, 27 Aug 2009 00:01:03 +0200
parents 2a5144687727 (current diff) 3738c8cff1bf (diff)
children 7345fa5e572e
files mercurial/hgweb/webcommands.py tests/test-keyword.out
diffstat 6 files changed, 68 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/hgweb/webcommands.py	Thu Aug 20 23:35:47 2009 +0200
+++ b/mercurial/hgweb/webcommands.py	Thu Aug 27 00:01:03 2009 +0200
@@ -236,7 +236,11 @@
                           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 @@
         # 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",
--- a/mercurial/hgweb/webutil.py	Thu Aug 20 23:35:47 2009 +0200
+++ b/mercurial/hgweb/webutil.py	Thu Aug 27 00:01:03 2009 +0200
@@ -153,7 +153,7 @@
     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 @@
             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(),
--- a/tests/test-hgweb-commands.out	Thu Aug 20 23:35:47 2009 +0200
+++ b/tests/test-hgweb-commands.out	Thu Aug 27 00:01:03 2009 +0200
@@ -337,6 +337,7 @@
 # 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 @@
 200 Script output follows
 
 
+diff -r 000000000000 -r a4f92ed23982 foo
 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
 +++ b/foo	Thu Jan 01 00:00:00 1970 +0000
 @@ -0,0 +1,1 @@
--- a/tests/test-hgweb-diffs	Thu Aug 20 23:35:47 2009 +0200
+++ b/tests/test-hgweb-diffs	Thu Aug 27 00:01:03 2009 +0200
@@ -18,6 +18,9 @@
 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 @@
 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'
 
--- a/tests/test-hgweb-diffs.out	Thu Aug 20 23:35:47 2009 +0200
+++ b/tests/test-hgweb-diffs.out	Thu Aug 27 00:01:03 2009 +0200
@@ -95,6 +95,28 @@
 </body>
 </html>
 
+% 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 @@
 </body>
 </html>
 
+% 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
 
--- a/tests/test-keyword.out	Thu Aug 20 23:35:47 2009 +0200
+++ b/tests/test-keyword.out	Thu Aug 27 00:01:03 2009 +0200
@@ -359,6 +359,7 @@
 # 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 @@
 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 @@