Re: [PATCH 2 of 2] phabricator: add a config knob for `phabsend --amend`

2018-05-17 Thread Matt Harbison

On Thu, 17 May 2018 07:51:31 -0400, Yuya Nishihara  wrote:


On Wed, 16 May 2018 23:03:59 -0400, Matt Harbison wrote:

# HG changeset patch
# User Matt Harbison 
# 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')


Looks like --amend is on by default. We'll need a weird tri-state logic
to support --no-amend to override the config value.


Oops.  IDK what I was thinking.

I wonder if we should drop --amend, and just make it a config knob to  
avoid the tri-state.  But I'll wait on that until I get more experience  
using it.

___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


Re: [PATCH 2 of 2] phabricator: add a config knob for `phabsend --amend`

2018-05-17 Thread Yuya Nishihara
On Wed, 16 May 2018 23:03:59 -0400, Matt Harbison wrote:
> # HG changeset patch
> # User Matt Harbison 
> # 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')

Looks like --amend is on by default. We'll need a weird tri-state logic
to support --no-amend to override the config value.
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel