mirror of
https://github.com/odoo/runbot.git
synced 2025-03-15 23:45:44 +07:00
[IMP] runbot_merge: allow invoking bot as @bot and #bot
Before this, the bot would only acknowledge commands of the form <botname>: <commands> but since the bot is an actual user, people regularly use `@<botname>` as it seems like it should work *and* provides for autocompletion. Support that, as well as the octothorpe in case users want to pound robodoo. Related to odoo/runbot#38
This commit is contained in:
parent
b427cc675d
commit
bb664455ec
@ -214,7 +214,7 @@ class Project(models.Model):
|
||||
# temp hack: add a delay between staging repositories
|
||||
# in case there's a race when quickly pushing a repo
|
||||
# then its dependency
|
||||
time.sleep(20)
|
||||
# time.sleep(20)
|
||||
|
||||
# creating the staging doesn't trigger a write on the prs
|
||||
# and thus the ->staging taggings, so do that by hand
|
||||
@ -284,7 +284,7 @@ class Project(models.Model):
|
||||
|
||||
def _find_commands(self, comment):
|
||||
return re.findall(
|
||||
'^{}:? (.*)$'.format(self.github_prefix),
|
||||
'^[@|#]?{}:? (.*)$'.format(self.github_prefix),
|
||||
comment, re.MULTILINE)
|
||||
|
||||
def _has_branch(self, name):
|
||||
|
@ -1747,6 +1747,28 @@ class TestUnknownPR:
|
||||
env['runbot_merge.project']._check_progress()
|
||||
assert pr.staging_id
|
||||
|
||||
class TestComments:
|
||||
def test_address_method(self, repo, env):
|
||||
m = repo.make_commit(None, 'initial', None, tree={'m': 'm'})
|
||||
repo.make_ref('heads/master', m)
|
||||
|
||||
c1 = repo.make_commit(m, 'first', None, tree={'m': 'c1'})
|
||||
prx = repo.make_pr('title', 'body', target='master', ctid=c1, user='user')
|
||||
|
||||
repo.post_status(prx.head, 'success', 'legal/cla')
|
||||
repo.post_status(prx.head, 'success', 'ci/runbot')
|
||||
prx.post_comment('hansen delegate=foo', user='reviewer')
|
||||
prx.post_comment('@hansen delegate=bar', user='reviewer')
|
||||
prx.post_comment('#hansen delegate=baz', user='reviewer')
|
||||
|
||||
pr = env['runbot_merge.pull_requests'].search([
|
||||
('repository.name', '=', repo.name),
|
||||
('number', '=', prx.number)
|
||||
])
|
||||
|
||||
assert {p.github_login for p in pr.delegates} \
|
||||
== {'foo', 'bar', 'baz'}
|
||||
|
||||
def node(name, *children):
|
||||
assert type(name) in (str, re_matches)
|
||||
return name, frozenset(children)
|
||||
|
Loading…
Reference in New Issue
Block a user