comparison mercurial/debugcommands.py @ 30516:ef1353c283e3

debugcommands: move 'debugdate' in the new module
author Gregory Szorc <gregory.szorc@gmail.com>
date Wed, 17 Aug 2016 20:43:31 -0700
parents cdd1885d0f2f
children a3ec6db36315
comparison
equal deleted inserted replaced
30515:cdd1885d0f2f 30516:ef1353c283e3
26 lock as lockmod, 26 lock as lockmod,
27 revlog, 27 revlog,
28 scmutil, 28 scmutil,
29 simplemerge, 29 simplemerge,
30 streamclone, 30 streamclone,
31 util,
31 ) 32 )
32 33
33 release = lockmod.release 34 release = lockmod.release
34 35
35 # We reuse the command table from commands because it is easier than 36 # We reuse the command table from commands because it is easier than
432 r = cmdutil.openrevlog(repo, 'debugdata', file_, opts) 433 r = cmdutil.openrevlog(repo, 'debugdata', file_, opts)
433 try: 434 try:
434 ui.write(r.revision(r.lookup(rev))) 435 ui.write(r.revision(r.lookup(rev)))
435 except KeyError: 436 except KeyError:
436 raise error.Abort(_('invalid revision identifier %s') % rev) 437 raise error.Abort(_('invalid revision identifier %s') % rev)
438
439 @command('debugdate',
440 [('e', 'extended', None, _('try extended date formats'))],
441 _('[-e] DATE [RANGE]'),
442 norepo=True, optionalrepo=True)
443 def debugdate(ui, date, range=None, **opts):
444 """parse and display a date"""
445 if opts["extended"]:
446 d = util.parsedate(date, util.extendeddateformats)
447 else:
448 d = util.parsedate(date)
449 ui.write(("internal: %s %s\n") % d)
450 ui.write(("standard: %s\n") % util.datestr(d))
451 if range:
452 m = util.matchdate(range)
453 ui.write(("match: %s\n") % m(d[0]))