Download:
parent 38:ec32ce289f91
39:ddc609bd0303 draft default tip
Anton Shestakov <av6@dwimlabs.net>, Tue, 05 Feb 2019 22:49:35 +0800
plugin: use configurable base URL instead of paths.default in repo hgrc Let's hope we'll never need nested repos, or special cases, or anything else ever. If we do, maybe make URL configurable for each repo.

3 файлов изменено, 8 вставок(+), 3 удалений(-) [+]
config.py file | annotate | diff | comparison | revisions
plugin.py file | annotate | diff | comparison | revisions
test.py file | annotate | diff | comparison | revisions
--- a/config.py Sun Dec 16 11:17:34 2018 +0800
+++ b/config.py Tue Feb 05 22:49:35 2019 +0800
@@ -64,6 +64,10 @@
registry.String('/home/hg/repos/evolve',
"""Path to the evolve repo."""))
+conf.registerGlobalValue(Mercurial, 'hgweburl',
+ registry.String('https://www.mercurial-scm.org/repo',
+ """URL of the hgweb instance."""))
+
conf.registerGlobalValue(Mercurial, 'phaburl',
registry.String('https://phab.mercurial-scm.org',
"""URL of the phabricator instance."""))
--- a/plugin.py Sun Dec 16 11:17:34 2018 +0800
+++ b/plugin.py Tue Feb 05 22:49:35 2019 +0800
@@ -118,8 +118,9 @@
lines = ['%s %s %s' % (node, user, date)] + lines
- baseurl, err = self.hg.run(['-R', repo, 'paths', 'default'])
- url = "%s/rev/%s" % (baseurl.strip("\n/"), rev)
+ baseurl = self.registryValue('hgweburl').rstrip('/')
+ reponame = os.path.basename(os.path.normpath(repo))
+ url = '{}/{}/rev/{}'.format(baseurl, reponame, rev)
irc.replies(lines[:2] + [url], joiner=' - ')
def _changelogcmd(key):
--- a/test.py Sun Dec 16 11:17:34 2018 +0800
+++ b/test.py Tue Feb 05 22:49:35 2019 +0800
@@ -46,7 +46,7 @@
self.assertHelp('glossary')
def testChangelog(self):
- self.assertRegexp('main 0', 'Mercurial plugin 0\.1')
+ self.assertRegexp('main 0', 'Mercurial plugin 0\.1.*http.*/rev/0')
self.assertNotError('main null')
self.assertHelp('main')