[PATCH 08 of 11] [RFC] Add a "--date-from FILE" option to some commands

Matt Mackall mpm at selenic.com
Mon Jun 25 10:41:10 CDT 2007


On Mon, Jun 25, 2007 at 02:50:45PM +0200, Markus F.X.J. Oberhumer wrote:
> # HG changeset patch
> # User Markus F.X.J. Oberhumer <markus at oberhumer.com>
> # Date 1182775580 -7200
> # Node ID 9dec45eed1ed8c6b818563aaa2bb233a611f5768
> # Parent  da57c9e729038e4e10db387905f39c180210b869
> [RFC] Add a "--date-from FILE" option to some commands.

What's this for?

> diff --git a/mercurial/commands.py b/mercurial/commands.py
> --- a/mercurial/commands.py
> +++ b/mercurial/commands.py
> @@ -13,6 +13,15 @@ import difflib, patch, time, help, mdiff
>  import difflib, patch, time, help, mdiff, tempfile
>  import errno, version, socket
>  import archival, changegroup, cmdutil, hgweb.server, sshserver
> +
> +def getxdate(opts):
> +    date = opts['date']
> +    if opts.get('date_from'):
> +        if date:
> +            raise util.Abort(_("cannot use both --date and --date-from!"))
> +        date = "%d 0" % int(os.path.getmtime(opts['date_from']))
> +##    if date: util.parsedate(date) # parse date early to catch errors ## FIXME
> +    return date

Helpers go in cmdutils these days.

-- 
Mathematics is the supreme nostalgia of our time.


More information about the Mercurial-devel mailing list