dates: Fix bare times to be relative to "today"
authorMatt Mackall <mpm@selenic.com>
Tue, 11 Mar 2008 17:42:51 -0500
changeset 6230 c7253d1a774e
parent 6229 c3182eeb70ea
child 6233 14a4fdf9037f
dates: Fix bare times to be relative to "today"
mercurial/util.py
--- a/mercurial/util.py	Tue Mar 11 17:42:41 2008 -0500
+++ b/mercurial/util.py	Tue Mar 11 17:42:51 2008 -0500
@@ -1586,7 +1586,7 @@
     """
     if not date:
         return 0, 0
-    if type(date) is type((0, 0)) and len(date) == 2:
+    if isinstance(date, tuple) and len(date) == 2:
         return date
     if not formats:
         formats = defaultdateformats
@@ -1602,8 +1602,6 @@
             if part not in defaults:
                 if part[0] in "HMS":
                     defaults[part] = "00"
-                elif part[0] in "dm":
-                    defaults[part] = "1"
                 else:
                     defaults[part] = datestr(now, "%" + part[0])
 
@@ -1640,7 +1638,8 @@
     """
 
     def lower(date):
-        return parsedate(date, extendeddateformats)[0]
+        d = dict(mb="1", d="1")
+        return parsedate(date, extendeddateformats, d)[0]
 
     def upper(date):
         d = dict(mb="12", HI="23", M="59", S="59")