[PATCH 3 of 3] amend: add -D/--current-date option, just like mq's qrefresh has

Pierre-Yves David pierre-yves.david at ens-lyon.org
Thu Jun 5 20:38:59 CDT 2014


You forgot the evolve-ext flag…

On 06/05/2014 06:34 PM, Greg Ward wrote:
> # HG changeset patch
> # User Greg Ward <greg at gerg.ca>
> # Date 1402018075 14400
> #      Thu Jun 05 21:27:55 2014 -0400
> # Node ID 66468b1c62d53b16bf0f003c962b90d9314f1d51
> # Parent  a3332548e7fb4c18815ecaf1b608f320b6f6d1f2
> amend: add -D/--current-date option, just like mq's qrefresh has

\o/

> diff --git a/hgext/evolve.py b/hgext/evolve.py
> --- a/hgext/evolve.py
> +++ b/hgext/evolve.py
> @@ -325,6 +325,15 @@
>   ### experimental behavior                                         ###
>   #####################################################################
>
> +commitopts3 = [
> +    ('D', 'current-date', None,
> +     _('record the current date as commit date')),
> +]
> +
> +def _tweakcommitopts(opts):
> +    if not opts.get('date') and opts.get('current_date'):
> +        opts['date'] = '%d %d' % util.makedate()

We want a docstring for _tweakcommitopts

> +
>   @eh.wrapfunction(mercurial.obsolete, 'createmarkers')
>   def _createmarkers(orig, repo, relations, *args, **kwargs):
>       """register parent information at prune time"""
> @@ -1795,7 +1804,7 @@
>       ('', 'close-branch', None,
>        _('mark a branch as closed, hiding it from the branch list')),
>       ('s', 'secret', None, _('use the secret phase for committing')),
> -    ] + walkopts + commitopts + commitopts2,
> +    ] + walkopts + commitopts + commitopts2 + commitopts3,
>       _('[OPTION]... [FILE]...'))
>   def amend(ui, repo, *pats, **opts):
>       """combine a changeset with updates and replace it with a new one
> @@ -1820,6 +1829,7 @@
>       opts['amend'] = True
>       if not (edit or opts['message']):
>           opts['message'] = repo['.'].description()
> +    _tweakcommitopts(opts)

The name is opaque enough so that read has no idea what is going on… We 
should find a better name to that function.

>       _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
> @@ -83,3 +83,12 @@
>     $ hg parents --template '{rev}  {date|date}\n'
>     5  Sat Feb 03 04:05:06 2001 +0700
>
> +Specify "now" as commit date with -D
> +  $ before=`date +%s`
> +  $ hg amend -D
> +  $ commit=`hg parents --template '{date|hgdate} rev{rev}\n'`
> +  $ after=`date +%s`
> +  $ (echo $before ; echo $commit; echo $after) | sort -k1 -n -s
> +  \d+ (re)
> +  \d+ 0 rev6 (re)
> +  \d+ (re)
>

-- 
Pierre-Yves David


More information about the Mercurial-devel mailing list