D4380: revert: fix the inconsistency of status msgs in --interactive mode
Yuya Nishihara
yuya at tcha.org
Tue Aug 28 08:58:36 EDT 2018
> $ hg revert a
> + undeleting a
As you can see, there was no status message if "a" is an explicitly specified
file.
> @@ -3021,7 +3021,8 @@
> if ui.verbose or not exact:
> if not isinstance(msg, bytes):
> msg = msg(abs)
> - ui.status(msg % rel)
> + if opts.get('dry_run'):
> + ui.status(msg % rel)
Before a relative path was printed, but new code would probably use the
repository-absolute path.
Perhaps we can pass in the matcher `m` to `_performrevert()` to translate
abs path to relative, and to test if status message should be printed.
> + repo.ui.status(_("%s") % (actions['forget'][1] % f))
Nit: `_("%s")` is noop. Just print `actions['forget'][1] % f`.
> @@ -3141,14 +3147,21 @@
> tobackup = set()
> # Apply changes
> fp = stringio()
> + # `fnames` keep track of filenames for which we have initiated changes,
> + # to make sure that we print status msg only once for a file.
> + fnames = []
Nit: perhaps `set()` is better here since we have to test the existence
many times.
FWIW, no idea why `revert()` has to be such complicated.
More information about the Mercurial-devel
mailing list