comparison mercurial/debugcommands.py @ 36607:c6061cadb400

util: extract all date-related utils in utils/dateutil module With this commit, util.py lose 262 lines Note for extensions author, if this commit breaks your extension, you can pull the step-by-step split here to help you more easily pinpoint the renaming that broke your extension: hg pull https://bitbucket.org/octobus/mercurial-devel/ -r ac1f6453010d Differential Revision: https://phab.mercurial-scm.org/D2282
author Boris Feld <boris.feld@octobus.net>
date Thu, 15 Feb 2018 17:18:26 +0100
parents dfcf589a4031
children 390d16ea7c76
comparison
equal deleted inserted replaced
36606:4de15c54e59f 36607:c6061cadb400
75 url as urlmod, 75 url as urlmod,
76 util, 76 util,
77 vfs as vfsmod, 77 vfs as vfsmod,
78 wireprotoserver, 78 wireprotoserver,
79 ) 79 )
80 from .utils import dateutil
80 81
81 release = lockmod.release 82 release = lockmod.release
82 83
83 command = registrar.command() 84 command = registrar.command()
84 85
558 _('[-e] DATE [RANGE]'), 559 _('[-e] DATE [RANGE]'),
559 norepo=True, optionalrepo=True) 560 norepo=True, optionalrepo=True)
560 def debugdate(ui, date, range=None, **opts): 561 def debugdate(ui, date, range=None, **opts):
561 """parse and display a date""" 562 """parse and display a date"""
562 if opts[r"extended"]: 563 if opts[r"extended"]:
563 d = util.parsedate(date, util.extendeddateformats) 564 d = dateutil.parsedate(date, util.extendeddateformats)
564 else: 565 else:
565 d = util.parsedate(date) 566 d = dateutil.parsedate(date)
566 ui.write(("internal: %d %d\n") % d) 567 ui.write(("internal: %d %d\n") % d)
567 ui.write(("standard: %s\n") % util.datestr(d)) 568 ui.write(("standard: %s\n") % dateutil.datestr(d))
568 if range: 569 if range:
569 m = util.matchdate(range) 570 m = dateutil.matchdate(range)
570 ui.write(("match: %s\n") % m(d[0])) 571 ui.write(("match: %s\n") % m(d[0]))
571 572
572 @command('debugdeltachain', 573 @command('debugdeltachain',
573 cmdutil.debugrevlogopts + cmdutil.formatteropts, 574 cmdutil.debugrevlogopts + cmdutil.formatteropts,
574 _('-c|-m|FILE'), 575 _('-c|-m|FILE'),
1576 try: 1577 try:
1577 tr = repo.transaction('debugobsolete') 1578 tr = repo.transaction('debugobsolete')
1578 try: 1579 try:
1579 date = opts.get('date') 1580 date = opts.get('date')
1580 if date: 1581 if date:
1581 date = util.parsedate(date) 1582 date = dateutil.parsedate(date)
1582 else: 1583 else:
1583 date = None 1584 date = None
1584 prec = parsenodeid(precursor) 1585 prec = parsenodeid(precursor)
1585 parents = None 1586 parents = None
1586 if opts['record_parents']: 1587 if opts['record_parents']: