# HG changeset patch # User Steve Losh # Date 1278473470 14400 # Node ID 3b303e310e16bee67e5870c5c5e2933e1357dd7c # Parent 9a08affdfc353d4bff5be3543655f45dd22a791e web: add a link to download a changeset patch diff -r 9a08affdfc35 -r 3b303e310e16 review/static/style.css --- a/review/static/style.css Tue Jul 06 21:27:18 2010 -0400 +++ b/review/static/style.css Tue Jul 06 23:31:10 2010 -0400 @@ -393,6 +393,11 @@ -moz-border-radius-bottomleft: 3px; border-bottom-left-radius: 3px; } +#changeset .content .head .patch { + position: absolute; + top: 43px; + right: -16px; +} #changeset .content .head .fulldesc { width: 660px; font-size: 12px; diff -r 9a08affdfc35 -r 3b303e310e16 review/static/style.less --- a/review/static/style.less Tue Jul 06 21:27:18 2010 -0400 +++ b/review/static/style.less Tue Jul 06 23:31:10 2010 -0400 @@ -381,6 +381,11 @@ -moz-border-radius-bottomleft: 3px; border-bottom-left-radius: 3px; } + .patch { + position: absolute; + top: 43px; + right: -16px; + } .fulldesc { width: 660px; font-size: 12px; diff -r 9a08affdfc35 -r 3b303e310e16 review/templates/changeset.html --- a/review/templates/changeset.html Tue Jul 06 21:27:18 2010 -0400 +++ b/review/templates/changeset.html Tue Jul 06 23:31:10 2010 -0400 @@ -25,6 +25,7 @@ {% block content %}
 
+

{{ rev.rev() }}: diff -r 9a08affdfc35 -r 3b303e310e16 review/web.py --- a/review/web.py Tue Jul 06 21:27:18 2010 -0400 +++ b/review/web.py Tue Jul 06 23:31:10 2010 -0400 @@ -3,9 +3,10 @@ """The review extension's web UI.""" import sys, os +import StringIO from hashlib import md5 -from mercurial import commands, hg, templatefilters +from mercurial import cmdutil, commands, hg, templatefilters from mercurial.node import short from mercurial.util import email @@ -33,7 +34,7 @@ import markdown2 from flask import Flask -from flask import abort, g, redirect, render_template, request +from flask import abort, g, redirect, render_template, request, Response app = Flask(__name__) LOG_PAGE_LEN = 15 @@ -168,6 +169,12 @@ newer=newer, older=older) +@app.route('/changeset//patch/') +def patch(revhash): + result = StringIO.StringIO() + cmdutil.export(g.datastore.target, [revhash], fp=result) + return Response(result.getvalue(), content_type="text/plain") + @app.route('/pull/', methods=['POST']) def pull(): if not app.read_only: