Patchwork [STABLE] test-command-template.t: make "age" filter test work on Feb 29th

login
register
mail settings
Submitter Benoit Boissinot
Date Jan. 2, 2013, 1 p.m.
Message ID <3b1005354440baa44820.1357131624@pouchy.lan>
Download mbox | patch
Permalink /patch/366/
State Accepted
Commit 3b1005354440baa448207057149d8ba8765fe082
Headers show

Comments

Benoit Boissinot - Jan. 2, 2013, 1 p.m.
# HG changeset patch
# User Benoit Boissinot <benoit.boissinot at ens-lyon.org>
# Date 1357131547 -3600
# Branch stable
# Node ID 3b1005354440baa448207057149d8ba8765fe082
# Parent  cd64a8a2d0da5178de30105ff69ccff32a73a536
test-command-template.t: make "age" filter test work on Feb 29th

reported by Julien Cristau.
Pierre-Yves David - Jan. 3, 2013, 2:13 p.m.
On Wed, Jan 02, 2013 at 02:00:24PM +0100, Benoit Boissinot wrote:
> # HG changeset patch
> # User Benoit Boissinot <benoit.boissinot at ens-lyon.org>
> # Date 1357131547 -3600
> # Branch stable
> # Node ID 3b1005354440baa448207057149d8ba8765fe082
> # Parent  cd64a8a2d0da5178de30105ff69ccff32a73a536
> test-command-template.t: make "age" filter test work on Feb 29th
> 
> reported by Julien Cristau.
> 
> diff --git a/tests/test-command-template.t b/tests/test-command-template.t
> --- a/tests/test-command-template.t
> +++ b/tests/test-command-template.t
> @@ -1346,10 +1346,10 @@
>  
>    $ hg log --template '{date|age}\n' > /dev/null || exit 1
>  
> -  >>> from datetime import datetime
> +  >>> from datetime import datetime, timedelta
>    >>> fp = open('a', 'w')
> -  >>> n = datetime.now()
> -  >>> fp.write('%d-%d-%d 00:00' % ((n.year + 7), n.month, n.day))
> +  >>> n = datetime.now() + timedelta(366 * 7)
> +  >>> fp.write('%d-%d-%d 00:00' % (n.year, n.month, n.day))
>    >>> fp.close()
>    $ hg add a
>    $ hg commit -m future -d "`cat a`"

LGTM
Augie Fackler - Jan. 3, 2013, 2:25 p.m.
This LGTM (way better fix than mine!), but my ssh keys for pushing are at home, so I'll not push it just yet. If someone else can push it in the interim, feel encouraged to do so.

On Jan 2, 2013, at 8:00 AM, Benoit Boissinot <benoit.boissinot at ens-lyon.org> wrote:

> # HG changeset patch
> # User Benoit Boissinot <benoit.boissinot at ens-lyon.org>
> # Date 1357131547 -3600
> # Branch stable
> # Node ID 3b1005354440baa448207057149d8ba8765fe082
> # Parent  cd64a8a2d0da5178de30105ff69ccff32a73a536
> test-command-template.t: make "age" filter test work on Feb 29th
> 
> reported by Julien Cristau.
> 
> diff --git a/tests/test-command-template.t b/tests/test-command-template.t
> --- a/tests/test-command-template.t
> +++ b/tests/test-command-template.t
> @@ -1346,10 +1346,10 @@
> 
>   $ hg log --template '{date|age}\n' > /dev/null || exit 1
> 
> -  >>> from datetime import datetime
> +  >>> from datetime import datetime, timedelta
>>>> fp = open('a', 'w')
> -  >>> n = datetime.now()
> -  >>> fp.write('%d-%d-%d 00:00' % ((n.year + 7), n.month, n.day))
> +  >>> n = datetime.now() + timedelta(366 * 7)
> +  >>> fp.write('%d-%d-%d 00:00' % (n.year, n.month, n.day))
>>>> fp.close()
>   $ hg add a
>   $ hg commit -m future -d "`cat a`"
Benoit Boissinot - Jan. 3, 2013, 9:54 p.m.
FYI, pushed.


On Thu, Jan 3, 2013 at 3:25 PM, Augie Fackler <raf at durin42.com> wrote:

> This LGTM (way better fix than mine!), but my ssh keys for pushing are at
> home, so I'll not push it just yet. If someone else can push it in the
> interim, feel encouraged to do so.
>
> On Jan 2, 2013, at 8:00 AM, Benoit Boissinot <
> benoit.boissinot at ens-lyon.org> wrote:
>
> > # HG changeset patch
> > # User Benoit Boissinot <benoit.boissinot at ens-lyon.org>
> > # Date 1357131547 -3600
> > # Branch stable
> > # Node ID 3b1005354440baa448207057149d8ba8765fe082
> > # Parent  cd64a8a2d0da5178de30105ff69ccff32a73a536
> > test-command-template.t: make "age" filter test work on Feb 29th
> >
> > reported by Julien Cristau.
> >
> > diff --git a/tests/test-command-template.t
> b/tests/test-command-template.t
> > --- a/tests/test-command-template.t
> > +++ b/tests/test-command-template.t
> > @@ -1346,10 +1346,10 @@
> >
> >   $ hg log --template '{date|age}\n' > /dev/null || exit 1
> >
> > -  >>> from datetime import datetime
> > +  >>> from datetime import datetime, timedelta
> >>>> fp = open('a', 'w')
> > -  >>> n = datetime.now()
> > -  >>> fp.write('%d-%d-%d 00:00' % ((n.year + 7), n.month, n.day))
> > +  >>> n = datetime.now() + timedelta(366 * 7)
> > +  >>> fp.write('%d-%d-%d 00:00' % (n.year, n.month, n.day))
> >>>> fp.close()
> >   $ hg add a
> >   $ hg commit -m future -d "`cat a`"
>
> _______________________________________________
> Mercurial-devel mailing list
> Mercurial-devel at selenic.com
> http://selenic.com/mailman/listinfo/mercurial-devel
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://selenic.com/pipermail/mercurial-devel/attachments/20130103/44a755fd/attachment.html>

Patch

diff --git a/tests/test-command-template.t b/tests/test-command-template.t
--- a/tests/test-command-template.t
+++ b/tests/test-command-template.t
@@ -1346,10 +1346,10 @@ 
 
   $ hg log --template '{date|age}\n' > /dev/null || exit 1
 
-  >>> from datetime import datetime
+  >>> from datetime import datetime, timedelta
   >>> fp = open('a', 'w')
-  >>> n = datetime.now()
-  >>> fp.write('%d-%d-%d 00:00' % ((n.year + 7), n.month, n.day))
+  >>> n = datetime.now() + timedelta(366 * 7)
+  >>> fp.write('%d-%d-%d 00:00' % (n.year, n.month, n.day))
   >>> fp.close()
   $ hg add a
   $ hg commit -m future -d "`cat a`"