changeset 3816:fc5ba0ab7f45

Add --date support to log Add --date opt Filter log with matchdate Fix "-{days}" match format
author Matt Mackall <mpm@selenic.com>
date Wed, 06 Dec 2006 15:29:17 -0600
parents bf6ab30559e6
children 6099cfa7c4aa 120be84f33de
files mercurial/commands.py mercurial/util.py
diffstat 2 files changed, 12 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/commands.py
+++ b/mercurial/commands.py
@@ -1527,6 +1527,11 @@ def log(ui, repo, *pats, **opts):
             return ncache[fn].get(dcache[1][fn])
         return None
 
+    df = False
+    if opts["date"]:
+        df = util.matchdate(opts["date"])
+
+
     displayer = cmdutil.show_changeset(ui, repo, opts, buffered=True)
     for st, rev, fns in changeiter:
         if st == 'add':
@@ -1538,6 +1543,11 @@ def log(ui, repo, *pats, **opts):
             if opts['only_merges'] and len(parents) != 2:
                 continue
 
+            if df:
+                changes = get(rev)
+                if not df(changes[2][0]):
+                    continue
+
             if opts['keyword']:
                 changes = get(rev)
                 miss = 0
@@ -2586,6 +2596,7 @@ table = {
            _('follow changeset history, or file history across copies and renames')),
           ('', 'follow-first', None,
            _('only follow the first parent of merge changesets')),
+          ('d', 'date', '', _('show revs matching date spec')),
           ('C', 'copies', None, _('show copied files')),
           ('k', 'keyword', [], _('search for a keyword')),
           ('l', 'limit', '', _('limit number of changes displayed')),
--- a/mercurial/util.py
+++ b/mercurial/util.py
@@ -1185,7 +1185,7 @@ def matchdate(date):
         except ValueError:
             raise Abort(_("invalid day spec: %s") % date[1:])
         when = makedate()[0] - days * 3600 * 24
-        return lambda x: x <= when
+        return lambda x: x >= when
     elif " to " in date:
         a, b = date.split(" to ")
         start, stop = lower(a), upper(b)