display the size of the files in tree view
Thu May 3 16:18:30 UTC 2007 VMiklos <vmiklos@frugalware.org>
* display the size of the files in tree view
diff -rN -u old-darcsweb/darcsweb.cgi new-darcsweb/darcsweb.cgi
--- old-darcsweb/darcsweb.cgi 2013-07-22 16:04:39.000000000 +0000
+++ new-darcsweb/darcsweb.cgi 2013-07-22 16:04:39.000000000 +0000
@@ -223,6 +223,14 @@
return ''.join(s)
+def fsize(fname):
+ s = os.stat(fname)[stat.ST_SIZE]
+ if s < 1024:
+ return "%s" % s
+ elif s < 1048576:
+ return "%sK" % (s / 1024)
+ elif s < 1073741824:
+ return "%sM" % (s / 1048576)
def isbinary(fname):
import re
@@ -1781,6 +1789,8 @@
fullf = filter_file(dname + '/' + f)
print '<td style="font-family:monospace">', fperms(realfile),
print '</td>'
+ print '<td style="font-family:monospace">', fsize(realfile),
+ print '</td>'
if f in dlist:
print """