D6082: phabricator: add a `--branch` flag to `hg phabsend`
pulkit (Pulkit Goyal)
phabricator at mercurial-scm.org
Mon Mar 18 17:07:47 EDT 2019
pulkit updated this revision to Diff 14548.
REPOSITORY
rHG Mercurial
CHANGES SINCE LAST UPDATE
https://phab.mercurial-scm.org/D6082?vs=14384&id=14548
REVISION DETAIL
https://phab.mercurial-scm.org/D6082
AFFECTED FILES
hgext/phabricator.py
CHANGE DETAILS
diff --git a/hgext/phabricator.py b/hgext/phabricator.py
--- a/hgext/phabricator.py
+++ b/hgext/phabricator.py
@@ -483,6 +483,7 @@
@vcrcommand(b'phabsend',
[(b'r', b'rev', [], _(b'revisions to send'), _(b'REV')),
+ (b'', b'branch', b'', _(b'comments review is for specific branch')),
(b'', b'amend', True, _(b'update commit messages')),
(b'', b'reviewer', [], _(b'specify reviewers')),
(b'', b'confirm', None, _(b'ask for confirmation before sending'))],
@@ -514,6 +515,15 @@
phabsend will check obsstore and the above association to decide whether to
update an existing Differential Revision, or create a new one.
+
+ When working with multiple named branches, one can specify which branch your
+ reviews/differentials are intended for using --branch flag. Doing that,
+ phabsend will add a comment to your differential about that. For example::
+
+ `hg phabsend -r . --branch stable`
+
+ This will upload the parent of working directory and will add a comment on
+ related differential saying "This review is intented for stable branch".
"""
opts = pycompat.byteskwargs(opts)
revs = list(revs) + opts.get(b'rev', [])
@@ -543,6 +553,10 @@
drevids = [] # [int]
diffmap = {} # {newnode: diff}
+ bmsg = None
+ if opts.get(b'branch'):
+ bmsg = b"This review is intended for `%s` branch." % opts[b'branch']
+
# Send patches one by one so we know their Differential Revision IDs and
# can provide dependency relationship
lastrevid = None
@@ -589,6 +603,12 @@
drevids.append(newrevid)
lastrevid = newrevid
+ if bmsg:
+ # comment on the new differential created the this review is for
+ # this certain branch
+ callconduit(repo, b'differential.createcomment',
+ {b'revision_id': newrevid, b'message': bmsg})
+
# Update commit messages and remove tags
if opts.get(b'amend'):
unfi = repo.unfiltered()
To: pulkit, #hg-reviewers
Cc: indygreg, Kwan, mharbison72, mercurial-devel
More information about the Mercurial-devel
mailing list