[PATCH evolve_ext] amend: add -U/--current-user option (inspired by mq)

Pierre-Yves David pierre-yves.david at ens-lyon.org
Mon Jun 23 04:08:09 CDT 2014



On 06/22/2014 09:01 AM, Greg Ward wrote:
> # HG changeset patch
> # User Greg Ward <greg at gerg.ca>
> # Date 1403452871 14400
> #      Sun Jun 22 12:01:11 2014 -0400
> # Node ID 2fbba0bf7e7c8cbff1f94bc95c4d6214df85ef81
> # Parent  db4f29a727ccd2d5ac7d7383ab4912ad75ae55cc
> amend: add -U/--current-user option (inspired by mq)

Pushed after a README update.


>
> diff --git a/hgext/evolve.py b/hgext/evolve.py
> --- a/hgext/evolve.py
> +++ b/hgext/evolve.py
> @@ -328,9 +328,11 @@
>   commitopts3 = [
>       ('D', 'current-date', None,
>        _('record the current date as commit date')),
> +    ('U', 'current-user', None,
> +     _('record the current user as committer')),
>   ]
>
> -def _resolveoptions(opts):
> +def _resolveoptions(ui, opts):
>       """modify commit options dict to handle related options
>
>       For now, all it does is figure out the commit date: respect -D unless
> @@ -339,6 +341,8 @@
>       # N.B. this is extremely similar to setupheaderopts() in mq.py
>       if not opts.get('date') and opts.get('current_date'):
>           opts['date'] = '%d %d' % util.makedate()
> +    if not opts.get('user') and opts.get('current_user'):
> +        opts['user'] = ui.username()
>
>   @eh.wrapfunction(mercurial.obsolete, 'createmarkers')
>   def _createmarkers(orig, repo, relations, *args, **kwargs):
> @@ -1842,7 +1846,7 @@
>       opts['amend'] = True
>       if not (edit or opts['message']):
>           opts['message'] = repo['.'].description()
> -    _resolveoptions(opts)
> +    _resolveoptions(ui, opts)
>       _alias, commitcmd = cmdutil.findcmd('commit', commands.table)
>       return commitcmd[0](ui, repo, *pats, **opts)
>
> diff --git a/tests/test-amend.t b/tests/test-amend.t
> --- a/tests/test-amend.t
> +++ b/tests/test-amend.t
> @@ -92,3 +92,8 @@
>     \d+ (re)
>     \d+ 0 rev6 (re)
>     \d+ (re)
> +
> +Specify current user as committer with -U
> +  $ HGUSER=newbie hg amend -U
> +  $ hg parents --template '{rev}  {author}\n'
> +  7  newbie
> _______________________________________________
> Mercurial-devel mailing list
> Mercurial-devel at selenic.com
> http://selenic.com/mailman/listinfo/mercurial-devel
>

-- 
Pierre-Yves David


More information about the Mercurial-devel mailing list