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. diff -rN -u old-darcsweb/config.py.sample new-darcsweb/config.py.sample --- old-darcsweb/config.py.sample 2015-04-15 14:56:02.000000000 +0000 +++ new-darcsweb/config.py.sample 2015-04-15 14:56:02.000000000 +0000 @@ -95,6 +95,11 @@ # 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' @@ -125,6 +130,9 @@ repourl = 'http://example.com/repos/%(name)s/' repoencoding = 'latin1' + # 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' @@ -144,3 +152,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/extdoc" (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 2015-04-15 14:56:02.000000000 +0000 +++ new-darcsweb/darcsweb.cgi 2015-04-15 14:56:02.000000000 +0000 @@ -1348,6 +1348,10 @@ ps[0].local_date_str print ' url%(url)s' %\ { 'url': config.repourl } + if config.repoprojurl: + print ' project url' + print ' %(url)s' % \ + { 'url': config.repoprojurl } print '' print_shortlog(15) @@ -2195,6 +2199,20 @@ else: url = c.repourl % { 'name': name } + if 'autoprojurl' in dir(c) and c.autoprojurl: + dpath = fulldir + \ + '/_darcs/third_party/darcsweb/projurl' + if os.access(dpath, os.R_OK): + projurl = open(dpath).read() + elif 'repoprojurl' in dir(c): + projurl = c.repoprojurl % {'name': name} + else: + projurl = None + elif 'repoprojurl' in dir(c): + projurl = c.repoprojurl % { 'name': name } + else: + projurl = None + rdir = fulldir class tmp_config: reponame = name @@ -2202,9 +2220,11 @@ repodesc = desc repourl = url repoencoding = c.repoencoding + repoprojurl = projurl if 'footer' in dir(c): footer = c.footer + config.__setattr__(name, tmp_config) def fill_config(name = None): @@ -2256,6 +2276,11 @@ config.repodesc = c.repodesc config.repodir = c.repodir config.repourl = c.repourl + + config.repoprojurl = None + if 'repoprojurl' in dir(c): + config.repoprojurl = c.repoprojurl + # repoencoding must be a tuple if isinstance(c.repoencoding, str): config.repoencoding = (c.repoencoding, )