Show More
@@ -36,6 +36,8 b' command = registrar.command(cmdtable)' | |||||
36 | ('e', 'edit', None, _('invoke editor on commit messages')), |
|
36 | ('e', 'edit', None, _('invoke editor on commit messages')), | |
37 | ('i', 'interactive', None, _('use interactive mode')), |
|
37 | ('i', 'interactive', None, _('use interactive mode')), | |
38 | ('n', 'note', '', _('store a note on the amend')), |
|
38 | ('n', 'note', '', _('store a note on the amend')), | |
|
39 | ('D', 'currentdate', False, | |||
|
40 | _('record the current date as commit date')), | |||
39 | ] + cmdutil.walkopts + cmdutil.commitopts + cmdutil.commitopts2, |
|
41 | ] + cmdutil.walkopts + cmdutil.commitopts + cmdutil.commitopts2, | |
40 | _('[OPTION]... [FILE]...'), |
|
42 | _('[OPTION]... [FILE]...'), | |
41 | helpcategory=command.CATEGORY_COMMITTING, |
|
43 | helpcategory=command.CATEGORY_COMMITTING, |
@@ -2443,8 +2443,13 b' def amend(ui, repo, old, extra, pats, op' | |||||
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 | datemaydiffer = False # date-only change should be ignored? | |
|
2446 | if opts.get('date') and opts.get('currentdate'): | |||
|
2447 | raise error.Abort(_('--date and --currentdate are mutually ' | |||
|
2448 | 'exclusive')) | |||
2446 | if opts.get('date'): |
|
2449 | if opts.get('date'): | |
2447 | date = dateutil.parsedate(opts.get('date')) |
|
2450 | date = dateutil.parsedate(opts.get('date')) | |
|
2451 | elif opts.get('currentdate'): | |||
|
2452 | date = dateutil.makedate() | |||
2448 | elif ui.configbool('rewrite', 'update-timestamp'): |
|
2453 | elif ui.configbool('rewrite', 'update-timestamp'): | |
2449 | date = dateutil.makedate() |
|
2454 | date = dateutil.makedate() | |
2450 | datemaydiffer = True |
|
2455 | datemaydiffer = True |
@@ -438,3 +438,25 b' When date option is applicable and updat' | |||||
438 | user: foobar |
|
438 | user: foobar | |
439 | date: Thu Jan 01 00:01:00 1998 +0000 |
|
439 | date: Thu Jan 01 00:01:00 1998 +0000 | |
440 | summary: commit 1 |
|
440 | summary: commit 1 | |
|
441 | ||||
|
442 | Unlike rewrite.update-timestamp, -D/--currentdate always updates the timestamp | |||
|
443 | ||||
|
444 | $ hg amend -D | |||
|
445 | $ hg log --limit 1 | |||
|
446 | user: foobar | |||
|
447 | date: Thu Jan 01 00:00:04 1970 +0000 | |||
|
448 | summary: commit 1 | |||
|
449 | ||||
|
450 | $ hg amend -D --config rewrite.update-timestamp=True | |||
|
451 | $ hg log --limit 1 | |||
|
452 | user: foobar | |||
|
453 | date: Thu Jan 01 00:00:05 1970 +0000 | |||
|
454 | summary: commit 1 | |||
|
455 | ||||
|
456 | Bad combination of date options: | |||
|
457 | ||||
|
458 | $ hg amend -D --date '0 0' | |||
|
459 | abort: --date and --currentdate are mutually exclusive | |||
|
460 | [255] | |||
|
461 | ||||
|
462 | $ cd .. |
General Comments 0
You need to be logged in to leave comments.
Login now