Do not use string exceptions --> to head
Sun Nov 13 11:23:24 UTC 2011 pinterface <pix@kepibu.org>
* Add support for calling an external program to generate README markup
{
hunk ./config.py.sample 87
+ # If you'd like a wider range of README file types than darcsweb
+ # provides, set readme_converter to a program which takes a single
+ # argument--the name of the readme file--and outputs HTML.
+ #readme_converter = 'ruby -rubygems /var/lib/gems/1.8/gems/github-markup-0.5.3/bin/github-markup'
hunk ./darcsweb.cgi 1094
+def get_readme():
+ import glob
+ readmes = glob.glob("README*")
+ if len(readmes) == 0: return False, False
+ import re
+ for p in readmes:
+ file = os.path.basename(p)
+ if re.search('\.(md|markdown)$', p):
+ import codecs
+ import markdown
+ f = codecs.open(p, encoding=config.repoencoding[0])
+ str = f.read()
+ html = markdown.markdown(str, ['extra', 'codehilite(css_class=page_body)'])
+ return file, fixu8(html)
+ elif re.search('README$', p):
+ f = open(p)
+ str = f.read()
+ return file, '<pre>%s</pre>' % fixu8(escape(str))
+ # We can't handle this ourselves, try shelling out
+ if not config.readme_converter: return False, False
+ cmd = '%s "%s"' % (config.readme_converter, readmes[0])
+ inf, outf = os.popen2(cmd, 't')
+ return os.path.basename(readmes[0]), fixu8(outf.read())
hunk ./darcsweb.cgi 1248
-# FIXME: shell out to github-markup to avoid duplicating that effort here?
hunk ./darcsweb.cgi 1249
- real = False
- for p in ["README", "README.md", "README.markdown"]:
- p = realpath(p)
- if p and os.path.isfile(p):
- real = p
- break
- if not real: return
-
- print '<div class="title">%s</div>' % os.path.basename(real)
-
- import re
- if re.search('\.(md|markdown)$', real):
- import codecs
- import markdown
- f = codecs.open(real, encoding=config.repoencoding[0])
- str = f.read()
- html = markdown.markdown(str, ['extra', 'codehilite(css_class=page_body)'])
- print '<section>%s</section>' % fixu8(html)
- else:
- f = open(real)
- str = f.read()
- print '<section><pre>%s</pre></section>' % fixu8(escape(str))
+ head, body = get_readme()
+ if not head: return False
+ print '<div class="title">%s</div>' % head
+ print '<section>%s</section' % body
hunk ./darcsweb.cgi 2566
+ if "readme_converter" in dir(base):
+ config.readme_converter = base.readme_converter
+ else:
+ config.readme_converter = False
+
}
Sun Nov 13 11:07:41 UTC 2011 pinterface <pix@kepibu.org>
* minidom chokes on form feed character
hunk ./darcsweb.cgi 1002
- s += fixu8(i)
+ s += fixu8(i).replace('[_^L_]', '^L')
Sat Nov 5 10:18:50 UTC 2011 pinterface <pix@kepibu.org>
* Show README in summary view, if it exists
Blatantly stealing the idea from Github, but not as fully implemented.
{
hunk ./darcsweb.cgi 1225
+# FIXME: shell out to github-markup to avoid duplicating that effort here?
+def print_readme():
+ real = False
+ for p in ["README", "README.md", "README.markdown"]:
+ p = realpath(p)
+ if p and os.path.isfile(p):
+ real = p
+ break
+ if not real: return
+
+ print '<div class="title">%s</div>' % os.path.basename(real)
+
+ import re
+ if re.search('\.(md|markdown)$', real):
+ import codecs
+ import markdown
+ f = codecs.open(real, encoding=config.repoencoding[0])
+ str = f.read()
+ html = markdown.markdown(str, ['extra', 'codehilite(css_class=page_body)'])
+ print '<section>%s</section>' % fixu8(html)
+ else:
+ f = open(real)
+ str = f.read()
+ print '<section><pre>%s</pre></section>' % fixu8(escape(str))
+
+
hunk ./darcsweb.cgi 1523
+ print_readme()
}
Tue Nov 1 10:19:57 UTC 2011 pinterface <pix@kepibu.org>
* Add Owner and Last Change columns to repo listing
This is a little ugly due to the global config object. Boo.
{
hunk ./darcsweb.cgi 2247
+<th>Owner</th>
+<th>Last Change</th>
hunk ./darcsweb.cgi 2273
+ try: orig_repodir = config.repodir
+ except: orig_repodir = None
+ config.repodir = c.repodir
hunk ./darcsweb.cgi 2279
+<td>%(owner)s</td>
+<td>%(lastchange)s</td>
hunk ./darcsweb.cgi 2291
- 'desc': shorten_str(desc, 60)
+ 'desc': shorten_str(desc, 60),
+ 'owner': escape(repo_get_owner() or ''),
+ 'lastchange': how_old(os.stat(c.repodir + '/_darcs/patches').st_mtime),
hunk ./darcsweb.cgi 2295
+ config.repodir = orig_repodir
}
Tue Nov 1 09:54:21 UTC 2011 pinterface <pix@kepibu.org>
* Skip comments and blank lines in the author file
{
hunk ./darcsweb.cgi 634
- author = fd.readlines()[0].strip()
+ for line in fd:
+ line = line.strip()
+ if line != "" and line[0] != "#":
+ return line.strip()
hunk ./darcsweb.cgi 639
- author = None
- return author
+ return None
}
Tue Nov 1 08:30:12 UTC 2011 pinterface <pix@kepibu.org>
* Add ability to specify a mailing list URL for repositories
{
hunk ./darcsweb.cgi 1488
+ if config.repolisturl:
+ print ' <tr><td>mailing list url</td>'
+ print ' <td><a href="%(url)s">%(url)s</a></td></tr>' % \
+ { 'url': config.repolisturl }
hunk ./darcsweb.cgi 2378
+ if 'autolisturl' in dir(c) and c.autolisturl:
+ dpath = fulldir + \
+ '/_darcs/third_party/darcsweb/listurl'
+ if os.access(dpath, os.R_OK):
+ listurl = open(dpath).readline().rstrip("\n")
+ elif 'repolisturl' in dir(c):
+ listurl = c.repolisturl % rep_dict
+ else:
+ listurl = None
+ elif 'repolisturl' in dir(c):
+ listurl = c.repolisturl % rep_dict
+ else:
+ listurl = None
+
hunk ./darcsweb.cgi 2400
+ repolisturl = listurl
hunk ./darcsweb.cgi 2463
+ config.repolisturl = None
+ if 'repolisturl' in dir(c):
+ config.repolisturl = c.repolisturl
+
}
Tue Nov 1 08:12:39 UTC 2011 pinterface <pix@kepibu.org>
* Don't require myurl be specified when cachedir is in use
hunk ./darcsweb.cgi 2417
- if 'myurl' not in dir(base) and 'cachedir' not in dir(base):
+ if 'myurl' not in dir(base):
Wed Nov 24 15:52:33 UTC 2010 Alberto Bertogli <albertito@blitiri.com.ar>
tagged 1.2-rc1
{
}
Fri Oct 15 12:55:46 UTC 2010 Dave Love <fx@gnu.org>
* Use diff --quiet.
Prevents `Copying pristine' messages in output with darcs pre-2.5.
{
hunk ./darcsweb.cgi 685
- params = 'diff -u --match "hash %s"' % self.hash
+ params = 'diff --quiet -u --match "hash %s"' % self.hash
hunk ./darcsweb.cgi 931
- return run_darcs('diff -u --match "hash %s"' % hash)
+ return run_darcs('diff --quiet -u --match "hash %s"' % hash)
hunk ./darcsweb.cgi 934
- return run_darcs('diff -u --match "hash %s" "%s"' % (hash, fname))
+ return run_darcs('diff --quiet -u --match "hash %s" "%s"' % (hash, fname))
hunk ./darcsweb.cgi 937
- return run_darcs('diff -u --from-match "hash %s" "%s"' % (hash, fname))
+ return run_darcs('diff --quiet -u --from-match "hash %s" "%s"' % (hash, fname))
hunk ./darcsweb.cgi 940
- return run_darcs('diff -u --from-match "hash %s"' % hash)
+ return run_darcs('diff --quiet -u --from-match "hash %s"' % hash)
}
Fri Jun 25 00:32:55 UTC 2010 Alberto Bertogli <albertito@blitiri.com.ar>
* Do not use string exceptions
String exceptions are deprecated and will soon no longer be supported at all.
Most of the instances of string exceptions in our code were not meant to be
catched, but just to get meaningful backtraces.
This patch replaces them with appropriate, usually generic, exceptions that
serve the same purpose.
{
hunk ./darcsweb.cgi 82
- raise 'FilterFile FAILED'
+ raise Exception, 'FilterFile FAILED'
hunk ./darcsweb.cgi 119
- raise 'DecodingError', config.repoencoding
+ raise UnicodeDecodeError, config.repoencoding
hunk ./darcsweb.cgi 2407
- raise "RepoNotFound", name
+ raise Exception, "Repo not found: " + repr(name)
}