[PATCH] export: show 'Date' header in a format that also is readable for humans

Idan Kamara idankk86 at gmail.com
Sat Feb 9 03:34:53 CST 2013


On Sat, Feb 9, 2013 at 11:31 AM, Mads Kiilerich <mads at kiilerich.com> wrote:
>
> # HG changeset patch
> # User Mads Kiilerich <mads at kiilerich.com>
> # Date 1360360457 -3600
> # Node ID 055060daf58dbe46c667053cbb04409b202ee9cd
> # Parent  97761496c65ae836d6b0983a3f48959dd3112364
> export: show 'Date' header in a format that also is readable for humans
>
> 'export' is the official export format and used by patchbomb, but it would
> only
> show date as a timestamp that most humans might find it hard to relate to.
> It
> would be very convenient when reviewing a patch to be able to see what
> timestamp the patch will end up with.
>
> Mercurial has always used util.parsedate for parsing these headers. It can
> handle 'all' date formats, so we could just as well use a readable one.
>
> 'export' will now use the format used by 'log' - which is the format
> described
> as 'Unix date format' in the templating help. We assume that all parsers
> of '#
> HG changeset patch'es can handle that.
>
> diff --git a/mercurial/cmdutil.py b/mercurial/cmdutil.py
> --- a/mercurial/cmdutil.py
> +++ b/mercurial/cmdutil.py
> @@ -569,7 +569,7 @@
>
>          write("# HG changeset patch\n")
>          write("# User %s\n" % ctx.user())
> -        write("# Date %d %d\n" % ctx.date())
> +        write("# Date %s\n" % util.datestr(ctx.date()))
>          if branch and branch != 'default':
>              write("# Branch %s\n" % branch)
>          write("# Node ID %s\n" % hex(node))
> diff --git a/tests/test-alias.t b/tests/test-alias.t
> --- a/tests/test-alias.t
> +++ b/tests/test-alias.t
> @@ -180,7 +180,7 @@
>    $ cat 0.diff
>    # HG changeset patch
>    # User test
> -  # Date 0 0
> +  # Date Thu Jan 01 00:00:00 1970 +0000
>    # Node ID e63c23eaa88ae77967edcf4ea194d31167c478b0
>    # Parent  0000000000000000000000000000000000000000
>    foo
> @@ -224,7 +224,7 @@
>    2
>
>    $ hg tglog
> -  @  1:7e7f92de180e: 'bar'
> +  @  1:c199fc2b9f8e: 'bar'
>    |
>    o  0:e63c23eaa88a: 'foo'
>
> @@ -237,15 +237,15 @@
>        idalias idaliaslong idaliasshell identify import incoming init
>    [255]
>    $ hg id
> -  7e7f92de180e tip
> +  c199fc2b9f8e tip
>    $ hg ida
>    hg: command 'ida' is ambiguous:
>        idalias idaliaslong idaliasshell
>    [255]
>    $ hg idalias
> -  7e7f92de180e tip
> +  c199fc2b9f8e tip
>    $ hg idaliasl
> -  7e7f92de180e tip
> +  c199fc2b9f8e tip

How come the hashes changed here?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://selenic.com/pipermail/mercurial-devel/attachments/20130209/ecb06364/attachment.html>


More information about the Mercurial-devel mailing list