Sat Jul 23 22:54:35 UTC 2005 Alberto Bertogli <albertogli@telpin.com.ar>
* Implement file history (a "focused" version of shortlog).
{
hunk ./darcsweb.cgi 276
+ if f:
+ print """
+| <a class="link" href="%(myreponame)s;a=filehistory;f=%(fname)s">filehistory</a>
+ """ % { "myreponame": config.myreponame, 'fname': f }
+
hunk ./darcsweb.cgi 283
-
hunk ./darcsweb.cgi 482
-def get_last_patches(last = 15, topi = 0):
+def get_last_patches(last = 15, topi = 0, fname = None):
hunk ./darcsweb.cgi 486
- simple. FIXME: there's probably a more efficient way of doing this."""
+ simple. You can optionally pass a filename and only changes that
+ affect it will be returned. FIXME: there's probably a more efficient
+ way of doing this."""
+
+ # darcs calculate last first, and then filters the filename,
+ # so it's not so simple to combine them; that's why we do so much
+ # special casing here
hunk ./darcsweb.cgi 494
- handler = get_changes_handler("-s --last=%d" % toget)
hunk ./darcsweb.cgi 495
+ if fname:
+ if fname[0] == '/': fname = fname[1:]
+ s = "-s " + fname
+ else:
+ s = "-s --last=%d" % toget
+
+ handler = get_changes_handler(s)
+
hunk ./darcsweb.cgi 551
-def print_shortlog(last = 50, topi = 0):
- ps = get_last_patches(last, topi)
- print '<div><a class="title" href="%s;a=shortlog">shortlog</a></div>' \
- % config.myreponame
+def print_shortlog(last = 50, topi = 0, fname = None):
+ ps = get_last_patches(last, topi, fname)
+
+ if fname:
+ title = '<a class="title" href="%s;a=filehistory;f=%s">' % \
+ (config.myreponame, fname)
+ title += 'history for file %s' % fname
+ title += '</a>'
+ else:
+ title = '<a class="title" href="%s;a=shortlog">shortlog</a>' \
+ % config.myreponame
+
+ print '<div>%s</div>' % title
hunk ./darcsweb.cgi 571
- print '<td><a href="%s;a=shortlog;topi=%d">...</a></td>' % \
- (config.myreponame, ntopi)
+ print '<tr><td>'
+ if fname:
+ print '<a href="%s;a=filehistory;topi=%d;f=%s">...</a>' \
+ % (config.myreponame, ntopi, fname)
+ else:
+ print '<a href="%s;a=shortlog;topi=%d">...</a>' \
+ % (config.myreponame, ntopi)
+ print '</td></tr>'
hunk ./darcsweb.cgi 609
- print """
-<tr><td>
- <a href="%s;a=shortlog;topi=%d">...</a>
-</td></tr>
- """ % (config.myreponame, topi + last)
+ print '<tr><td>'
+ if fname:
+ print '<a href="%s;a=filehistory;topi=%d;f=%s">...</a>' \
+ % (config.myreponame, topi + last, fname)
+ else:
+ print '<a href="%s;a=shortlog;topi=%d">...</a>' \
+ % (config.myreponame, topi + last)
+ print '</td></tr>'
hunk ./darcsweb.cgi 916
-<td><a class="link" href="%(myreponame)s;a=filediff;h=%(hash)s;f=%(file)s">
- diff
-</a></td>
+<td>
+ <a class="link" href="%(myreponame)s;a=filediff;h=%(hash)s;f=%(file)s">
+ diff</a> |
+ <a class="link" href="%(myreponame)s;a=filehistory;f=%(file)s">history</a>
+</td>
hunk ./darcsweb.cgi 986
- <td><a class="link" href="%(myrname)s;a=tree;f=%(newf)s">tree</a></td>
+ <td>
+ <a class="link" href="%(myrname)s;a=filehistory;f=%(newf)s">history</a> |
+ <a class="link" href="%(myrname)s;a=tree;f=%(newf)s">tree</a>
+ </td>
hunk ./darcsweb.cgi 998
- <td><a class="link" href="%(myrname)s;a=headblob;f=%(fullf)s">headblob</a></td>
+ <td>
+ <a class="link" href="%(myrname)s;a=filehistory;f=%(fullf)s">history</a> |
+ <a class="link" href="%(myrname)s;a=headblob;f=%(fullf)s">headblob</a>
+ </td>
hunk ./darcsweb.cgi 1050
+def do_filehistory(topi, f):
+ print_header()
+ print_navbar(f = fname)
+ print_shortlog(topi = topi, fname = fname)
+ print_footer()
hunk ./darcsweb.cgi 1274
+elif action == "filehistory":
+ if form.has_key("topi"):
+ topi = int(filter_num(form["topi"].value))
+ else:
+ topi = 0
+ fname = filter_file(form["f"].value)
+ do_filehistory(topi, fname)
}