Mercurial > public > mercurial-scm > hg
comparison mercurial/cmdutil.py @ 41123:b153a4aa06f8
amend: refactor commit date handling
There's no need to parse a date tuple. Just do it for user option.
author | Yuya Nishihara <yuya@tcha.org> |
---|---|
date | Mon, 07 Jan 2019 21:29:58 +0900 |
parents | 79f8f032c706 |
children | cffa8e0ba77a |
comparison
equal
deleted
inserted
replaced
41122:14271b524d76 | 41123:b153a4aa06f8 |
---|---|
2439 | 2439 |
2440 # Also update it from the from the wctx | 2440 # Also update it from the from the wctx |
2441 extra.update(wctx.extra()) | 2441 extra.update(wctx.extra()) |
2442 | 2442 |
2443 user = opts.get('user') or old.user() | 2443 user = opts.get('user') or old.user() |
2444 date = opts.get('date') or old.date() | 2444 |
2445 | 2445 if opts.get('date'): |
2446 if ui.configbool('rewrite', 'update-timestamp'): | 2446 date = dateutil.parsedate(opts.get('date')) |
2447 if opts.get('date'): | 2447 elif ui.configbool('rewrite', 'update-timestamp'): |
2448 pass | 2448 date = dateutil.makedate() |
2449 else: | 2449 else: |
2450 date = dateutil.makedate() | 2450 date = old.date() |
2451 | |
2452 # Parse the date to allow comparison between date and old.date() | |
2453 date = dateutil.parsedate(date) | |
2454 | 2451 |
2455 if len(old.parents()) > 1: | 2452 if len(old.parents()) > 1: |
2456 # ctx.files() isn't reliable for merges, so fall back to the | 2453 # ctx.files() isn't reliable for merges, so fall back to the |
2457 # slower repo.status() method | 2454 # slower repo.status() method |
2458 files = set([fn for st in base.status(old)[:3] | 2455 files = set([fn for st in base.status(old)[:3] |