comparison hgext/phabricator.py @ 42444:f33d3ee110da

phabricator: add --blocker argument to phabsend to specify blocking reviewers 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. Differential Revision: https://phab.mercurial-scm.org/D6512
author Ian Moody <moz-ian@perix.co.uk>
date Tue, 11 Jun 2019 19:52:16 +0100
parents d3c81439e2ee
children c19d259fd6ad
comparison
equal deleted inserted replaced
42443:d3c81439e2ee 42444:f33d3ee110da
513 513
514 @vcrcommand(b'phabsend', 514 @vcrcommand(b'phabsend',
515 [(b'r', b'rev', [], _(b'revisions to send'), _(b'REV')), 515 [(b'r', b'rev', [], _(b'revisions to send'), _(b'REV')),
516 (b'', b'amend', True, _(b'update commit messages')), 516 (b'', b'amend', True, _(b'update commit messages')),
517 (b'', b'reviewer', [], _(b'specify reviewers')), 517 (b'', b'reviewer', [], _(b'specify reviewers')),
518 (b'', b'blocker', [], _(b'specify blocking reviewers')),
518 (b'm', b'comment', b'', 519 (b'm', b'comment', b'',
519 _(b'add a comment to Revisions with new/updated Diffs')), 520 _(b'add a comment to Revisions with new/updated Diffs')),
520 (b'', b'confirm', None, _(b'ask for confirmation before sending'))], 521 (b'', b'confirm', None, _(b'ask for confirmation before sending'))],
521 _(b'REV [OPTIONS]'), 522 _(b'REV [OPTIONS]'),
522 helpcategory=command.CATEGORY_IMPORT_EXPORT) 523 helpcategory=command.CATEGORY_IMPORT_EXPORT)
566 if not confirmed: 567 if not confirmed:
567 raise error.Abort(_(b'phabsend cancelled')) 568 raise error.Abort(_(b'phabsend cancelled'))
568 569
569 actions = [] 570 actions = []
570 reviewers = opts.get(b'reviewer', []) 571 reviewers = opts.get(b'reviewer', [])
572 blockers = opts.get(b'blocker', [])
573 phids = []
571 if reviewers: 574 if reviewers:
572 phids = userphids(repo, reviewers) 575 phids.extend(userphids(repo, reviewers))
576 if blockers:
577 phids.extend(map(
578 lambda phid: b'blocking(%s)' % phid, userphids(repo, blockers)
579 ))
580 if phids:
573 actions.append({b'type': b'reviewers.add', b'value': phids}) 581 actions.append({b'type': b'reviewers.add', b'value': phids})
574 582
575 drevids = [] # [int] 583 drevids = [] # [int]
576 diffmap = {} # {newnode: diff} 584 diffmap = {} # {newnode: diff}
577 585