diff --git a/mercurial/cmdutil.py b/mercurial/cmdutil.py --- a/mercurial/cmdutil.py +++ b/mercurial/cmdutil.py @@ -3445,6 +3445,7 @@ return repo.status(match=scmutil.match(repo[None], pats, opts)) def revert(ui, repo, ctx, parents, *pats, **opts): + opts = pycompat.byteskwargs(opts) parent, p2 = parents node = ctx.node() @@ -3722,7 +3723,8 @@ # Revert the subrepos on the revert list for sub in targetsubs: try: - wctx.sub(sub).revert(ctx.substate[sub], *pats, **opts) + wctx.sub(sub).revert(ctx.substate[sub], *pats, + **pycompat.strkwargs(opts)) except KeyError: raise error.Abort("subrepository '%s' does not exist in %s!" % (sub, short(ctx.node()))) diff --git a/mercurial/commands.py b/mercurial/commands.py --- a/mercurial/commands.py +++ b/mercurial/commands.py @@ -4560,6 +4560,7 @@ Returns 0 on success. """ + opts = pycompat.byteskwargs(opts) if opts.get("date"): if opts.get("rev"): raise error.Abort(_("you can't specify a revision and a date")) @@ -4595,7 +4596,8 @@ hint = _("use --all to revert all files") raise error.Abort(msg, hint=hint) - return cmdutil.revert(ui, repo, ctx, (parent, p2), *pats, **opts) + return cmdutil.revert(ui, repo, ctx, (parent, p2), *pats, + **pycompat.strkwargs(opts)) @command('rollback', dryrunopts + [('f', 'force', False, _('ignore safety measures'))]) diff --git a/mercurial/subrepo.py b/mercurial/subrepo.py --- a/mercurial/subrepo.py +++ b/mercurial/subrepo.py @@ -1089,24 +1089,24 @@ # 2. update the subrepo to the revision specified in # the corresponding substate dictionary self.ui.status(_('reverting subrepo %s\n') % substate[0]) - if not opts.get('no_backup'): + if not opts.get(r'no_backup'): # Revert all files on the subrepo, creating backups # Note that this will not recursively revert subrepos # We could do it if there was a set:subrepos() predicate opts = opts.copy() - opts['date'] = None - opts['rev'] = substate[1] + opts[r'date'] = None + opts[r'rev'] = substate[1] self.filerevert(*pats, **opts) # Update the repo to the revision specified in the given substate - if not opts.get('dry_run'): + if not opts.get(r'dry_run'): self.get(substate, overwrite=True) def filerevert(self, *pats, **opts): - ctx = self._repo[opts['rev']] + ctx = self._repo[opts[r'rev']] parents = self._repo.dirstate.parents() - if opts.get('all'): + if opts.get(r'all'): pats = ['set:modified()'] else: pats = []