Mercurial > public > mercurial-scm > hg-stable
diff mercurial/util.py @ 18614:b2586e2cc67a
parsedate: understand "now" as a shortcut for the current time
author | Augie Fackler <raf@durin42.com> |
---|---|
date | Sat, 09 Feb 2013 15:39:22 -0600 |
parents | 2251b3184e6e |
children | 4034b8d551b1 |
line wrap: on
line diff
--- a/mercurial/util.py Sat Feb 09 15:38:57 2013 -0600 +++ b/mercurial/util.py Sat Feb 09 15:39:22 2013 -0600 @@ -1060,6 +1060,12 @@ datetime.timedelta(days=1)\ ).strftime('%b %d')) True + >>> now, tz = makedate() + >>> strnow, strtz = parsedate('now') + >>> (strnow - now) < 1 + True + >>> tz == strtz + True """ if not date: return 0, 0 @@ -1069,6 +1075,8 @@ formats = defaultdateformats date = date.strip() + if date == _('now'): + return makedate() if date == _('today'): date = datetime.date.today().strftime('%b %d') elif date == _('yesterday'):