[PATCH 2 of 2] phabricator: add a config knob for `phabsend --amend`
Matt Harbison
mharbison72 at gmail.com
Wed May 16 23:03:59 EDT 2018
# HG changeset patch
# User Matt Harbison <matt_harbison at yahoo.com>
# Date 1526525604 14400
# Wed May 16 22:53:24 2018 -0400
# Node ID 8c2bbfe099b44820f8722e873852d6bd5811c111
# Parent 8003050dd9ee58fbc1eceda17aec5332830e9da2
phabricator: add a config knob for `phabsend --amend`
Since it's useful for certain workflows, it seems reasonable to not have to
remember to specify it.
diff --git a/contrib/phabricator.py b/contrib/phabricator.py
--- a/contrib/phabricator.py
+++ b/contrib/phabricator.py
@@ -93,6 +93,9 @@ configitem('phabricator', 'repophid',
configitem('phabricator', 'url',
default=None,
)
+configitem('phabsend', 'amend',
+ default=False,
+)
configitem('phabsend', 'confirm',
default=False,
)
@@ -473,7 +476,12 @@ def phabsend(ui, repo, *revs, **opts):
If --amend is set, update commit messages so they have the
``Differential Revision`` URL, remove related tags. This is similar to what
arcanist will do, and is more desired in author-push workflows. Otherwise,
- use local tags to record the ``Differential Revision`` association.
+ use local tags to record the ``Differential Revision`` association. You
+ can also add following to your configuration file to make it default
+ behaviour::
+
+ [phabsend]
+ amend = true
The --confirm option lets you confirm changesets before sending them. You
can also add following to your configuration file to make it default
@@ -490,7 +498,8 @@ def phabsend(ui, repo, *revs, **opts):
if not revs:
raise error.Abort(_('phabsend requires at least one changeset'))
- if opts.get('amend'):
+ amend = opts.get('amend') or ui.configbool('phabsend', 'amend')
+ if amend:
cmdutil.checkunfinished(repo)
# {newnode: (oldnode, olddiff, olddrev}
@@ -521,7 +530,7 @@ def phabsend(ui, repo, *revs, **opts):
# Get Differential Revision ID
oldnode, olddiff, revid = oldmap.get(ctx.node(), (None, None, None))
- if oldnode != ctx.node() or opts.get('amend'):
+ if oldnode != ctx.node() or amend:
# Create or update Differential Revision
revision, diff = createdifferentialrevision(
ctx, revid, lastrevid, oldnode, olddiff, actions)
@@ -559,7 +568,7 @@ def phabsend(ui, repo, *revs, **opts):
lastrevid = newrevid
# Update commit messages and remove tags
- if opts.get('amend'):
+ if amend:
unfi = repo.unfiltered()
drevs = callconduit(repo, 'differential.query', {'ids': drevids})
with repo.wlock(), repo.lock(), repo.transaction('phabsend'):
More information about the Mercurial-devel
mailing list