Show More
@@ -30,7 +30,7 b' from mercurial import extensions, encodi' | |||
|
30 | 30 | # leave the attribute unspecified. |
|
31 | 31 | testedwith = 'internal' |
|
32 | 32 | |
|
33 | def filerevision_highlight(orig, web, tmpl, fctx): | |
|
33 | def filerevision_highlight(orig, web, req, tmpl, fctx): | |
|
34 | 34 | mt = ''.join(tmpl('mimetype', encoding=encoding.encoding)) |
|
35 | 35 | # only pygmentize for mimetype containing 'html' so we both match |
|
36 | 36 | # 'text/html' and possibly 'application/xhtml+xml' in the future |
@@ -42,7 +42,7 b' def filerevision_highlight(orig, web, tm' | |||
|
42 | 42 | if 'html' in mt: |
|
43 | 43 | style = web.config('web', 'pygments_style', 'colorful') |
|
44 | 44 | highlight.pygmentize('fileline', fctx, style, tmpl) |
|
45 | return orig(web, tmpl, fctx) | |
|
45 | return orig(web, req, tmpl, fctx) | |
|
46 | 46 | |
|
47 | 47 | def annotate_highlight(orig, web, req, tmpl): |
|
48 | 48 | mt = ''.join(tmpl('mimetype', encoding=encoding.encoding)) |
@@ -100,7 +100,7 b' def rawfile(web, req, tmpl):' | |||
|
100 | 100 | req.respond(HTTP_OK, mt, path, body=text) |
|
101 | 101 | return [] |
|
102 | 102 | |
|
103 | def _filerevision(web, tmpl, fctx): | |
|
103 | def _filerevision(web, req, tmpl, fctx): | |
|
104 | 104 | f = fctx.path() |
|
105 | 105 | text = fctx.data() |
|
106 | 106 | parity = paritygen(web.stripecount) |
@@ -121,6 +121,7 b' def _filerevision(web, tmpl, fctx):' | |||
|
121 | 121 | path=webutil.up(f), |
|
122 | 122 | text=lines(), |
|
123 | 123 | rev=fctx.rev(), |
|
124 | symrev=webutil.symrevorshortnode(req, fctx), | |
|
124 | 125 | node=fctx.hex(), |
|
125 | 126 | author=fctx.user(), |
|
126 | 127 | date=fctx.date(), |
@@ -158,7 +159,7 b' def file(web, req, tmpl):' | |||
|
158 | 159 | if not path: |
|
159 | 160 | return manifest(web, req, tmpl) |
|
160 | 161 | try: |
|
161 | return _filerevision(web, tmpl, webutil.filectx(web.repo, req)) | |
|
162 | return _filerevision(web, req, tmpl, webutil.filectx(web.repo, req)) | |
|
162 | 163 | except error.LookupError, inst: |
|
163 | 164 | try: |
|
164 | 165 | return manifest(web, req, tmpl) |
@@ -316,7 +317,7 b' def _search(web, req, tmpl):' | |||
|
316 | 317 | tip = web.repo['tip'] |
|
317 | 318 | parity = paritygen(web.stripecount) |
|
318 | 319 | |
|
319 | return tmpl('search', query=query, node=tip.hex(), | |
|
320 | return tmpl('search', query=query, node=tip.hex(), symrev='tip', | |
|
320 | 321 | entries=changelist, archives=web.archivelist("tip"), |
|
321 | 322 | morevars=morevars, lessvars=lessvars, |
|
322 | 323 | modedesc=searchfunc[1], |
@@ -351,10 +352,12 b' def changelog(web, req, tmpl, shortlog=F' | |||
|
351 | 352 | query = '' |
|
352 | 353 | if 'node' in req.form: |
|
353 | 354 | ctx = webutil.changectx(web.repo, req) |
|
355 | symrev = webutil.symrevorshortnode(req, ctx) | |
|
354 | 356 | elif 'rev' in req.form: |
|
355 | 357 | return _search(web, req, tmpl) |
|
356 | 358 | else: |
|
357 | 359 | ctx = web.repo['tip'] |
|
360 | symrev = 'tip' | |
|
358 | 361 | |
|
359 | 362 | def changelist(): |
|
360 | 363 | revs = [] |
@@ -403,7 +406,7 b' def changelog(web, req, tmpl, shortlog=F' | |||
|
403 | 406 | nextentry = [] |
|
404 | 407 | |
|
405 | 408 | return tmpl(shortlog and 'shortlog' or 'changelog', changenav=changenav, |
|
406 | node=ctx.hex(), rev=pos, changesets=count, | |
|
409 | node=ctx.hex(), rev=pos, symrev=symrev, changesets=count, | |
|
407 | 410 | entries=entries, |
|
408 | 411 | latestentry=latestentry, nextentry=nextentry, |
|
409 | 412 | archives=web.archivelist("tip"), revcount=revcount, |
@@ -470,7 +473,12 b' def manifest(web, req, tmpl):' | |||
|
470 | 473 | |
|
471 | 474 | The ``manifest`` template will be rendered for this handler. |
|
472 | 475 | """ |
|
473 | ctx = webutil.changectx(web.repo, req) | |
|
476 | if 'node' in req.form: | |
|
477 | ctx = webutil.changectx(web.repo, req) | |
|
478 | symrev = webutil.symrevorshortnode(req, ctx) | |
|
479 | else: | |
|
480 | ctx = web.repo['tip'] | |
|
481 | symrev = 'tip' | |
|
474 | 482 | path = webutil.cleanpath(web.repo, req.form.get('file', [''])[0]) |
|
475 | 483 | mf = ctx.manifest() |
|
476 | 484 | node = ctx.node() |
@@ -539,6 +547,7 b' def manifest(web, req, tmpl):' | |||
|
539 | 547 | |
|
540 | 548 | return tmpl("manifest", |
|
541 | 549 | rev=ctx.rev(), |
|
550 | symrev=symrev, | |
|
542 | 551 | node=hex(node), |
|
543 | 552 | path=abspath, |
|
544 | 553 | up=webutil.up(abspath), |
@@ -755,6 +764,7 b' def summary(web, req, tmpl):' | |||
|
755 | 764 | branches=branches, |
|
756 | 765 | shortlog=changelist, |
|
757 | 766 | node=tip.hex(), |
|
767 | symrev='tip', | |
|
758 | 768 | archives=web.archivelist("tip")) |
|
759 | 769 | |
|
760 | 770 | @webcommand('filediff') |
@@ -803,6 +813,7 b' def filediff(web, req, tmpl):' | |||
|
803 | 813 | file=path, |
|
804 | 814 | node=hex(n), |
|
805 | 815 | rev=ctx.rev(), |
|
816 | symrev=webutil.symrevorshortnode(req, ctx), | |
|
806 | 817 | date=ctx.date(), |
|
807 | 818 | desc=ctx.description(), |
|
808 | 819 | extra=ctx.extra(), |
@@ -877,6 +888,7 b' def comparison(web, req, tmpl):' | |||
|
877 | 888 | file=path, |
|
878 | 889 | node=hex(ctx.node()), |
|
879 | 890 | rev=ctx.rev(), |
|
891 | symrev=webutil.symrevorshortnode(req, ctx), | |
|
880 | 892 | date=ctx.date(), |
|
881 | 893 | desc=ctx.description(), |
|
882 | 894 | extra=ctx.extra(), |
@@ -944,6 +956,7 b' def annotate(web, req, tmpl):' | |||
|
944 | 956 | annotate=annotate, |
|
945 | 957 | path=webutil.up(f), |
|
946 | 958 | rev=fctx.rev(), |
|
959 | symrev=webutil.symrevorshortnode(req, fctx), | |
|
947 | 960 | node=fctx.hex(), |
|
948 | 961 | author=fctx.user(), |
|
949 | 962 | date=fctx.date(), |
@@ -1043,6 +1056,7 b' def filelog(web, req, tmpl):' | |||
|
1043 | 1056 | revnav = webutil.filerevnav(web.repo, fctx.path()) |
|
1044 | 1057 | nav = revnav.gen(end - 1, revcount, count) |
|
1045 | 1058 | return tmpl("filelog", file=f, node=fctx.hex(), nav=nav, |
|
1059 | symrev=webutil.symrevorshortnode(req, fctx), | |
|
1046 | 1060 | entries=entries, |
|
1047 | 1061 | latestentry=latestentry, |
|
1048 | 1062 | revcount=revcount, morevars=morevars, lessvars=lessvars) |
@@ -1149,7 +1163,12 b' def graph(web, req, tmpl):' | |||
|
1149 | 1163 | This handler will render the ``graph`` template. |
|
1150 | 1164 | """ |
|
1151 | 1165 | |
|
1152 | ctx = webutil.changectx(web.repo, req) | |
|
1166 | if 'node' in req.form: | |
|
1167 | ctx = webutil.changectx(web.repo, req) | |
|
1168 | symrev = webutil.symrevorshortnode(req, ctx) | |
|
1169 | else: | |
|
1170 | ctx = web.repo['tip'] | |
|
1171 | symrev = 'tip' | |
|
1153 | 1172 | rev = ctx.rev() |
|
1154 | 1173 | |
|
1155 | 1174 | bg_height = 39 |
@@ -1252,7 +1271,8 b' def graph(web, req, tmpl):' | |||
|
1252 | 1271 | rows = len(tree) |
|
1253 | 1272 | canvasheight = (rows + 1) * bg_height - 27 |
|
1254 | 1273 | |
|
1255 |
return tmpl('graph', rev=rev, revcount=revcount, |
|
|
1274 | return tmpl('graph', rev=rev, symrev=symrev, revcount=revcount, | |
|
1275 | uprev=uprev, | |
|
1256 | 1276 | lessvars=lessvars, morevars=morevars, downrev=downrev, |
|
1257 | 1277 | cols=cols, rows=rows, |
|
1258 | 1278 | canvaswidth=(cols + 1) * bg_height, |
@@ -6,10 +6,10 b'' | |||
|
6 | 6 | # This software may be used and distributed according to the terms of the |
|
7 | 7 | # GNU General Public License version 2 or any later version. |
|
8 | 8 | |
|
9 | import os, copy | |
|
9 | import os, copy, urllib | |
|
10 | 10 | from mercurial import match, patch, error, ui, util, pathutil, context |
|
11 | 11 | from mercurial.i18n import _ |
|
12 | from mercurial.node import hex, nullid | |
|
12 | from mercurial.node import hex, nullid, short | |
|
13 | 13 | from common import ErrorResponse, paritygen |
|
14 | 14 | from common import HTTP_NOT_FOUND |
|
15 | 15 | import difflib |
@@ -279,6 +279,12 b' def changelistentry(web, ctx, tmpl):' | |||
|
279 | 279 | "branches": nodebranchdict(repo, ctx) |
|
280 | 280 | } |
|
281 | 281 | |
|
282 | def symrevorshortnode(req, ctx): | |
|
283 | if 'node' in req.form: | |
|
284 | return urllib.quote(req.form['node'][0]) | |
|
285 | else: | |
|
286 | return short(ctx.node()) | |
|
287 | ||
|
282 | 288 | def changesetentry(web, req, tmpl, ctx): |
|
283 | 289 | '''Obtain a dictionary to be used to render the "changeset" template.''' |
|
284 | 290 | |
@@ -314,6 +320,7 b' def changesetentry(web, req, tmpl, ctx):' | |||
|
314 | 320 | diff=diff, |
|
315 | 321 | rev=ctx.rev(), |
|
316 | 322 | node=ctx.hex(), |
|
323 | symrev=symrevorshortnode(req, ctx), | |
|
317 | 324 | parent=tuple(parents(ctx)), |
|
318 | 325 | child=children(ctx), |
|
319 | 326 | basenode=basectx.hex(), |
General Comments 0
You need to be logged in to leave comments.
Login now