Download:
child 24:751c2fca6ce6
parent 22:469ce066f4a4
23:78c3d66226a4 draft
Anton Shestakov <av6@dwimlabs.net>, Wed, 21 Nov 2018 18:20:21 +0800
plugin: we don't use roundup anymore, bugs are handled by bugzilla plugin

2 файлов изменено, 0 вставок(+), 89 удалений(-) [+]
plugin.py file | annotate | diff | comparison | revisions
test.py file | annotate | diff | comparison | revisions
--- a/plugin.py Wed Nov 21 18:13:37 2018 +0800
+++ b/plugin.py Wed Nov 21 18:20:21 2018 +0800
@@ -34,70 +34,6 @@
import os
import subprocess
-import urllib
-import logging
-
-fields = {'issue':'title',
- 'msg':'content',
- 'file':'description',
- }
-
-def fetch_item(nodeid, kind='issue', tracker='http://mercurial.selenic.com/bts'):
- """Use Roundup's CSV exports to fetch arbitrary item descriptions
-
- Default behavior is to return subject for a new issue:
- >>> fetch_item(1201569)
- '[issue1201569] allow running multiple instances of IDLE'
-
- Can also fetch message contents:
- >>> fetch_item(108, 'msg')
- 'Assigned to Guido for obvious reasons.'
-
- Multiline messages have spurious quotes, thanks to CSV format:
- >>> print fetch_item(81362, 'msg')
- "Incorporated as:
- 2.7: r69419
- 3.1: r69421"
-
- File descriptions work too:
- >>> fetch_item(102, 'file')
- 'Example of message from frustrated user on c.l.py'
-
- Missing descriptions show as 'None':
- >>> fetch_item(12227, 'file')
- 'None'
- """
-
- # This should be the smallest query able to fetch what we need
- query_tpl = [('@action', 'export_csv'), ('@filter', 'id'),
- ('id', nodeid), ('@columns', fields[kind])]
- # Request path + query
- item_url = '/%s?%s' % (kind, urllib.urlencode(query_tpl))
- content = urllib.urlopen(tracker + item_url).read().split('\r\n')
- if content[0] == 'title':
- # Got a single data row CSV, format and return it
- return '[issue%s] %s' % (nodeid, content[1].strip())
- elif content[0] == 'content':
- return content[1].strip()
- elif content[0] == 'description':
- return content[1].strip()
-
-def fetch(nodeid, debug=True):
- ''' Format input for fetch_item, add debug messages '''
-
- kind = 'issue'
- if nodeid.startswith('msg'):
- kind = 'msg'
- elif nodeid.startswith('file'):
- kind = 'file'
- nodeid = nodeid.replace(kind, '')
- result = fetch_item(int(nodeid), kind)
- if not result:
- result = 'No item found for %s%s' % (kind, nodeid)
- if debug:
- logging.info('Fetched "%s: %s"' % (kind, result))
- return result
-
def revparse(irc, msg, args, state):
if ':' in args[0]:
state.errorInvalid('revision', args[0],
@@ -186,27 +122,6 @@
main = _changelogcmd('/home/hg/repos/hg')
crew = _changelogcmd('/home/brendan/hg/mirror/mercurial/crew')
- def bts(self, irc, msg, args, issue):
- """usage: bts (url|<issueno>)
- url gets the url of the bts, <issueno> summarizes that bug
- """
- url = 'http://mercurial.selenic.com/bts'
- if issue == 'url':
- irc.reply(url)
- return None
-
- title = fetch(issue)
- link = None
- if title.startswith('[issue'):
- end = title.find(']')
- link = '/'.join([url, title[1:end]])
- title = ircutils.bold(title[:end+1]) + title[end+1:]
- title = title.replace('\n', ' ')
- irc.reply(title)
- if link:
- irc.reply(link)
- bts = wrap(bts, ['text'])
-
def glossary(self, irc, msg, args, term):
"""usage: glossary <term>"""
raw, err = self.hg.run(['help', 'glossary'])
--- a/test.py Wed Nov 21 18:13:37 2018 +0800
+++ b/test.py Wed Nov 21 18:20:21 2018 +0800
@@ -38,10 +38,6 @@
self.assertNotError('hghelp foo')
self.assertHelp('hghelp')
- def testBTS(self):
- self.assertRegexp('bts url', 'https?://.*')
- self.assertHelp('bts')
-
def testGlossary(self):
self.assertResponse('glossary cset',
'A common abbreviation of the term changeset.')