phabdiff: allow reviewers to be used as a string

Summary: It was a list. Make it possible to use it as a string.

Reviewed By: xavierd

Differential Revision: D20144811

fbshipit-source-id: b280c0344215a4c23ab9c63d89f47adf34fb06f3
This commit is contained in:
Jun Wu 2020-02-27 19:18:49 -08:00 committed by Facebook Github Bot
parent d21bdf7e1b
commit b1f8456309
2 changed files with 5 additions and 1 deletions

View File

@ -59,5 +59,7 @@ def showreviewers(repo, ctx, templ, **args):
descr = ctx.description()
match = re.search("Reviewers:(.*)", descr)
if match:
reviewers = filter(None, re.split(r"[\s,]", match.group(1)))
reviewers = list(filter(None, re.split(r"[\s,]", match.group(1))))
args = args.copy()
args["templ"] = " ".join(reviewers)
return templatekw.showlist("reviewer", reviewers, args)

View File

@ -48,6 +48,8 @@ Test reviewers label
$ echo f > f
$ hg commit -Aqm "Differential Revision: http://phabricator.intern.facebook.com/D9876
> Reviewers: xlwang, quark durham, rmcelroy"
$ hg log -r . --template '{reviewers}\n'
xlwang quark durham rmcelroy
$ hg log -r . --template '{reviewers % "- {reviewer}\n"}\n'
- xlwang
- quark