##// END OF EJS Templates
revert: migrate `opts` to native kwargs
Matt Harbison -
r51742:fdf97ae0 default
parent child Browse files
Show More
@@ -6397,30 +6397,29 b' def revert(ui, repo, *pats, **opts):'
6397 6397 Returns 0 on success.
6398 6398 """
6399 6399
6400 opts = pycompat.byteskwargs(opts)
6401 if opts.get(b"date"):
6402 cmdutil.check_incompatible_arguments(opts, b'date', [b'rev'])
6403 opts[b"rev"] = cmdutil.finddate(ui, repo, opts[b"date"])
6400 if opts.get("date"):
6401 cmdutil.check_incompatible_arguments(opts, 'date', ['rev'])
6402 opts["rev"] = cmdutil.finddate(ui, repo, opts["date"])
6404 6403
6405 6404 parent, p2 = repo.dirstate.parents()
6406 if not opts.get(b'rev') and p2 != repo.nullid:
6405 if not opts.get('rev') and p2 != repo.nullid:
6407 6406 # revert after merge is a trap for new users (issue2915)
6408 6407 raise error.InputError(
6409 6408 _(b'uncommitted merge with no revision specified'),
6410 6409 hint=_(b"use 'hg update' or see 'hg help revert'"),
6411 6410 )
6412 6411
6413 rev = opts.get(b'rev')
6412 rev = opts.get('rev')
6414 6413 if rev:
6415 6414 repo = scmutil.unhidehashlikerevs(repo, [rev], b'nowarn')
6416 6415 ctx = logcmdutil.revsingle(repo, rev)
6417 6416
6418 6417 if not (
6419 6418 pats
6420 or opts.get(b'include')
6421 or opts.get(b'exclude')
6422 or opts.get(b'all')
6423 or opts.get(b'interactive')
6419 or opts.get('include')
6420 or opts.get('exclude')
6421 or opts.get('all')
6422 or opts.get('interactive')
6424 6423 ):
6425 6424 msg = _(b"no files or directories specified")
6426 6425 if p2 != repo.nullid:
@@ -6454,7 +6453,7 b' def revert(ui, repo, *pats, **opts):'
6454 6453 hint = _(b"use --all to revert all files")
6455 6454 raise error.InputError(msg, hint=hint)
6456 6455
6457 return cmdutil.revert(ui, repo, ctx, *pats, **pycompat.strkwargs(opts))
6456 return cmdutil.revert(ui, repo, ctx, *pats, **opts)
6458 6457
6459 6458
6460 6459 @command(
General Comments 0
You need to be logged in to leave comments. Login now