changeset 3813: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 120be84f33de 6099cfa7c4aa
files mercurial/commands.py mercurial/util.py
diffstat 2 files changed, 12 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/commands.py	Wed Dec 06 15:11:44 2006 -0600
+++ b/mercurial/commands.py	Wed Dec 06 15:29:17 2006 -0600
@@ -1527,6 +1527,11 @@
             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 @@
             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 @@
            _('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	Wed Dec 06 15:11:44 2006 -0600
+++ b/mercurial/util.py	Wed Dec 06 15:29:17 2006 -0600
@@ -1185,7 +1185,7 @@
         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)