# HG changeset patch # User Steve Losh # Date 1279667106 14400 # Node ID de7319315abe095e99520bc6efbecc99fad12bb4 # Parent a572f44059099d3b2fdd2914a241a1716f365d50 web: it's 2010 -- time to use git diffs diff -r a572f4405909 -r de7319315abe review/web.py --- 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//', methods=['GET', 'POST']) +@app.route('/changeset/ /', 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: