##// END OF EJS Templates
cmdutil: make resolvecommitoptions() work on str-keyed opts...
Martin von Zweigbergk -
r48225:7f7457f8 default
parent child Browse files
Show More
@@ -154,8 +154,8 b' def uncommit(ui, repo, *pats, **opts):'
154 given.
154 given.
155 """
155 """
156 cmdutil.check_note_size(opts)
156 cmdutil.check_note_size(opts)
157 cmdutil.resolve_commit_options(ui, opts)
157 opts = pycompat.byteskwargs(opts)
158 opts = pycompat.byteskwargs(opts)
158 cmdutil.resolvecommitoptions(ui, opts)
159
159
160 with repo.wlock(), repo.lock():
160 with repo.wlock(), repo.lock():
161
161
@@ -301,29 +301,29 b' def check_incompatible_arguments(opts, f'
301 check_at_most_one_arg(opts, first, other)
301 check_at_most_one_arg(opts, first, other)
302
302
303
303
304 def resolvecommitoptions(ui, opts):
304 def resolve_commit_options(ui, opts):
305 """modify commit options dict to handle related options
305 """modify commit options dict to handle related options
306
306
307 The return value indicates that ``rewrite.update-timestamp`` is the reason
307 The return value indicates that ``rewrite.update-timestamp`` is the reason
308 the ``date`` option is set.
308 the ``date`` option is set.
309 """
309 """
310 check_at_most_one_arg(opts, b'date', b'currentdate')
310 check_at_most_one_arg(opts, 'date', 'currentdate')
311 check_at_most_one_arg(opts, b'user', b'currentuser')
311 check_at_most_one_arg(opts, 'user', 'currentuser')
312
312
313 datemaydiffer = False # date-only change should be ignored?
313 datemaydiffer = False # date-only change should be ignored?
314
314
315 if opts.get(b'currentdate'):
315 if opts.get('currentdate'):
316 opts[b'date'] = b'%d %d' % dateutil.makedate()
316 opts['date'] = b'%d %d' % dateutil.makedate()
317 elif (
317 elif (
318 not opts.get(b'date')
318 not opts.get('date')
319 and ui.configbool(b'rewrite', b'update-timestamp')
319 and ui.configbool(b'rewrite', b'update-timestamp')
320 and opts.get(b'currentdate') is None
320 and opts.get('currentdate') is None
321 ):
321 ):
322 opts[b'date'] = b'%d %d' % dateutil.makedate()
322 opts['date'] = b'%d %d' % dateutil.makedate()
323 datemaydiffer = True
323 datemaydiffer = True
324
324
325 if opts.get(b'currentuser'):
325 if opts.get('currentuser'):
326 opts[b'user'] = ui.username()
326 opts['user'] = ui.username()
327
327
328 return datemaydiffer
328 return datemaydiffer
329
329
@@ -2783,7 +2783,6 b' def samefile(f, ctx1, ctx2):'
2783
2783
2784
2784
2785 def amend(ui, repo, old, extra, pats, opts):
2785 def amend(ui, repo, old, extra, pats, opts):
2786 opts = pycompat.byteskwargs(opts)
2787 # avoid cycle context -> subrepo -> cmdutil
2786 # avoid cycle context -> subrepo -> cmdutil
2788 from . import context
2787 from . import context
2789
2788
@@ -2816,7 +2815,8 b' def amend(ui, repo, old, extra, pats, op'
2816 extra.update(wctx.extra())
2815 extra.update(wctx.extra())
2817
2816
2818 # date-only change should be ignored?
2817 # date-only change should be ignored?
2819 datemaydiffer = resolvecommitoptions(ui, opts)
2818 datemaydiffer = resolve_commit_options(ui, opts)
2819 opts = pycompat.byteskwargs(opts)
2820
2820
2821 date = old.date()
2821 date = old.date()
2822 if opts.get(b'date'):
2822 if opts.get(b'date'):
@@ -3104,8 +3104,8 b' def _dograft(ui, repo, *revs, **opts):'
3104 # list of new nodes created by ongoing graft
3104 # list of new nodes created by ongoing graft
3105 statedata[b'newnodes'] = []
3105 statedata[b'newnodes'] = []
3106
3106
3107 cmdutil.resolve_commit_options(ui, opts)
3107 opts = pycompat.byteskwargs(opts)
3108 opts = pycompat.byteskwargs(opts)
3108 cmdutil.resolvecommitoptions(ui, opts)
3109
3109
3110 editor = cmdutil.getcommiteditor(
3110 editor = cmdutil.getcommiteditor(
3111 editform=b'graft', **pycompat.strkwargs(opts)
3111 editform=b'graft', **pycompat.strkwargs(opts)
General Comments 0
You need to be logged in to leave comments. Login now