# HG changeset patch # User Matt Mackall # Date 1165440557 21600 # Node ID fc5ba0ab7f454f3d055086a5b2a1101fe9dd6841 # Parent bf6ab30559e6e6c6eb81ccec3ad865a2cd868780 Add --date support to log Add --date opt Filter log with matchdate Fix "-{days}" match format diff --git a/mercurial/commands.py b/mercurial/commands.py --- 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')), diff --git a/mercurial/util.py b/mercurial/util.py --- 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)