--- a/mercurial/help/dates.txt Sat Feb 09 15:38:57 2013 -0600
+++ b/mercurial/help/dates.txt Sat Feb 09 15:39:22 2013 -0600
@@ -20,6 +20,7 @@
- ``12/6/6`` (Dec 6 2006)
- ``today`` (midnight)
- ``yesterday`` (midnight)
+- ``now`` - right now
Lastly, there is Mercurial's internal format:
--- 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'):
--- a/tests/test-parse-date.t Sat Feb 09 15:38:57 2013 -0600
+++ b/tests/test-parse-date.t Sat Feb 09 15:39:22 2013 -0600
@@ -251,3 +251,8 @@
$ hg ci -d "`sed -n '2p' dates`" -m "the time traveler's code"
$ hg log -d yesterday --template '{desc}\n'
the time traveler's code
+ $ echo "foo" >> a
+ $ hg commit -d now -m 'Explicitly committed now.'
+ $ hg log -d today --template '{desc}\n'
+ Explicitly committed now.
+ today is a good day to code