de7319315abe

web: it's 2010 -- time to use git diffs
[view raw] [browse files]
author Steve Losh <steve@stevelosh.com>
date Tue, 20 Jul 2010 19:05:06 -0400
parents a572f4405909
children a0929b448985
branches/tags (none)
files review/web.py

Changes

--- a/review/web.py	Tue Jul 20 19:04:57 2010 -0400
+++ b/review/web.py	Tue Jul 20 19:05:06 2010 -0400
@@ -6,6 +6,7 @@
 from hashlib import md5
 
 from mercurial import cmdutil, commands, error, hg, templatefilters
+from mercurial import patch as _patch
 from mercurial.node import short
 from mercurial.util import email
 
@@ -167,7 +168,7 @@
 
     return redirect("%s/changeset/%s/" % (app.site_root, revhash))
 
-@app.route('/changeset/<revhash>/', methods=['GET', 'POST'])
+@app.route('/changeset/  <revhash>/', methods=['GET', 'POST'])
 def changeset(revhash):
     if request.method == 'POST':
         signoff = request.form.get('signoff', None)
@@ -193,7 +194,8 @@
 def patch(revhash):
     result = StringIO.StringIO()
     try:
-        cmdutil.export(g.datastore.target, [revhash], fp=result)
+        diff_opts = _patch.diffopts(app.ui, {'git': True})
+        cmdutil.export(g.datastore.target, [revhash], fp=result, opts=diff_opts)
     except error.RepoLookupError:
         abort(404)
     except UnicodeEncodeError: