Patchwork D6512: phabricator: add a --blocker argument to phabsend to specify blocking reviewers

login
register
mail settings
Submitter phabricator
Date June 11, 2019, 6:28 p.m.
Message ID <differential-rev-PHID-DREV-ti6ioebug7phov2zsirm-req@mercurial-scm.org>
Download mbox | patch
Permalink /patch/40430/
State Superseded
Headers show

Comments

phabricator - June 11, 2019, 6:28 p.m.
Kwan created this revision.
Kwan added reviewers: durin42, mharbison72.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.

REVISION SUMMARY
  The way to signal to Conduit that a reviewer is considered blocking is just to
  wrap their PHID in "blocking()" when including it in the list of PHIDs passed
  to `reviewers.add`.
  
  arc doesn't have a --blocker, instead one is supposed to append a '!' to the
  end of reviewer names (I think reviewers are usually added in an editor rather
  than the command line, where '!'s can be more hazardous).
  
  moz-phab (Mozilla's arcanist wrapper) does have a --blocker argument, and being
  explicit like this is also more discoverable. Even `arc diff`'s help doesn't
  seem to mention the reviewer! syntax.

REPOSITORY
  rHG Mercurial

REVISION DETAIL
  https://phab.mercurial-scm.org/D6512

AFFECTED FILES
  hgext/phabricator.py

CHANGE DETAILS




To: Kwan, durin42, mharbison72, #hg-reviewers
Cc: mercurial-devel
phabricator - June 12, 2019, 4:37 p.m.
mharbison72 added a comment.
mharbison72 accepted this revision.


  LGTM.  Thanks for doing this.

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST ACTION
  https://phab.mercurial-scm.org/D6512/new/

REVISION DETAIL
  https://phab.mercurial-scm.org/D6512

To: Kwan, durin42, mharbison72, #hg-reviewers
Cc: mercurial-devel

Patch

diff --git a/hgext/phabricator.py b/hgext/phabricator.py
--- a/hgext/phabricator.py
+++ b/hgext/phabricator.py
@@ -500,6 +500,7 @@ 
          [(b'r', b'rev', [], _(b'revisions to send'), _(b'REV')),
           (b'', b'amend', True, _(b'update commit messages')),
           (b'', b'reviewer', [], _(b'specify reviewers')),
+          (b'', b'blocker', [], _(b'specify blocking reviewers')),
           (b'm', b'comment', b'',
            _(b'add a comment to Revisions with new/updated Diffs')),
           (b'', b'confirm', None, _(b'ask for confirmation before sending'))],
@@ -553,8 +554,15 @@ 
 
     actions = []
     reviewers = opts.get(b'reviewer', [])
+    blockers = opts.get(b'blocker', [])
+    phids = []
     if reviewers:
-        phids = userphids(repo, reviewers)
+        phids.extend(userphids(repo, reviewers))
+    if blockers:
+        phids.extend(map(
+            lambda phid: b'blocking(%s)' % phid, userphids(repo, blockers)
+        ))
+    if phids:
         actions.append({b'type': b'reviewers.add', b'value': phids})
 
     drevids = [] # [int]