Mercurial > public > mercurial-scm > hg-stable
diff mercurial/commands.py @ 3812:bf6ab30559e6
Add date matching support
Add extended date formats (eg "Dec", "2006")
Add a couple missing basic date formats
Improve default date element scheme to parsedate
Add matchdate function to match a date spec
Add -e switch and range matching to debugdate
author | Matt Mackall <mpm@selenic.com> |
---|---|
date | Wed, 06 Dec 2006 15:11:44 -0600 |
parents | 299d6cce6c0b |
children | fc5ba0ab7f45 |
line wrap: on
line diff
--- a/mercurial/commands.py Wed Dec 06 13:36:23 2006 -0600 +++ b/mercurial/commands.py Wed Dec 06 15:11:44 2006 -0600 @@ -788,11 +788,17 @@ except KeyError: raise util.Abort(_('invalid revision identifier %s') % rev) -def debugdate(ui, date): +def debugdate(ui, date, range=None, **opts): """parse and display a date""" - d = util.parsedate(date) + if opts["extended"]: + d = util.parsedate(date, util.extendeddateformats) + else: + d = util.parsedate(date) ui.write("internal: %s %s\n" % d) ui.write("standard: %s\n" % util.datestr(d)) + if range: + m = util.matchdate(range) + ui.write("match: %s\n" % m(d[0])) def debugindex(ui, file_): """dump the contents of an index file""" @@ -2483,7 +2489,9 @@ "debugcheckstate": (debugcheckstate, [], _('debugcheckstate')), "debugsetparents": (debugsetparents, [], _('debugsetparents REV1 [REV2]')), "debugstate": (debugstate, [], _('debugstate')), - "debugdate": (debugdate, [], _('debugdata DATE')), + "debugdate": (debugdate, + [('e','extended', None, _('try extended date formats'))], + _('debugdata [-e] DATE [RANGE]')), "debugdata": (debugdata, [], _('debugdata FILE REV')), "debugindex": (debugindex, [], _('debugindex FILE')), "debugindexdot": (debugindexdot, [], _('debugindexdot FILE')),