# will take up less space on the IRC notification line.
tinyifier = "http://tinyurl.com/api-create.php?url="
+# Map magic urlprefix values to actual URL prefixes
+prefixmap = {
+ "viewcvs": "http://%(host)s/viewcvs/%(repo)s?view=revision&revision=",
+ "gitweb": "http://%(host)s/cgi-bin/gitweb.cgi?p=%(repo)s;a=commit;h=",
+ "cgit": "http://%(host)s/cgi-bin/cgit.cgi/%(repo)s/commit/?id=",
+ }
+
#
# No user-serviceable parts below this line:
#
return commands.getstatusoutput(command)[1]
def urlify(extractor, commit):
- prefix = urlprefix % extractor.__dict__
+ extractor.urlprefix = prefixmap.get(extractor.urlprefix, extractor.urlprefix)
+ prefix = extractor.urlprefix % extractor.__dict__
# Try to tinyfy a reference to a web view for this commit.
try:
url = open(urllib.urlretrieve(tinyifier + prefix + commit)[0]).read()
self.channels = do("git config --get irker.channels")
self.tcp = do("git config --bool --get irker.tcp")
self.template = '%(project)s: %(author)s %(repo)s:%(branch)s * %(rev)s / %(files)s: %(logmsg)s %(url)s'
+ self.urlprefix = do("git config --get irker.urlprefix") or "gitweb"
# This one is git-specific
self.revformat = do("git config --get irker.revformat")
# The project variable defaults to the name of the repository toplevel.
self.logmsg = self.svnlook("log")
self.rev = "r%s" % self.commit
self.template = '%(project)s: %(author)s %(repo)s * %(rev)s / %(files)s: %(logmsg)s %(url)s'
+ self.urlprefix = "viewcvs"
load_preferences(self, os.path.join(self.repository, "irker.conf"))
def svnlook(self, info):
return do("svnlook %s %s --revision %s" % (shellquote(info), shellquote(self.repository), shellquote(self.commit)))
else:
extractor = GitExtractor()
- # Changeset URL prefix for your repo: when the commit ID is appended
- # to this, it should point at a CGI that will display the commit
- # through gitweb or something similar. The defaults will probably
- # work if you have a typical gitweb/cgit setup.
- #
- #urlprefix = "http://%(host)s/cgi-bin/gitweb.cgi?p=%(repo)s;a=commit;h="
- if vcs == "svn":
- urlprefix = "http://%(host)s/viewcvs/%(repo)s?view=revision&revision="
- else:
- urlprefix = "http://%(host)s/cgi-bin/cgit.cgi/%(repo)s/commit/?id="
-
# Make command-line overrides possible.
# Each argument of the form <key>=<value> can override the
# <key> member of the extractor class.
# Other defaults get set here
if not extractor.repo:
extractor.repo = extractor.project.lower()
- extractor.host = socket.getfqdn()
- extractor.url = urlify(extractor, extractor.commit)
+ extractor.host = socket.getfqdn()
+ if extractor.urlprefix == "None":
+ extractor.url = ""
+ else:
+ extractor.url = urlify(extractor, extractor.commit)
if not extractor.project:
sys.stderr.write("irkerhook.py: no project name set!\n")
Defaults to "false".</para>
</listitem>
</varlistentry>
+<varlistentry>
+<term>urlprefix</term>
+<listitem>
+<para>Changeset URL prefix for your repo. When the commit ID is appended
+to this, it should point at a CGI that will display the commit
+through cgit,gitweb or something similar. The defaults will probably
+work if you have a typical gitweb/cgit setup.</para>
+
+<para>If the value of this variable is "None", generation of the URL
+field in commit notifications will be suppressed. Other magic values
+are "cgit", "gitweb", and "viewcvs", which expand to URL templates
+that will usually work with those systems.</para>
+</listitem>
+</varlistentry>
</variablelist>
+
+
<refsect2 id="git"><title>git</title>
<para>Under git, <application>irkerhook.py</application> does not
to interpret an <filename>irker.conf</filename> file.</para>
<para>The default value of the "project" variable is the basename
-of the repository directory.</para>
+of the repository directory. The default value of the "urlprefix"
+variable is "viewcvs".</para>
<para>There is one git-specific variable, "revformat", controlling
the format of the commit identifier in a notification. It
<filename>irker.conf</filename> file.</para>
<para>The default for the project variable is the basename of the
-(required) repository= argument.</para>
+(required) repository= argument.The default value of the "urlprefix"
+variable is "cgit".</para>
<para>If an <filename>irker.conf</filename> file exists in the repository
root directory (not the checkout directory but where internals such as the