From 5de7639328297d5dd13ee57734f7d6144e68f35b Mon Sep 17 00:00:00 2001 From: "Eric S. Raymond" Date: Thu, 27 Sep 2012 14:28:35 -0400 Subject: [PATCH] Cleanup. --- .gitignore | 1 + BUGS | 2 +- irkbot.py | 20 ++++++++++++-------- 3 files changed, 14 insertions(+), 9 deletions(-) diff --git a/.gitignore b/.gitignore index bd533a3..477dd18 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,5 @@ irker.pyc +irkbot.pyc irker.1 irker.html irc diff --git a/BUGS b/BUGS index 43cbdcd..b14ea24 100644 --- a/BUGS +++ b/BUGS @@ -4,5 +4,5 @@ We apologize for the rough edges on this software. The initial release was somewhat rushed by the sudden death of cia.vc in late September 2012; a replacement needed to be fielded immediately. -* Despite what the header comment implies, the URL prefix and tinyfier +* Despite what the header comment implies, the URL prefix and message template can at present only be modified by hacking the script. diff --git a/irkbot.py b/irkbot.py index 69b034b..2f4c7fd 100755 --- a/irkbot.py +++ b/irkbot.py @@ -13,12 +13,13 @@ # # Currently works for svn and git. For svn you must call it as follows: # -# irkbot.py type=svn repository=REPO-PATH commit=REVISION channels=CHANNELS +# irkbot.py type=svn repository=REPO-PATH commit=REVISION channels=CHANNELS server=SERVER # # REPO-PATH must be the absolute path of the SVN repository (first # argument of Subversion post-commit). REVISION must be the Subversion numeric # commit level (second argument of Subversion post-commit). CHANNELS must -# be a string containing either an IRC URL or comma-separated list of same +# be a string containing either an IRC URL or comma-separated list of same. +# SERVER must be an irker host. # # For git, you can noormally call this script without arguments; it # will deduce most of what it needs from git configuration variables @@ -141,20 +142,21 @@ class SvnExtractor: "Metadata extraction for the svn version control system." def __init__(self, arguments): self.commit = None + # Some things we need to have before metadata queries will work for tok in arguments: if tok.startswith("repository="): self.repository = tok[11:] elif tok.startswith("commit="): self.commit = tok[7:] self.project = os.path.basename(self.repository) + self.repo = None + self.server = None + self.channels = None + self.tcp = True self.author = self.svnlook("author") self.files = self.svnlook("dirs-changed") self.logmsg = self.svnlook("log") - self.repo = None - self.tcp = True - self.channels = None self.rev = "r{0}".format(self.commit) - def svnlook(self, info): return do("svnlook {0} {1} --revision {2}".format(info, self.repository, self.commit)) @@ -178,10 +180,12 @@ if __name__ == "__main__": print "irkbot.py: version", version sys.exit(0) - # Force the type if not git + # Force the type if not git, also make globals settable for tok in arguments: if tok.startswith("type="): vcs = tok[5:] + elif tok.startswith("tinyfier="): + tinyfier = tok[9:] # Someday we'll have extractors for several version-control systems if vcs == "git": @@ -234,7 +238,7 @@ if __name__ == "__main__": extractor.url = urlify(extractor, extractor.commit) if not extractor.project: - sys.stderr.write("irkbot.py: no project name set\n") + sys.stderr.write("irkbot.py: no project name set!\n") sys.exit(1) privmsg = template % extractor.__dict__ -- 2.26.2