Mercurial > public > mercurial-scm > hg
diff hgext/phabricator.py @ 42431:29528c4235a1
phabricator: add commenting to phabsend for new/updated Diffs
Especially useful when sending updates to existing Revisions so one can specify
the sort of changes e.g. "Address review comments" or "Rebase to tip"
If the diff content hasn't changed then it only needs a metadata update which
doesn't show in the Phabricator updates UI, so don't add a comment that will.
Differential Revision: https://phab.mercurial-scm.org/D6496
author | Ian Moody <moz-ian@perix.co.uk> |
---|---|
date | Fri, 07 Jun 2019 20:19:55 +0100 |
parents | af13e2088f77 |
children | 500b64c5d991 |
line wrap: on
line diff
--- a/hgext/phabricator.py Wed Jun 05 22:09:26 2019 +0300 +++ b/hgext/phabricator.py Fri Jun 07 20:19:55 2019 +0100 @@ -416,7 +416,7 @@ callconduit(ctx.repo(), b'differential.setdiffproperty', params) def createdifferentialrevision(ctx, revid=None, parentrevid=None, oldnode=None, - olddiff=None, actions=None): + olddiff=None, actions=None, comment=None): """create or update a Differential Revision If revid is None, create a new Differential Revision, otherwise update @@ -439,6 +439,8 @@ if neednewdiff: diff = creatediff(ctx) transactions.append({b'type': b'update', b'value': diff[b'phid']}) + if comment: + transactions.append({b'type': b'comment', b'value': comment}) else: # Even if we don't need to upload a new diff because the patch content # does not change. We might still need to update its metadata so @@ -497,6 +499,8 @@ [(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'm', b'comment', b'', + _(b'add a comment to Revisions with new/updated Diffs')), (b'', b'confirm', None, _(b'ask for confirmation before sending'))], _(b'REV [OPTIONS]'), helpcategory=command.CATEGORY_IMPORT_EXPORT) @@ -567,7 +571,8 @@ if oldnode != ctx.node() or opts.get(b'amend'): # Create or update Differential Revision revision, diff = createdifferentialrevision( - ctx, revid, lastrevid, oldnode, olddiff, actions) + ctx, revid, lastrevid, oldnode, olddiff, actions, + opts.get(b'comment')) diffmap[ctx.node()] = diff newrevid = int(revision[b'object'][b'id']) if revid: