Use the real file if there's no pristine directory available.
Mon Oct 3 04:47:34 UTC 2005 Alberto Bertogli <albertogli@telpin.com.ar>
* Use the real file if there's no pristine directory available.
diff -rN -u old-darcsweb/darcsweb.cgi new-darcsweb/darcsweb.cgi
--- old-darcsweb/darcsweb.cgi 2014-05-04 00:56:12.000000000 +0000
+++ new-darcsweb/darcsweb.cgi 2014-05-04 00:56:12.000000000 +0000
@@ -189,6 +189,12 @@
return 1
return 0
+def realpath(fname):
+ realf = filter_file(config.repodir + '/_darcs/current/' + fname)
+ if not os.path.exists(realf):
+ realf = filter_file(config.repodir + '/' + fname)
+ return realf
+
#
# generic html functions
@@ -254,14 +260,9 @@
<a href="%(myreponame)s;a=summary">summary</a>
| <a href="%(myreponame)s;a=shortlog">shortlog</a>
| <a href="%(myreponame)s;a=log">log</a>
+| <a href="%(myreponame)s;a=tree">tree</a>
""" % { "myreponame": config.myreponame }
- if os.path.isdir(config.repodir + '/_darcs/current/'):
- # the current directory is missing if the --no-pristine-tree
- # option was used in darcs get, so we only show the link if
- # the directory exists
- print '| <a href="%s;a=tree">tree</a>' % config.myreponame
-
if h:
print """
| <a href="%(myreponame)s;a=commit;h=%(hash)s">commit</a>
@@ -269,7 +270,7 @@
| <a href="%(myreponame)s;a=headdiff;h=%(hash)s">headdiff</a>
""" % { "myreponame": config.myreponame, 'hash': h }
- realf = filter_file(config.repodir + '/_darcs/current/' + f)
+ realf = realpath(f)
if f and h:
print """
@@ -964,7 +965,7 @@
"""
return
- f = open(config.repodir + '/_darcs/current/' + fname, 'r')
+ f = open(realpath(fname), 'r')
count = 1
for l in f:
l = fixu8(escape(l))
@@ -1463,16 +1464,19 @@
<table cellspacing="0">
"""
- realpath = config.repodir + '/_darcs/current/' + dname + '/'
+ path = realpath(dname)
+
alt = False
- files = os.listdir(realpath)
+ files = os.listdir(path)
files.sort()
# list directories first
dlist = []
flist = []
for f in files:
- realfile = realpath + f
+ if f == "_darcs":
+ continue
+ realfile = path + f
if os.path.isdir(realfile):
dlist.append(f)
else:
@@ -1485,7 +1489,7 @@
else:
print '<tr class="light">'
alt = not alt
- realfile = realpath + f
+ realfile = path + f
print '<td style="font-family:monospace">', fperms(realfile),
print '</td>'
@@ -1545,7 +1549,7 @@
def do_plainblob(fname):
print_plain_header()
- f = open(config.repodir + '/_darcs/current/' + fname, 'r')
+ f = open(realpath(fname), 'r')
for l in f:
sys.stdout.write(fixu8(l))