D4380: revert: fix the inconsistency of status msgs in --interactive mode

khanchi97 (Sushil khanchi) phabricator at mercurial-scm.org
Thu Aug 30 17:12:47 EDT 2018


khanchi97 added a comment.


  Made changes. Ready to review.
  
  In https://phab.mercurial-scm.org/D4380#67537, @yuja wrote:
  
  > >   $ hg revert a
  > > 
  > > +  undeleting a
  >
  > As you can see, there was no status message if "a" is an explicitly specified
  >  file.
  
  
  Oh yes, added exact conditional.
  
  > 
  > 
  >> @@ -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.
  
  I passed the `names` dict as it already have the required information.
  
  > 
  > 
  >> +                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.

INLINE COMMENTS

> cmdutil.py:3023
> +                        if ui.verbose or not exact:
> +                            if not isinstance(msg, bytes):
> +                                msg = msg(abs)

Does this conditional doing something useful because I don't see any change in the tests if I remove line 3023,3024?

REPOSITORY
  rHG Mercurial

REVISION DETAIL
  https://phab.mercurial-scm.org/D4380

To: khanchi97, #hg-reviewers
Cc: yuja, mercurial-devel


More information about the Mercurial-devel mailing list