Show More
@@ -36,9 +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', None, |
|
39 | ] + cmdutil.walkopts + cmdutil.commitopts + cmdutil.commitopts2 | |
40 | _('record the current date as commit date')), |
|
40 | + cmdutil.commitopts3, | |
41 | ] + cmdutil.walkopts + cmdutil.commitopts + cmdutil.commitopts2, |
|
|||
42 | _('[OPTION]... [FILE]...'), |
|
41 | _('[OPTION]... [FILE]...'), | |
43 | helpcategory=command.CATEGORY_COMMITTING, |
|
42 | helpcategory=command.CATEGORY_COMMITTING, | |
44 | inferrepo=True) |
|
43 | inferrepo=True) |
@@ -184,6 +184,9 b' debugrevlogopts = [' | |||||
184 |
|
184 | |||
185 | def resolvecommitoptions(ui, opts): |
|
185 | def resolvecommitoptions(ui, opts): | |
186 | """modify commit options dict to handle related options |
|
186 | """modify commit options dict to handle related options | |
|
187 | ||||
|
188 | The return value indicates that ``rewrite.update-timestamp`` is the reason | |||
|
189 | the ``date`` option is set. | |||
187 | """ |
|
190 | """ | |
188 | if opts.get('date') and opts.get('currentdate'): |
|
191 | if opts.get('date') and opts.get('currentdate'): | |
189 | raise error.Abort(_('--date and --currentdate are mutually ' |
|
192 | raise error.Abort(_('--date and --currentdate are mutually ' | |
@@ -192,12 +195,21 b' def resolvecommitoptions(ui, opts):' | |||||
192 | raise error.Abort(_('--user and --currentuser are mutually ' |
|
195 | raise error.Abort(_('--user and --currentuser are mutually ' | |
193 | 'exclusive')) |
|
196 | 'exclusive')) | |
194 |
|
197 | |||
195 | # N.B. this is extremely similar to setupheaderopts() in mq.py |
|
198 | datemaydiffer = False # date-only change should be ignored? | |
|
199 | ||||
196 | if opts.get(b'currentdate'): |
|
200 | if opts.get(b'currentdate'): | |
197 | opts[b'date'] = b'%d %d' % dateutil.makedate() |
|
201 | opts[b'date'] = b'%d %d' % dateutil.makedate() | |
|
202 | elif (not opts.get('date') | |||
|
203 | and ui.configbool('rewrite', 'update-timestamp') | |||
|
204 | and opts.get('currentdate') is None): | |||
|
205 | opts[b'date'] = b'%d %d' % dateutil.makedate() | |||
|
206 | datemaydiffer = True | |||
|
207 | ||||
198 | if opts.get(b'currentuser'): |
|
208 | if opts.get(b'currentuser'): | |
199 | opts[b'user'] = ui.username() |
|
209 | opts[b'user'] = ui.username() | |
200 |
|
210 | |||
|
211 | return datemaydiffer | |||
|
212 | ||||
201 | def ishunk(x): |
|
213 | def ishunk(x): | |
202 | hunkclasses = (crecordmod.uihunk, patch.recordhunk) |
|
214 | hunkclasses = (crecordmod.uihunk, patch.recordhunk) | |
203 | return isinstance(x, hunkclasses) |
|
215 | return isinstance(x, hunkclasses) | |
@@ -2470,22 +2482,13 b' def amend(ui, repo, old, extra, pats, op' | |||||
2470 | # Also update it from the from the wctx |
|
2482 | # Also update it from the from the wctx | |
2471 | extra.update(wctx.extra()) |
|
2483 | extra.update(wctx.extra()) | |
2472 |
|
2484 | |||
2473 | user = opts.get('user') or old.user() |
|
2485 | # date-only change should be ignored? | |
2474 |
|
2486 | datemaydiffer = resolvecommitoptions(ui, opts) | ||
2475 | datemaydiffer = False # date-only change should be ignored? |
|
2487 | ||
2476 | if opts.get('date') and opts.get('currentdate'): |
|
2488 | date = old.date() | |
2477 | raise error.Abort(_('--date and --currentdate are mutually ' |
|
|||
2478 | 'exclusive')) |
|
|||
2479 | if opts.get('date'): |
|
2489 | if opts.get('date'): | |
2480 | date = dateutil.parsedate(opts.get('date')) |
|
2490 | date = dateutil.parsedate(opts.get('date')) | |
2481 | elif opts.get('currentdate'): |
|
2491 | user = opts.get('user') or old.user() | |
2482 | date = dateutil.makedate() |
|
|||
2483 | elif (ui.configbool('rewrite', 'update-timestamp') |
|
|||
2484 | and opts.get('currentdate') is None): |
|
|||
2485 | date = dateutil.makedate() |
|
|||
2486 | datemaydiffer = True |
|
|||
2487 | else: |
|
|||
2488 | date = old.date() |
|
|||
2489 |
|
2492 | |||
2490 | if len(old.parents()) > 1: |
|
2493 | if len(old.parents()) > 1: | |
2491 | # ctx.files() isn't reliable for merges, so fall back to the |
|
2494 | # ctx.files() isn't reliable for merges, so fall back to the |
@@ -1853,7 +1853,8 b' Alias definitions for revsets. See :hg:`' | |||||
1853 |
|
1853 | |||
1854 | ``update-timestamp`` |
|
1854 | ``update-timestamp`` | |
1855 | If true, updates the date and time of the changeset to current. It is only |
|
1855 | If true, updates the date and time of the changeset to current. It is only | |
1856 | applicable for hg amend in current version. |
|
1856 | applicable for `hg amend`, `hg commit --amend` and `hg uncommit` in the | |
|
1857 | current version. | |||
1857 |
|
1858 | |||
1858 | ``storage`` |
|
1859 | ``storage`` | |
1859 | ----------- |
|
1860 | ----------- |
General Comments 0
You need to be logged in to leave comments.
Login now