Mercurial > hg
comparison mercurial/cmdutil.py @ 41124:cffa8e0ba77a
amend: add boolean to ignore date-only change
I want to add -D/--currentdate option, which should behave slightly different
from the update-timestamp option.
author | Yuya Nishihara <yuya@tcha.org> |
---|---|
date | Mon, 07 Jan 2019 21:39:35 +0900 |
parents | b153a4aa06f8 |
children | 126101284e04 |
comparison
equal
deleted
inserted
replaced
41123:b153a4aa06f8 | 41124:cffa8e0ba77a |
---|---|
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 | 2444 |
2445 datemaydiffer = False # date-only change should be ignored? | |
2445 if opts.get('date'): | 2446 if opts.get('date'): |
2446 date = dateutil.parsedate(opts.get('date')) | 2447 date = dateutil.parsedate(opts.get('date')) |
2447 elif ui.configbool('rewrite', 'update-timestamp'): | 2448 elif ui.configbool('rewrite', 'update-timestamp'): |
2448 date = dateutil.makedate() | 2449 date = dateutil.makedate() |
2450 datemaydiffer = True | |
2449 else: | 2451 else: |
2450 date = old.date() | 2452 date = old.date() |
2451 | 2453 |
2452 if len(old.parents()) > 1: | 2454 if len(old.parents()) > 1: |
2453 # ctx.files() isn't reliable for merges, so fall back to the | 2455 # ctx.files() isn't reliable for merges, so fall back to the |
2559 | 2561 |
2560 newdesc = changelog.stripdesc(new.description()) | 2562 newdesc = changelog.stripdesc(new.description()) |
2561 if ((not changes) | 2563 if ((not changes) |
2562 and newdesc == old.description() | 2564 and newdesc == old.description() |
2563 and user == old.user() | 2565 and user == old.user() |
2566 and (date == old.date() or datemaydiffer) | |
2564 and pureextra == old.extra()): | 2567 and pureextra == old.extra()): |
2565 # nothing changed. continuing here would create a new node | 2568 # nothing changed. continuing here would create a new node |
2566 # anyway because of the amend_source noise. | 2569 # anyway because of the amend_source noise. |
2567 # | 2570 # |
2568 # This not what we expect from amend. | 2571 # This not what we expect from amend. |
2569 if (date == old.date() or | 2572 return old.node() |
2570 (ui.configbool('rewrite', 'update-timestamp') and | |
2571 not opts.get('date'))): | |
2572 return old.node() | |
2573 | 2573 |
2574 commitphase = None | 2574 commitphase = None |
2575 if opts.get('secret'): | 2575 if opts.get('secret'): |
2576 commitphase = phases.secret | 2576 commitphase = phases.secret |
2577 newid = repo.commitctx(new) | 2577 newid = repo.commitctx(new) |