Sun Nov 13 11:23:24 UTC 2011 pinterface * Add support for calling an external program to generate README markup Sun Nov 13 11:07:41 UTC 2011 pinterface * minidom chokes on form feed character Sat Nov 5 10:18:50 UTC 2011 pinterface * Show README in summary view, if it exists Blatantly stealing the idea from Github, but not as fully implemented. Tue Nov 1 10:19:57 UTC 2011 pinterface * Add Owner and Last Change columns to repo listing This is a little ugly due to the global config object. Boo. Tue Nov 1 09:54:21 UTC 2011 pinterface * Skip comments and blank lines in the author file Tue Nov 1 08:30:12 UTC 2011 pinterface * Add ability to specify a mailing list URL for repositories Tue Nov 1 08:12:39 UTC 2011 pinterface * Don't require myurl be specified when cachedir is in use Wed Nov 24 15:52:33 UTC 2010 Alberto Bertogli tagged 1.2-rc1 Fri Oct 15 12:55:46 UTC 2010 Dave Love * Use diff --quiet. Prevents `Copying pristine' messages in output with darcs pre-2.5. Fri Jun 25 00:32:55 UTC 2010 Alberto Bertogli * 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. Sun Mar 28 18:21:44 UTC 2010 Simon Michael * log view: display the patch name just once, tighten up whitespace Sun Mar 28 16:40:18 UTC 2010 Simon Michael * allow custom "last" value in url, eg to view all patches on one page Sun Mar 28 16:37:55 UTC 2010 Simon Michael * hide darcs' Ignore-this: metadata in log view Sun Mar 28 18:57:50 UTC 2010 Simon Michael * more robust timestamp parsing With this, darcsweb can list the full darcs repo log. Thu Mar 26 19:58:42 UTC 2009 gaetan.lehmann@jouy.inra.fr * add the year in the date field if the patch wasn't made in the current year Tue Oct 28 15:44:36 UTC 2008 Alberto Bertogli tagged 1.1 Tue Oct 28 15:43:41 UTC 2008 Alberto Bertogli * Update my email address Tue Aug 12 09:50:07 UTC 2008 Alexandre Rossi * fix pygments disaligned linenos and code when using windows fonts (pygments>0.7 only) Tue Oct 14 21:18:42 UTC 2008 Alberto Bertogli tagged 1.1-rc1 Tue Oct 14 21:18:29 UTC 2008 Alberto Bertogli * Update HTML version number Sun Oct 5 15:53:16 UTC 2008 Alberto Bertogli * Import pygments only when needed Otherwise, we pay for the pygments import (which is noticeable) on every darcsweb page view. This follows the lazy module loading that is already being done for other costly modules (i.e. 're'). Sun Oct 5 15:48:31 UTC 2008 Alberto Bertogli * Ignore broken multidir directories When a multidir directory is not really a directory or a valid symlink to one, we want to skip it instead of exploding. This patch fixes that by doing a simple sanity check while processing the configured multidirs. Thanks to Ralph Giles for the report and the patch. Thu Aug 7 05:31:41 UTC 2008 Alexandre Rossi * optional source headblob syntax highlighting using python-pygments Thu Aug 7 04:41:45 UTC 2008 Alberto Bertogli * Handle old date formats Very old darcs commits use a different time format, that leaks out in some operations like annotate. This patch makes darcsweb able to handle it. Thanks to Simon Michael for the report and the help. Sun Aug 3 15:04:07 UTC 2008 Alberto Bertogli * Fix typo in annotate output Sun Aug 3 15:03:41 UTC 2008 Alberto Bertogli * Simplify annotate code A very simple change, makes the code more straightforward. Sun Aug 3 15:02:56 UTC 2008 Alberto Bertogli * Fix annotate so it works with darcs 2 darcs 2 doesn't like files beginning with / as parameters for annotate. Since darcs 1 doesn't care, remove the '/' before running darcs. Sun Aug 3 15:00:34 UTC 2008 Alberto Bertogli * Use _darcs/patches instead of _darcs/inventory In darcs 2, there is no _darcs/inventory, so use the patches directory to find out the last modification time of the repository. Thanks to Patrick Waugh (ptwaugh@gmail.com) for providing (and testing) this fix. Tue Apr 8 00:11:05 UTC 2008 Alberto Bertogli tagged 1.0 Tue Apr 8 00:10:21 UTC 2008 Alberto Bertogli * Version 1.0 Thu Mar 27 01:06:42 UTC 2008 Alberto Bertogli tagged 1.0-rc2 Thu Mar 27 01:02:58 UTC 2008 Alberto Bertogli * Add an option to change the display name of the repository It can be used to avoid clashes in multidir entries. Thanks to Dan Muller for the idea and alternative implementation. Mon Mar 24 17:31:17 UTC 2008 Miklos Vajna * add support for the DARCSWEB_CONFPATH env var - useful when hosting multiple darcsweb sites via vhost Sun Oct 14 15:48:26 UTC 2007 Alberto Bertogli tagged 1.0-rc1 Sun Oct 14 15:42:34 UTC 2007 Alberto Bertogli * Add /etc/darcsweb after '.' in sys.path. Add it second place, so it goes after '.' but before the normal path. This allows per-directory config files (desirable for multiple darcsweb installations on the same machin), and avoids name clashing if there's a config.py in the standard path. This was reported by Philipp Kern in Debian bug 399751 (http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=399751). Fri Jun 22 09:30:21 UTC 2007 Peter Colberg * Adjust URI scheme according to CGI environment variable HTTPS. This patch fixes RSS feed links when browsing darcsweb via SSL. Wed May 16 09:48:24 UTC 2007 Jonathan Buchanan * Fixed bad links in RSS feed when darcsweb URL is automatically detected When the darcsweb URL is automatically detected, the script name is included in the URL - this results in bad links in RSS feeds like /darcsweb.cgi/darcsweb.cgi?r=projname. Wed May 16 09:46:25 UTC 2007 Jonathan Buchanan * Fixed a path problem when running on Windows Repositories in subdirectories have backslashes in their path when running on Windows, which results in bad URLS - replaced these with forward slashes. Thu May 3 16:18:30 UTC 2007 VMiklos * display the size of the files in tree view Mon Apr 16 19:06:18 UTC 2007 Alberto Bertogli * Soften some colors in commitdiff. Mon Apr 16 09:13:34 UTC 2007 Alexandre Rossi * only read the first line of _darcs/third_party/darcsweb/* files Mon Apr 16 09:11:29 UTC 2007 Alexandre Rossi * make color commitdiff more readable when parts of a file are skipped Fri Mar 16 19:27:14 UTC 2007 VMiklos * new optional config varuable: disable_annotate * the annotate feature is still enabled by default * this can be useful on slow machines Wed Apr 4 15:09:32 UTC 2007 Alexandre Rossi * closing tag in project url link Wed Apr 4 12:15:12 UTC 2007 Alexandre Rossi * typo in sample config autoprojurl description Thu Feb 1 17:30:50 UTC 2007 VMiklos * new optional config varuable: author_links it is disabled by default and an example for cia is included Wed Jan 24 23:38:07 UTC 2007 Alberto Bertogli * Check python version before running darcsweb. This patch adds a check to verify that the python version is >= 2.3, so the user doesn't get strange errors when using older python interpreters. Thanks to Mark Stosberg for the suggestion. Wed Jan 17 23:02:12 UTC 2007 jonathan.buchanan@gmail.com * The DARCS_DONT_ESCAPE_8BIT environment variable is now set using os.environ before running darcs and restored to its original state after running darcs - makes darcsweb work on Windows Mon Dec 25 22:18:20 UTC 2006 Alberto Bertogli * Add support for regexp-based replacing. Add an option to replace text in the summary, using regexps. This allows you to configure darcsweb to automatically detect and put links to other commits or bug numbers. This patch is heavily based on the one written by Kirill Smelkov (kirr@mns.spb.ru). Thu Nov 30 09:37:41 UTC 2006 Kirill Smelkov * string.join is deprecated Mon Dec 25 21:43:36 UTC 2006 Alberto Bertogli * Change my email address. Tue Oct 10 03:04:21 UTC 2006 Alberto Bertogli tagged 0.16 Wed Aug 9 17:54:30 UTC 2006 Alberto Bertogli * Handle empty lines in print_darcs_diff(). A "setpref" patch can output empty lines when seen with darcs_diff. Handle that case by ignoring them. Thanks to VMiklos from reporting it. Mon Jul 31 05:29:33 UTC 2006 Alberto Bertogli tagged 0.16-rc1 Mon Jul 31 05:28:34 UTC 2006 Alberto Bertogli * Remove some unnecessary newlines in html output. Mon Jul 31 05:10:03 UTC 2006 Alberto Bertogli * Make browsing files in tree root easier. This patch makes it easier to browse files in the root of the tree, by making it simpler to return to the root tree view. Mon Jul 31 04:54:05 UTC 2006 Alberto Bertogli * Allow projects to link to external sites. Add a 'repoprojurl' configuration option to put a reference to an external project site. It appears in the project summary, just like url. It also supports multidir, both automatic detection in the third_party directory, and static construction. Thanks to Alexandre Rossi for the idea and preliminary patch. Mon Jul 31 04:24:50 UTC 2006 Alberto Bertogli * Convert remaining auriga references to example.com. Mon Jul 31 04:10:20 UTC 2006 Alberto Bertogli * Implement url and scriptname autodetection. This patch implements autodetection of the url and scriptname of darcsweb. It's based on a suggestion from Tobias Gruetzmacher. It relies on variables according to the CGI/1.1 standard, and works only if cache is not enabled. If it is, the variables must be set manually as before. The problem with the cache is multi-host access: if a page not in the cache is accesed as http://hosta/dw/..., then the cached page will reference "hosta". If then it's accessed from hostb, there will be a reference to hosta that it's possibly broken. It's actually a quite common case when you have localhost and external access. diff -rN -u old-darcsweb/README new-darcsweb/README --- old-darcsweb/README 2013-07-25 10:40:20.000000000 +0000 +++ new-darcsweb/README 2013-07-25 10:40:20.000000000 +0000 @@ -1,7 +1,7 @@ darcsweb - A web interface for darcs -Alberto Bertogli (albertogli@telpin.com.ar) -------------------------------------------- +Alberto Bertogli (albertito@blitiri.com.ar) +--------------------------------------------- This is a very simple web interface for darcs, inspired in gitweb (written by Kay Sievers and Christian Gierke). diff -rN -u old-darcsweb/config.py.sample new-darcsweb/config.py.sample --- old-darcsweb/config.py.sample 2013-07-25 10:40:20.000000000 +0000 +++ new-darcsweb/config.py.sample 2013-07-25 10:40:20.000000000 +0000 @@ -1,12 +1,6 @@ # base configuration, common to all repos class base: - # this script's name, usually just "darcsweb.cgi" unless you rename it - myname = "darcsweb.cgi" - - # our url, used only to generate RSS links, without the script name - myurl = "http://example.com/darcsweb" - # location of the darcs logo darcslogo = "darcs.png" @@ -16,6 +10,14 @@ # the CSS file to use cssfile = 'style.css' + # this script's name, usually just "darcsweb.cgi" unless you rename + # it; if you leave this commented it will be detected automatically + #myname = "darcsweb.cgi" + + # our url, used only to generate RSS links, without the script name; + # if you leave this commented it will be detected automatically + #myurl = "http://example.com/darcsweb" + # optionally, you can specify the path to the darcs executable; if you # leave this commented, the one on $PATH will be used (this is # normally what you want) @@ -38,6 +40,8 @@ # fine. # If you leave the entry commented, no cache will be ever used; # otherwise the directory is assumed to exist and be writeable. + # If you use this option you must set the "myname" and "myurl" + # variables. #cachedir = '/tmp/darcsweb-cache' # By default, darcsweb's search looks in the last 100 commits; you can @@ -51,6 +55,40 @@ # darcsweb. #logtimes = "/tmp/darcsweb_times" + # If you want darcsweb to automatically detect embedded URLs, + # define them here, using python-style regexps like the examples + # below. They will be replaced in summaries, logs, and commits. + # The following variables are replaced: + # myreponame: repository link (darcsweb.cgi?r=repo) + # reponame: repository name (repo) + # + #url_links = ( + # Format is: (regexp, replacement) + # Some examples: + # + # Detect '#NNN' as a reference to bug database + #(r'#([0-9]+)', + # r'#\1'), + # + # Replace hashes with commit-links. + #(r'(\d{14}-[0-9a-f]{5}-[0-9a-f]{40}\.gz)', + # r'\1'), + #) + + # If you want to generate links from patch author names, define the url + # here. Example for CIA: + #author_links = "http://cia.navi.cx/stats/author/%(author)s" + + # If you want to disable the annotate feature (for performance reasons, + # the http connection will time out on slow machines), uncomment this + # option. + #disable_annotate = True + + # 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' + # # From now on, every class is a repo configuration, with the same format @@ -73,7 +111,7 @@ repodir = '/usr/src/repo1' # an url so people know where to do "darcs get" from - repourl = 'http://auriga.wearlab.de/~alb/repos/repo1/' + repourl = 'http://example.com/repos/repo1/' # the encoding used in the repo # NOTE: if you use utf8, you _must_ write 'utf8' (and not the variants @@ -91,12 +129,17 @@ # either, a default one is used) #footer = "I don't like being cold" + # Each repository may show a link to some website associated with it. + # This is typically useful if you've got a website describing the + # software in your repository. + #repoprojurl = 'http://example.com/projects/repo1/' + class repo2: reponame = 'repo2' repodesc = 'Second example repository' repodir = '/usr/src/repo2' - repourl = 'http://auriga.wearlab.de/~alb/repos/repo2/' + repourl = 'http://example.com/repos/repo2/' repoencoding = 'latin1' @@ -105,7 +148,8 @@ # create a configuration entry for each one, you can use a "multidir" entry, # which serves as a "template" for all the repositories in that directory. # The name is taken from the directory, and inside the variables the string -# "%(name)s" gets expanded to the it. +# "%(name)s" gets expanded to the it. If displayname is set, "%(dname)s" gets +# expanded to it; otherwise it's the same as "%(name)s". # # If you set multidir_deep to True (note the capitalization) then all # subdirectories are searched for darcs repositories. Subdirectories starting @@ -118,9 +162,17 @@ multidir = '/usr/local/src' #multidir_deep = False repodesc = 'Repository for %(name)s' - repourl = 'http://auriga.wearlab.de/~alb/repos/%(name)s/' + repourl = 'http://example.com/repos/%(name)s/' repoencoding = 'latin1' + # if you want to change the display name of the repositories (i.e. the + # name it will have on the listings, urls, etc.), you can set it here. + # You can use "%(name)s" expansion, see above. + #displayname = "local/%(name)s" + + # optional, see above + #repoprojurl = 'http://example.com/projects/%(name)s/' + # if you want to exclude some directories, add them to this list (note # they're relative to multidir, not absolute) #exclude = 'dir1', 'dir2' @@ -140,3 +192,8 @@ # True. It defaults to False. #autourl = True + # if you want the projects urls to be picked up automatically from the + # file named "_darcs/third_party/darcsweb/projurl" (one line only), set + # this to True. It defaults to False. + #autoprojurl = True + diff -rN -u old-darcsweb/darcsweb.cgi new-darcsweb/darcsweb.cgi --- old-darcsweb/darcsweb.cgi 2013-07-25 10:40:20.000000000 +0000 +++ new-darcsweb/darcsweb.cgi 2013-07-25 10:40:20.000000000 +0000 @@ -2,7 +2,7 @@ """ darcsweb - A web interface for darcs -Alberto Bertogli (albertogli@telpin.com.ar) +Alberto Bertogli (albertito@blitiri.com.ar) Inspired on gitweb (as of 28/Jun/2005), which is written by Kay Sievers and Christian Gierke @@ -23,10 +23,22 @@ iso_datetime = '%Y-%m-%dT%H:%M:%SZ' +PATCHES_PER_PAGE = 50 + # In order to be able to store the config file in /etc/darcsweb, it has to be # added to sys.path. It's mainly used by distributions, which place the -# default configuration there. -sys.path.append('/etc/darcsweb') +# default configuration there. Add it second place, so it goes after '.' but +# before the normal path. This allows per-directory config files (desirable +# for multiple darcsweb installations on the same machin), and avoids name +# clashing if there's a config.py in the standard path. +sys.path.insert(1, '/etc/darcsweb') + +# Similarly, when hosting multiple darcsweb instrances on the same +# server, you can just 'SetEnv DARCSWEB_CONFPATH' in the httpd config, +# and this will have a bigger priority than the system-wide +# configuration file. +if 'DARCSWEB_CONFPATH' in os.environ: + sys.path.insert(1, os.environ['DARCSWEB_CONFPATH']) # empty configuration class, we will fill it in later depending on the repo class config: @@ -50,24 +62,24 @@ def filter_num(s): l = [c for c in s if c in string.digits] - return string.join(l, "") + return ''.join(l) allowed_in_action = string.ascii_letters + string.digits + '_' def filter_act(s): l = [c for c in s if c in allowed_in_action] - return string.join(l, "") + return ''.join(l) allowed_in_hash = string.ascii_letters + string.digits + '-.' def filter_hash(s): l = [c for c in s if c in allowed_in_hash] - return string.join(l, "") + return ''.join(l) def filter_file(s): if '..' in s or '"' in s: - raise 'FilterFile FAILED' + raise Exception, 'FilterFile FAILED' if s == '/': return s @@ -83,7 +95,7 @@ def printd(*params): - print string.join(params), '
' + print ' '.join(params), '
' # I _hate_ this. @@ -94,7 +106,7 @@ n = [] for i in s.split('\n'): n.append(_fixu8(i)) - return string.join(n, '\n') + return '\n'.join(n) def _fixu8(s): if type(s) == unicode: @@ -104,7 +116,7 @@ return s.decode(e).encode('utf8', 'replace') except UnicodeDecodeError: pass - raise 'DecodingError', config.repoencoding + raise UnicodeDecodeError, config.repoencoding def escape(s): @@ -118,7 +130,11 @@ # the cached entries will have old data; so in this case just # return a nice string t = time.localtime(epoch) - s = time.strftime("%d %b %H:%M", t) + currentYear = time.localtime()[0] + if t[0] == currentYear: + s = time.strftime("%d %b %H:%M", t) + else: + s = time.strftime("%d %b %Y %H:%M", t) return s age = int(time.time()) - int(epoch) if age > 60*60*24*365*2: @@ -161,6 +177,26 @@ pos = s.find("\t") return s +def replace_links(s): + """Replace user defined strings with links, as specified in the + configuration file.""" + import re + + vardict = { + "myreponame": config.myreponame, + "reponame": config.reponame, + } + + for link_pat, link_dst in config.url_links: + s = re.sub(link_pat, link_dst % vardict, s) + + return s + +def strip_ignore_this(s): + """Strip out darcs' Ignore-this: metadata if present.""" + import re + return re.sub(r'^Ignore-this:[^\n]*\n?','',s) + def highlight(s, l): "Highlights appearences of s in l" import re @@ -205,8 +241,16 @@ if m & 0001: s.append('x') else: s.append('-') - return string.join(s, '') + 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 @@ -258,6 +302,22 @@ lf.close() +def parse_darcs_time(s): + "Try to convert a darcs' time string into a Python time tuple." + try: + return time.strptime(s, "%Y%m%d%H%M%S") + except ValueError: + # very old darcs commits use a different format, for example: + # "Wed May 21 19:39:10 CEST 2003" or even: + # "Sun Sep 21 07:23:57 Pacific Daylight Time 2003" + # we can't parse the time zone part reliably, so we ignore it + fmt = "%a %b %d %H:%M:%S %Y" + parts = s.split() + ns = ' '.join(parts[0:4]) + ' ' + parts[-1] + return time.strptime(ns, fmt) + + + # # generic html functions # @@ -269,8 +329,8 @@ -