--- a/config.py Wed Nov 21 20:41:07 2018 +0800
+++ b/config.py Wed Nov 21 20:42:40 2018 +0800
conf.registerGlobalValue(Mercurial, 'path',
"""Path to the mercurial binary"""))
+conf.registerGroup(Mercurial, 'repos')
+conf.registerGlobalValue(Mercurial.repos, 'hg',
+ registry.String('/home/hg/repos/hg',
+ """Path to the main hg repo."""))
+conf.registerGlobalValue(Mercurial.repos, 'hg-committed',
+ registry.String('/home/hg/repos/hg-committed',
+ """Path to the hg-committed repo."""))
+conf.registerGlobalValue(Mercurial.repos, 'hg-all',
+ registry.String('/home/hg/repos/hg-all',
+ """Path to the hg-all repo."""))
--- a/plugin.py Wed Nov 21 20:41:07 2018 +0800
+++ b/plugin.py Wed Nov 21 20:42:40 2018 +0800
url = "%s/rev/%s" % (baseurl.strip("\n/"), rev)
irc.replies(lines[:2] + [url])
- def _changelogcmd(repo):
+ def _changelogcmd(key):
def cmd(self, irc, msg, args, rev):
Returns the changelog message and the URL for the given revision."""
- self._changelog(irc, repo, rev)
+ self._changelog(irc, self.registryValue(key), rev)
return wrap(cmd, ['revision'])
- main = _changelogcmd('/home/hg/repos/hg')
- crew = _changelogcmd('/home/brendan/hg/mirror/mercurial/crew')
+ main = _changelogcmd('repos.hg')
+ hgcommitted = _changelogcmd('repos.hg-committed')
+ hgall = _changelogcmd('repos.hg-all')
def glossary(self, irc, msg, args, term):
--- a/test.py Wed Nov 21 20:41:07 2018 +0800
+++ b/test.py Wed Nov 21 20:42:40 2018 +0800
class MercurialTestCase(PluginTestCase):
+ config = {'supybot.plugins.Mercurial.repos.hg': '.'}
self.assertRegexp('hghelp verify', '.*verify the integrity.*')
self.assertResponse('glossary foo', 'no match found')
self.assertHelp('glossary')
+ def testChangelog(self):
+ self.assertRegexp('main 0', 'Mercurial plugin 0\.1')
+ self.assertNotError('main null')
+ self.assertHelp('main')
# vim:set shiftwidth=4 tabstop=4 expandtab textwidth=79: