##// END OF EJS Templates
hgweb: kill off #filenode#
Brendan Cully -
r3206:79fd7a92 default
parent child Browse files
Show More
@@ -293,7 +293,7 b' class hgweb(object):'
293 293 parity = 0
294 294 for f in changes[3]:
295 295 files.append(self.t("filenodelink",
296 filenode=hex(mf.get(f, nullid)), file=f,
296 node=hex(n), file=f,
297 297 parity=parity))
298 298 parity = 1 - parity
299 299
@@ -313,10 +313,10 b' class hgweb(object):'
313 313 files=files,
314 314 archives=self.archivelist(nodeid))
315 315
316 def filelog(self, f, filenode):
316 def filelog(self, fctx):
317 f = fctx.path()
317 318 cl = self.repo.changelog
318 fl = self.repo.file(f)
319 filenode = hex(fl.lookup(filenode))
319 fl = fctx.filelog()
320 320 count = fl.count()
321 321
322 322 def entries(**map):
@@ -326,39 +326,32 b' class hgweb(object):'
326 326 for i in range(count):
327 327 n = fl.node(i)
328 328 lr = fl.linkrev(n)
329 cn = cl.node(lr)
330 cs = cl.read(cl.node(lr))
329 ctx = self.repo.changectx(lr)
331 330
332 331 l.insert(0, {"parity": parity,
333 "filenode": hex(n),
334 332 "filerev": i,
335 333 "file": f,
336 "node": hex(cn),
337 "author": cs[1],
338 "date": cs[2],
334 "node": hex(ctx.node()),
335 "author": ctx.user(),
336 "date": ctx.date(),
339 337 "rename": self.renamelink(fl, n),
340 338 "parent": self.siblings(fl.parents(n),
341 339 fl.rev, file=f),
342 340 "child": self.siblings(fl.children(n),
343 341 fl.rev, file=f),
344 "desc": cs[4]})
342 "desc": ctx.description()})
345 343 parity = 1 - parity
346 344
347 345 for e in l:
348 346 yield e
349 347
350 yield self.t("filelog", file=f, filenode=filenode, entries=entries)
348 yield self.t("filelog", file=f, node=hex(fctx.node()), entries=entries)
351 349
352 def filerevision(self, f, node):
353 fl = self.repo.file(f)
354 n = fl.lookup(node)
355 node = hex(n)
356 text = fl.read(n)
357 changerev = fl.linkrev(n)
358 cl = self.repo.changelog
359 cn = cl.node(changerev)
360 cs = cl.read(cn)
361 mfn = cs[0]
350 def filerevision(self, fctx):
351 f = fctx.path()
352 text = fctx.data()
353 fl = fctx.filelog()
354 n = fctx.filenode()
362 355
363 356 mt = mimetypes.guess_type(f)[0]
364 357 rawtext = text
@@ -375,22 +368,21 b' class hgweb(object):'
375 368
376 369 yield self.t("filerevision",
377 370 file=f,
378 filenode=node,
379 371 path=_up(f),
380 372 text=lines(),
381 373 raw=rawtext,
382 374 mimetype=mt,
383 rev=changerev,
384 node=hex(cn),
385 author=cs[1],
386 date=cs[2],
375 rev=fctx.rev(),
376 node=hex(fctx.node()),
377 author=fctx.user(),
378 date=fctx.date(),
387 379 parent=self.siblings(fl.parents(n), fl.rev, file=f),
388 380 child=self.siblings(fl.children(n), fl.rev, file=f),
389 381 rename=self.renamelink(fl, n),
390 permissions=self.repo.manifest.read(mfn).execf(f))
382 permissions=fctx.manifest().execf(f))
391 383
392 def fileannotate(self, f, node):
393 fctx = self.repo.filectx(f, fileid=node)
384 def fileannotate(self, fctx):
385 f = fctx.path()
394 386 n = fctx.filenode()
395 387 fl = fctx.filelog()
396 388
@@ -407,7 +399,6 b' class hgweb(object):'
407 399
408 400 yield {"parity": parity,
409 401 "node": hex(f.node()),
410 "filenode": hex(fnode),
411 402 "rev": f.rev(),
412 403 "author": name,
413 404 "file": f.path(),
@@ -415,7 +406,6 b' class hgweb(object):'
415 406
416 407 yield self.t("fileannotate",
417 408 file=f,
418 filenode=node,
419 409 annotate=annotate,
420 410 path=_up(f),
421 411 rev=fctx.rev(),
@@ -682,6 +672,16 b' class hgweb(object):'
682 672 mn = man.lookup(changeid)
683 673 req.changectx = self.repo.changectx(man.linkrev(mn))
684 674
675 if form.has_key('filenode'):
676 changeid = req.form['filenode'][0]
677 path = self.cleanpath(req.form['file'][0])
678 try:
679 req.changectx = self.repo.changectx(changeid)
680 req.filectx = req.changectx.filectx(path)
681 except hg.RepoError:
682 req.filectx = self.repo.filectx(path, fileid=changeid)
683 req.changectx = req.filectx.changectx()
684
685 685 self.refresh()
686 686
687 687 expand_form(req.form)
@@ -774,16 +774,13 b' class hgweb(object):'
774 774 req.form['node'][0]))
775 775
776 776 def do_file(self, req):
777 req.write(self.filerevision(self.cleanpath(req.form['file'][0]),
778 req.form['filenode'][0]))
777 req.write(self.filerevision(req.filectx))
779 778
780 779 def do_annotate(self, req):
781 req.write(self.fileannotate(self.cleanpath(req.form['file'][0]),
782 req.form['filenode'][0]))
780 req.write(self.fileannotate(req.filectx))
783 781
784 782 def do_filelog(self, req):
785 req.write(self.filelog(self.cleanpath(req.form['file'][0]),
786 req.form['filenode'][0]))
783 req.write(self.filelog(req.filectx))
787 784
788 785 def do_heads(self, req):
789 786 resp = " ".join(map(hex, self.repo.heads())) + "\n"
@@ -10,7 +10,7 b''
10 10 </div>
11 11
12 12 <div class="page_nav">
13 <a href="?cmd=summary;style=gitweb">summary</a> | <a href="?cmd=shortlog;style=gitweb">shortlog</a> | <a href="?cmd=changelog;style=gitweb">changelog</a> | <a href="?cmd=tags;style=gitweb">tags</a> | <a href="?mf=#node|short#;path=#path|urlescape#;style=gitweb">manifest</a> | <a href="?cmd=changeset;node=#node#;style=gitweb">changeset</a> | <a href="?cmd=file;file=#file|urlescape#;filenode=#filenode#;style=gitweb">file</a> | <a href="?cmd=filelog;file=#file|urlescape#;filenode=#filenode#;style=gitweb">revisions</a> | annotate | <a href="?cmd=annotate;file=#file|urlescape#;filenode=#filenode#;style=raw">raw</a><br/>
13 <a href="?cmd=summary;style=gitweb">summary</a> | <a href="?cmd=shortlog;style=gitweb">shortlog</a> | <a href="?cmd=changelog;style=gitweb">changelog</a> | <a href="?cmd=tags;style=gitweb">tags</a> | <a href="?mf=#node|short#;path=#path|urlescape#;style=gitweb">manifest</a> | <a href="?cmd=changeset;node=#node#;style=gitweb">changeset</a> | <a href="?cmd=file;file=#file|urlescape#;filenode=#node|short#;style=gitweb">file</a> | <a href="?cmd=filelog;file=#file|urlescape#;filenode=#node|short#;style=gitweb">revisions</a> | annotate | <a href="?cmd=annotate;file=#file|urlescape#;filenode=#node|short#;style=raw">raw</a><br/>
14 14 </div>
15 15
16 16 <div class="title">#file|escape#</div>
@@ -9,9 +9,9 b''
9 9 <a href="?tags=">tags</a>
10 10 <a href="?cs=#node|short#">changeset</a>
11 11 <a href="?mf=#node|short#;path=#path|urlescape#">manifest</a>
12 <a href="?f=#filenode|short#;file=#file|urlescape#">file</a>
13 <a href="?fl=#filenode|short#;file=#file|urlescape#">revisions</a>
14 <a href="?fa=#filenode|short#;file=#file|urlescape#;style=raw">raw</a>
12 <a href="?f=#node|short#;file=#file|urlescape#">file</a>
13 <a href="?fl=#node|short#;file=#file|urlescape#">revisions</a>
14 <a href="?fa=#node|short#;file=#file|urlescape#;style=raw">raw</a>
15 15 </div>
16 16
17 17 <h2>Annotate #file|escape#</h2>
@@ -8,9 +8,9 b''
8 8 <a href="?sl=#rev#">shortlog</a>
9 9 <a href="?tags=">tags</a>
10 10 <a href="?cs=#node|short#">changeset</a>
11 <a href="?f=#filenode|short#;file=#file|urlescape#">file</a>
12 <a href="?fl=#filenode|short#;file=#file|urlescape#">revisions</a>
13 <a href="?fa=#filenode|short#;file=#file|urlescape#">annotate</a>
11 <a href="?f=#node|short#;file=#file|urlescape#">file</a>
12 <a href="?fl=#node|short#;file=#file|urlescape#">revisions</a>
13 <a href="?fa=#node|short#;file=#file|urlescape#">annotate</a>
14 14 <a href="?fd=#node|short#;file=#file|urlescape#;style=raw">raw</a>
15 15 </div>
16 16
@@ -10,7 +10,7 b''
10 10 </div>
11 11
12 12 <div class="page_nav">
13 <a href="?cmd=summary;style=gitweb">summary</a> | <a href="?cmd=shortlog;style=gitweb">shortlog</a> | <a href="?cmd=changelog;style=gitweb">changelog</a> | <a href="?cmd=tags;style=gitweb">tags</a> | <a href="?cmd=file;file=#file|urlescape#;filenode=#filenode#;style=gitweb">file</a> | revisions | <a href="?cmd=annotate;file=#file|urlescape#;filenode=#filenode#;style=gitweb">annotate</a> | <a href="?fl=#filenode|short#;file=#file|urlescape#;style=rss">rss</a><br/>
13 <a href="?cmd=summary;style=gitweb">summary</a> | <a href="?cmd=shortlog;style=gitweb">shortlog</a> | <a href="?cmd=changelog;style=gitweb">changelog</a> | <a href="?cmd=tags;style=gitweb">tags</a> | <a href="?cmd=file;file=#file|urlescape#;filenode=#node|short#;style=gitweb">file</a> | revisions | <a href="?cmd=annotate;file=#file|urlescape#;filenode=#node|short#;style=gitweb">annotate</a> | <a href="?fl=#node|short#;file=#file|urlescape#;style=rss">rss</a><br/>
14 14 </div>
15 15
16 16 <div class="title" >#file|urlescape#</div>
@@ -10,8 +10,8 b''
10 10 <a href="?cl=tip">changelog</a>
11 11 <a href="?sl=tip">shortlog</a>
12 12 <a href="?tags=">tags</a>
13 <a href="?f=#filenode|short#;file=#file|urlescape#">file</a>
14 <a href="?fa=#filenode|short#;file=#file|urlescape#">annotate</a>
13 <a href="?f=#node|short#;file=#file|urlescape#">file</a>
14 <a href="?fa=#node|short#;file=#file|urlescape#">annotate</a>
15 15 <a type="application/rss+xml" href="?fl=0;file=#file|urlescape#;style=rss">rss</a>
16 16 </div>
17 17
@@ -1,6 +1,6 b''
1 1 <item>
2 2 <title>#desc|strip|firstline|strip|escape#</title>
3 <link>#url#?f=#filenode|short#;file=#file|urlescape#</link>
3 <link>#url#?f=#node|short#;file=#file|urlescape#</link>
4 4 <description><![CDATA[#desc|strip|escape|addbreaks#]]></description>
5 5 <author>#author|obfuscate#</author>
6 6 <pubDate>#date|rfc822date#</pubDate>>
@@ -6,9 +6,9 b''
6 6 <tr>
7 7 <th class="revision">revision #filerev#:</td>
8 8 <td class="node">
9 <a href="?f=#filenode|short#;file=#file|urlescape#">#filenode|short#</a>
9 <a href="?f=#node|short#;file=#file|urlescape#">#node|short#</a>
10 10 <a href="?fd=#node|short#;file=#file|urlescape#">(diff)</a>
11 <a href="?fa=#filenode|short#;file=#file|urlescape#">(annotate)</a>
11 <a href="?fa=#node|short#;file=#file|urlescape#">(annotate)</a>
12 12 </td>
13 13 </tr>
14 14 #rename%filelogrename#
@@ -10,7 +10,7 b''
10 10 </div>
11 11
12 12 <div class="page_nav">
13 <a href="?cmd=summary;style=gitweb">summary</a> | <a href="?cmd=shortlog;style=gitweb">shortlog</a> | <a href="?cmd=changelog;style=gitweb">changelog</a> | <a href="?cmd=tags;style=gitweb">tags</a> | <a href="?mf=#node|short#;path=#path|urlescape#;style=gitweb">manifest</a> | <a href="?cmd=changeset;node=#node#;style=gitweb">changeset</a> | file | <a href="?cmd=filelog;file=#file|urlescape#;filenode=#filenode#;style=gitweb">revisions</a> | <a href="?cmd=annotate;file=#file|urlescape#;filenode=#filenode#;style=gitweb">annotate</a> | <a href="?cmd=file;file=#file|urlescape#;filenode=#filenode#;style=raw">raw</a><br/>
13 <a href="?cmd=summary;style=gitweb">summary</a> | <a href="?cmd=shortlog;style=gitweb">shortlog</a> | <a href="?cmd=changelog;style=gitweb">changelog</a> | <a href="?cmd=tags;style=gitweb">tags</a> | <a href="?mf=#node|short#;path=#path|urlescape#;style=gitweb">manifest</a> | <a href="?cmd=changeset;node=#node#;style=gitweb">changeset</a> | file | <a href="?cmd=filelog;file=#file|urlescape#;filenode=#node|short#;style=gitweb">revisions</a> | <a href="?cmd=annotate;file=#file|urlescape#;filenode=#node|short#;style=gitweb">annotate</a> | <a href="?cmd=file;file=#file|urlescape#;filenode=#node#;style=raw">raw</a><br/>
14 14 </div>
15 15
16 16 <div class="title">#file|escape#</div>
@@ -9,9 +9,9 b''
9 9 <a href="?tags=">tags</a>
10 10 <a href="?cs=#node|short#">changeset</a>
11 11 <a href="?mf=#node|short#;path=#path|urlescape#">manifest</a>
12 <a href="?fl=#filenode|short#;file=#file|urlescape#">revisions</a>
13 <a href="?fa=#filenode|short#;file=#file|urlescape#">annotate</a>
14 <a href="?f=#filenode|short#;file=#file|urlescape#;style=raw">raw</a>
12 <a href="?fl=#node|short#;file=#file|urlescape#">revisions</a>
13 <a href="?fa=#node|short#;file=#file|urlescape#">annotate</a>
14 <a href="?f=#node|short#;file=#file|urlescape#;style=raw">raw</a>
15 15 </div>
16 16
17 17 <h2>#file|escape#</h2>
@@ -8,21 +8,21 b' shortlogentry = shortlogentry.tmpl'
8 8 naventry = '<a href="?cl=#rev#">#label|escape#</a> '
9 9 navshortentry = '<a href="?sl=#rev#">#label|escape#</a> '
10 10 filedifflink = '<a href="?fd=#node|short#;file=#file|urlescape#">#file|escape#</a> '
11 filenodelink = '<a href="?f=#filenode|short#;file=#file|urlescape#">#file|escape#</a> '
11 filenodelink = '<a href="?f=#node|short#;file=#file|urlescape#">#file|escape#</a> '
12 12 fileellipses = '...'
13 13 changelogentry = changelogentry.tmpl
14 14 searchentry = changelogentry.tmpl
15 15 changeset = changeset.tmpl
16 16 manifest = manifest.tmpl
17 17 manifestdirentry = '<tr class="parity#parity#"><td><tt>drwxr-xr-x</tt>&nbsp;<td><a href="?mf=#node|short#;path=#path|urlescape#">#basename|escape#/</a>'
18 manifestfileentry = '<tr class="parity#parity#"><td><tt>#permissions|permissions#</tt>&nbsp;<td><a href="?f=#filenode|short#;file=#file|urlescape#">#basename|escape#</a>'
18 manifestfileentry = '<tr class="parity#parity#"><td><tt>#permissions|permissions#</tt>&nbsp;<td><a href="?f=#node|short#;file=#file|urlescape#">#basename|escape#</a>'
19 19 filerevision = filerevision.tmpl
20 20 fileannotate = fileannotate.tmpl
21 21 filediff = filediff.tmpl
22 22 filelog = filelog.tmpl
23 23 fileline = '<div class="parity#parity#"><span class="lineno">#linenumber#</span>#line|escape#</div>'
24 24 filelogentry = filelogentry.tmpl
25 annotateline = '<tr class="parity#parity#"><td class="annotate"><a href="?fa=#filenode|short#;file=#file|urlescape#">#author|obfuscate#@#rev#</a></td><td><pre>#line|escape#</pre></td></tr>'
25 annotateline = '<tr class="parity#parity#"><td class="annotate"><a href="?fa=#node|short#;file=#file|urlescape#">#author|obfuscate#@#rev#</a></td><td><pre>#line|escape#</pre></td></tr>'
26 26 difflineplus = '<span class="plusline">#line|escape#</span>'
27 27 difflineminus = '<span class="minusline">#line|escape#</span>'
28 28 difflineat = '<span class="atline">#line|escape#</span>'
@@ -8,19 +8,19 b' error = error-gitweb.tmpl'
8 8 naventry = '<a href="?cmd=changelog;rev=#rev#;style=gitweb">#label|escape#</a> '
9 9 navshortentry = '<a href="?cmd=shortlog;rev=#rev#;style=gitweb">#label|escape#</a> '
10 10 filedifflink = '<a href="?cmd=filediff;node=#node#;file=#file|urlescape#;style=gitweb">#file|escape#</a> '
11 filenodelink = '<tr class="parity#parity#"><td><a class="list" href="">#file|escape#</a></td><td></td><td class="link"><a href="?cmd=file;filenode=#filenode#;file=#file|urlescape#;style=gitweb">file</a> | <a href="?fa=#filenode|short#;file=#file|urlescape#;style=gitweb">annotate</a> | <!-- FIXME: <a href="?fd=#filenode|short#;file=#file|urlescape#;style=gitweb">diff</a> | --> <a href="?cmd=filelog;filenode=#filenode|short#;file=#file|urlescape#;style=gitweb">revisions</a></td></tr>'
11 filenodelink = '<tr class="parity#parity#"><td><a class="list" href="">#file|escape#</a></td><td></td><td class="link"><a href="?f=#node|short#;file=#file|urlescape#;style=gitweb">file</a> | <a href="?fa=#node|short#;file=#file|urlescape#;style=gitweb">annotate</a> | <!-- FIXME: <a href="?fd=#node|short#;file=#file|urlescape#;style=gitweb">diff</a> | --> <a href="?cmd=filelog;filenode=#node|short#;file=#file|urlescape#;style=gitweb">revisions</a></td></tr>'
12 12 fileellipses = '...'
13 13 changelogentry = changelogentry-gitweb.tmpl
14 14 searchentry = changelogentry-gitweb.tmpl
15 15 changeset = changeset-gitweb.tmpl
16 16 manifest = manifest-gitweb.tmpl
17 17 manifestdirentry = '<tr class="parity#parity#"><td style="font-family:monospace">drwxr-xr-x</td><td><a href="?mf=#node|short#;path=#path|urlescape#;style=gitweb">#basename|escape#/</a></td><td class="link"><a href="?mf=#node|short#;path=#path|urlescape#;style=gitweb">manifest</a></td></tr>'
18 manifestfileentry = '<tr class="parity#parity#"><td style="font-family:monospace">#permissions|permissions#</td><td class="list"><a class="list" href="?f=#filenode|short#;file=#file|urlescape#;style=gitweb">#basename|escape#</a></td><td class="link"><a href="?f=#filenode|short#;file=#file|urlescape#;style=gitweb">file</a> | <a href="?fl=#filenode|short#;file=#file|urlescape#;style=gitweb">revisions</a> | <a href="?fa=#filenode|short#;file=#file|urlescape#;style=gitweb">annotate</a></td></tr>'
18 manifestfileentry = '<tr class="parity#parity#"><td style="font-family:monospace">#permissions|permissions#</td><td class="list"><a class="list" href="?f=#node|short#;file=#file|urlescape#;style=gitweb">#basename|escape#</a></td><td class="link"><a href="?f=#node|short#;file=#file|urlescape#;style=gitweb">file</a> | <a href="?fl=#node|short#;file=#file|urlescape#;style=gitweb">revisions</a> | <a href="?fa=#node|short#;file=#file|urlescape#;style=gitweb">annotate</a></td></tr>'
19 19 filerevision = filerevision-gitweb.tmpl
20 20 fileannotate = fileannotate-gitweb.tmpl
21 21 filelog = filelog-gitweb.tmpl
22 22 fileline = '<div style="font-family:monospace" class="parity#parity#"><pre><span class="linenr"> #linenumber#</span> #line|escape#</pre></div>'
23 annotateline = '<tr style="font-family:monospace" class="parity#parity#"><td class="linenr" style="text-align: right;"><a href="?fa=#filenode|short#;file=#file|urlescape#;style=gitweb">#author|obfuscate#@#rev#</a></td><td><pre>#line|escape#</pre></td></tr>'
23 annotateline = '<tr style="font-family:monospace" class="parity#parity#"><td class="linenr" style="text-align: right;"><a href="?fa=#node|short#;file=#file|urlescape#;style=gitweb">#author|obfuscate#@#rev#</a></td><td><pre>#line|escape#</pre></td></tr>'
24 24 difflineplus = '<div style="color:#008800;">#line|escape#</div>'
25 25 difflineminus = '<div style="color:#cc0000;">#line|escape#</div>'
26 26 difflineat = '<div style="color:#990099;">#line|escape#</div>'
@@ -46,5 +46,5 b' filediffchild = \'<tr><th class="child">c'
46 46 filelogchild = '<tr><td align="right">child #rev#:&nbsp;</td><td><a href="?cmd=file;file=#file|urlescape#;filenode=#node#;style=gitweb">#node|short#</a></td></tr>'
47 47 shortlog = shortlog-gitweb.tmpl
48 48 shortlogentry = '<tr class="parity#parity#"><td class="age"><i>#date|age# ago</i></td><td><i>#author#</i></td><td><a class="list" href="?cmd=changeset;node=#node|short#;style=gitweb"><b>#desc|strip|firstline|escape#</b></a></td><td class="link"><a href="?cmd=changeset;node=#node|short#;style=gitweb">changeset</a> | <a href="?cmd=manifest;manifest=#node|short#;path=/;style=gitweb">manifest</a></td></tr>'
49 filelogentry = '<tr class="parity#parity#"><td class="age"><i>#date|age# ago</i></td><td><a class="list" href="?cmd=changeset;node=#node|short#;style=gitweb"><b>#desc|strip|firstline|escape#</b></a></td><td class="link"><a href="?f=#node|short#;file=#file|urlescape#;style=gitweb">file</a> | <!-- FIXME: <a href="?fd=#node|short#;file=#file|urlescape#;style=gitweb">diff</a> | --> <a href="?fa=#filenode|short#;file=#file|urlescape#;style=gitweb">annotate</a> #rename%filelogrename#</td></tr>'
49 filelogentry = '<tr class="parity#parity#"><td class="age"><i>#date|age# ago</i></td><td><a class="list" href="?cmd=changeset;node=#node|short#;style=gitweb"><b>#desc|strip|firstline|escape#</b></a></td><td class="link"><a href="?f=#node|short#;file=#file|urlescape#;style=gitweb">file</a> | <!-- FIXME: <a href="?fd=#node|short#;file=#file|urlescape#;style=gitweb">diff</a> | --> <a href="?fa=#node|short#;file=#file|urlescape#;style=gitweb">annotate</a> #rename%filelogrename#</td></tr>'
50 50 archiveentry = ' | <a href="?ca=#node|short#;type=#type|urlescape#">#type|escape#</a> '
General Comments 0
You need to be logged in to leave comments. Login now