Page MenuHomeSoftware Heritage

D1375.id4568.diff
No OneTemporary

D1375.id4568.diff

diff --git a/Phabricator/plugin.py b/Phabricator/plugin.py
--- a/Phabricator/plugin.py
+++ b/Phabricator/plugin.py
@@ -220,16 +220,14 @@
^ # start of line
|(?<![:])\b # word boundary, not preceded by ":"
)
- [A-Z]\d+
+ ([A-Z])(\d+)(#\d+[-A-Za-z0-9]*)* # optional comment
(?:
$ # end of line
|\b # word boundary
)
"""
for recipient in msg.args[0].split(','):
- object_tag = match.group(0)
- object_type = object_tag[0]
- object_id = int(object_tag[1:])
+ object_type = match.group(1)
lookup = {
'B': self.conduit(recipient).harbormaster.build.search,
'D': self.conduit(recipient).differential.revision.search,
@@ -239,6 +237,9 @@
if object_type not in lookup:
return
+ object_id = int(match.group(2))
+ object_fragment = match.group(3) # Or None as this is optional
+
lookup_args = {
'constraints': {
'ids': [object_id],
@@ -261,13 +262,13 @@
self.wrapped_message(
irc.reply,
- formatter[object_type](recipient, object),
+ formatter[object_type](recipient, object, object_fragment),
notice=True,
prefixNick=False,
to=recipient,
)
- def build_formatter(self, recipient, build):
+ def build_formatter(self, recipient, build, object_fragment=None):
full_build = self.get_object_by_phid(recipient, build['phid'], True)
buildable = self.get_buildable(recipient,
build['fields']['buildablePHID'])
@@ -283,7 +284,7 @@
url=full_build['uri'],
)
- def diff_formatter(self, recipient, diff):
+ def diff_formatter(self, recipient, diff, object_fragment=None):
full_diff = self.get_object_by_phid(recipient, diff['phid'], True)
repo = self.get_repo(recipient, diff['fields']['repositoryPHID'])
details = []
@@ -295,15 +296,19 @@
status = diff['fields']['status']['name']
details.append(self.diff_status_theme(status))
+ url = full_diff['uri']
+ if object_fragment is not None:
+ url = '%s%s' % (url, object_fragment)
+
return "{id} ({details}) on {repo}: {title} <{url}>".format(
id=ircutils.bold('D%s' % diff['id']),
repo=ircutils.bold(self.get_repo_name(repo)),
title=diff['fields']['title'],
details=', '.join(details),
- url=full_diff['uri'],
+ url=url,
)
- def paste_formatter(self, recipient, paste):
+ def paste_formatter(self, recipient, paste, object_fragment=None):
full_paste = self.get_object_by_phid(recipient, paste['phid'], True)
details = []
details.append(
@@ -311,14 +316,18 @@
recipient, paste['fields']['authorPHID']
)
)
+ url = full_paste['uri']
+ if object_fragment is not None:
+ url = '%s%s' % (url, object_fragment)
+
return "{id} ({details}): {title} <{url}>".format(
id=ircutils.bold('P%s' % paste['id']),
title=paste['fields']['title'],
details=', '.join(details),
- url=full_paste['uri'],
+ url=url,
)
- def task_formatter(self, recipient, task):
+ def task_formatter(self, recipient, task, object_fragment=None):
full_task = self.get_object_by_phid(recipient, task['phid'], True)
details = []
details.append(
@@ -338,11 +347,15 @@
status = task['fields']['status']['name']
details.append('status: %s' % self.task_status_theme(status))
+ url = full_task['uri']
+ if object_fragment is not None:
+ url = '%s%s' % (url, object_fragment)
+
return "{id} ({details}): {title} <{url}>".format(
id=ircutils.bold('T%s' % task['id']),
title=task['fields']['name'],
details=', '.join(details),
- url=full_task['uri'],
+ url=url,
)
def commit_formatter(self, recipient, commit, skip_details=None):

File Metadata

Mime Type
text/plain
Expires
Thu, Jul 3, 3:22 PM (1 w, 2 h ago)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
3232436

Event Timeline