[PATCH] log: prevent negative date range from displaying entire log (issue1805)

Christian Ebert blacktrash at gmx.net
Fri Sep 4 04:58:07 CDT 2009


Hi Dirkjan,

Out of laziness I've hijacked your fix. Up to you to hijack the
copyright back ;-)

Also, I've refrained from adding a comment like "should not
output anything" in test-log, as the rest of the script seems
very terse too.

c


# HG changeset patch
# User Christian Ebert <blacktrash at gmx.net>
# Date 1252057888 -7200
# Node ID e9a05182f55aa98342c68b60ae71e1a470e3181c
# Parent  d0db168136dc0612cc63f877ced0201cf1053357
log: prevent negative date range from displaying entire log (issue1805)

diff --git a/mercurial/commands.py b/mercurial/commands.py
--- a/mercurial/commands.py
+++ b/mercurial/commands.py
@@ -2044,7 +2044,7 @@
             if only_branches and ctx.branch() not in only_branches:
                 continue
 
-            if df and not df(ctx.date()):
+            if df and not df(ctx.date()[0]):
                 continue
 
             if opts.get('keyword'):
diff --git a/tests/test-log b/tests/test-log
--- a/tests/test-log
+++ b/tests/test-log
@@ -107,6 +107,9 @@
 echo '% log -k r1'
 hg log -k r1
 
+echo '% log -d -1'
+hg log -d -1
+
 cd ..
 
 hg init usertest
diff --git a/tests/test-log.out b/tests/test-log.out
--- a/tests/test-log.out
+++ b/tests/test-log.out
@@ -245,6 +245,7 @@
 date:        Thu Jan 01 00:00:01 1970 +0000
 summary:     r1
 
+% log -d -1
 adding a
 adding b
 changeset:   0:29a4c94f1924


More information about the Mercurial-devel mailing list