##// END OF EJS Templates
rebase: keep str-keyed opts long enough to make `action` a str...
Martin von Zweigbergk -
r48252:de54d110 default
parent child Browse files
Show More
@@ -1063,18 +1063,17 b' def rebase(ui, repo, **opts):'
1063 unresolved conflicts.
1063 unresolved conflicts.
1064
1064
1065 """
1065 """
1066 opts = pycompat.byteskwargs(opts)
1067 inmemory = ui.configbool(b'rebase', b'experimental.inmemory')
1066 inmemory = ui.configbool(b'rebase', b'experimental.inmemory')
1068 action = cmdutil.check_at_most_one_arg(opts, b'abort', b'stop', b'continue')
1067 action = cmdutil.check_at_most_one_arg(opts, 'abort', 'stop', 'continue')
1069 if action:
1068 if action:
1070 cmdutil.check_incompatible_arguments(
1069 cmdutil.check_incompatible_arguments(
1071 opts, action, [b'confirm', b'dry_run']
1070 opts, action, ['confirm', 'dry_run']
1072 )
1071 )
1073 cmdutil.check_incompatible_arguments(
1072 cmdutil.check_incompatible_arguments(
1074 opts, action, [b'rev', b'source', b'base', b'dest']
1073 opts, action, ['rev', 'source', 'base', 'dest']
1075 )
1074 )
1076 cmdutil.check_at_most_one_arg(opts, b'confirm', b'dry_run')
1075 cmdutil.check_at_most_one_arg(opts, 'confirm', 'dry_run')
1077 cmdutil.check_at_most_one_arg(opts, b'rev', b'source', b'base')
1076 cmdutil.check_at_most_one_arg(opts, 'rev', 'source', 'base')
1078
1077
1079 if action or repo.currenttransaction() is not None:
1078 if action or repo.currenttransaction() is not None:
1080 # in-memory rebase is not compatible with resuming rebases.
1079 # in-memory rebase is not compatible with resuming rebases.
@@ -1082,19 +1081,20 b' def rebase(ui, repo, **opts):'
1082 # fail the entire transaction.)
1081 # fail the entire transaction.)
1083 inmemory = False
1082 inmemory = False
1084
1083
1085 if opts.get(b'auto_orphans'):
1084 if opts.get('auto_orphans'):
1086 disallowed_opts = set(opts) - {b'auto_orphans'}
1085 disallowed_opts = set(opts) - {'auto_orphans'}
1087 cmdutil.check_incompatible_arguments(
1086 cmdutil.check_incompatible_arguments(
1088 opts, b'auto_orphans', disallowed_opts
1087 opts, 'auto_orphans', disallowed_opts
1089 )
1088 )
1090
1089
1091 userrevs = list(repo.revs(opts.get(b'auto_orphans')))
1090 userrevs = list(repo.revs(opts.get('auto_orphans')))
1092 opts[b'rev'] = [revsetlang.formatspec(b'%ld and orphan()', userrevs)]
1091 opts['rev'] = [revsetlang.formatspec(b'%ld and orphan()', userrevs)]
1093 opts[b'dest'] = b'_destautoorphanrebase(SRC)'
1092 opts['dest'] = b'_destautoorphanrebase(SRC)'
1094
1093
1094 opts = pycompat.byteskwargs(opts)
1095 if opts.get(b'dry_run') or opts.get(b'confirm'):
1095 if opts.get(b'dry_run') or opts.get(b'confirm'):
1096 return _dryrunrebase(ui, repo, action, opts)
1096 return _dryrunrebase(ui, repo, action, opts)
1097 elif action == b'stop':
1097 elif action == 'stop':
1098 rbsrt = rebaseruntime(repo, ui)
1098 rbsrt = rebaseruntime(repo, ui)
1099 with repo.wlock(), repo.lock():
1099 with repo.wlock(), repo.lock():
1100 rbsrt.restorestatus()
1100 rbsrt.restorestatus()
@@ -1210,7 +1210,7 b' def _dorebase(ui, repo, action, opts, in'
1210
1210
1211
1211
1212 def _origrebase(ui, repo, action, opts, rbsrt):
1212 def _origrebase(ui, repo, action, opts, rbsrt):
1213 assert action != b'stop'
1213 assert action != 'stop'
1214 with repo.wlock(), repo.lock():
1214 with repo.wlock(), repo.lock():
1215 if opts.get(b'interactive'):
1215 if opts.get(b'interactive'):
1216 try:
1216 try:
@@ -1238,15 +1238,13 b' def _origrebase(ui, repo, action, opts, '
1238 raise error.InputError(
1238 raise error.InputError(
1239 _(b'cannot use collapse with continue or abort')
1239 _(b'cannot use collapse with continue or abort')
1240 )
1240 )
1241 if action == b'abort' and opts.get(b'tool', False):
1241 if action == 'abort' and opts.get(b'tool', False):
1242 ui.warn(_(b'tool option will be ignored\n'))
1242 ui.warn(_(b'tool option will be ignored\n'))
1243 if action == b'continue':
1243 if action == 'continue':
1244 ms = mergestatemod.mergestate.read(repo)
1244 ms = mergestatemod.mergestate.read(repo)
1245 mergeutil.checkunresolved(ms)
1245 mergeutil.checkunresolved(ms)
1246
1246
1247 retcode = rbsrt._prepareabortorcontinue(
1247 retcode = rbsrt._prepareabortorcontinue(isabort=(action == 'abort'))
1248 isabort=(action == b'abort')
1249 )
1250 if retcode is not None:
1248 if retcode is not None:
1251 return retcode
1249 return retcode
1252 else:
1250 else:
General Comments 0
You need to be logged in to leave comments. Login now