I've also updated the helper to work with the hyphenated --dry-run
option.
Details
- Reviewers
pulkit - Group Reviewers
hg-reviewers - Commits
- rHGdaed70e95d60: rebase: use cmdutil.check_at_most_one_arg() for --confirm/--dry-run
Diff Detail
- Repository
- rHG Mercurial
- Branch
- default
- Lint
No Linters Available - Unit
No Unit Test Coverage
Event Timeline
mercurial/cmdutil.py | ||
---|---|---|
272 | Spotted in a later patch, need to replace _ back to - before printing output. |
mercurial/cmdutil.py | ||
---|---|---|
272 | Strings are immutable in Python, so it wasn't actually replaced, right? Or do I misunderstand your concern? |
Spotted in a later patch, need to replace _ back to - before printing output.
Strings are immutable in Python, so it wasn't actually replaced, right? Or do I misunderstand your concern?
Maybe he meant opts[b'dry_run'] vs --dry-run. *args should follow
underscore naming, but the printed option names don't.
Oh, I would consider that a bug in that patch (I would have used dry-run if I had noticed). However, I can see how you would prefer that we pass in the underscore-separated name (since that's what we do with indexing into opts). I was concerned that there were existing flags that were underscore-separated in the UI, but there doesn't seem to be any (I checked by running the test suite with a hacked fancyopts.py). So I'll switch to using the underscore-separated names in the API.
- a/mercurial/cmdutil.py
+++ b/mercurial/cmdutil.py
@@ -268,6 +268,7 @@previous = None for x in args: if opts.get(x):+ x = x.replace(b'_', b'-')
if previous: raise error.Abort( _(b'cannot specify both --%s and --%s') % (previous, x)
Nit: better to return the unique argument in the original format, not
the dash-ed version.
Spotted in a later patch, need to replace _ back to - before printing output.