D7570: match: resolve filesets against the passed `cwd`, not the current one

hooper (Danny Hooper) phabricator at mercurial-scm.org
Thu Dec 12 21:29:16 UTC 2019


hooper added inline comments.

INLINE COMMENTS

> martinvonz wrote in test-fix.t:1336-1342
> > `.::` doesn't include fixing wdir()
> 
> Yes, that's how revsets work (as you noted)
> 
> > `.` isn't updated unless `-w` is specified
> 
> Yes, because otherwise the working directory would appear to undo the formatting changes. I don't remember why we don't just always format the working directory when we format the parent of the working directory. I'm sure @hooper remembers the reasoning better.
> 
> > `-w` doesn't alter `wdir()` content unless there are dirty files (makes sense), but will update `.` if starting with a clean `wdir()`
> 
> Do you mean with *just* `-w`? That shouldn't change any commits, so it seems very weird if it checks out a different commit. If you meant something like `-w -r .`, then that *would* format the working copy too, but it may not seem like it if the working copy was clean before and after the command (but it was formatted to match the parent commit).

Martin and I talked about this, and I think it would make sense to:

1. Update/fix the wdir when the parent is fixed without -w, unless the wdir has uncommitted changes. We want to avoid triggering any merges, or clobbering uncommitted changes unless asked to. "Eating uncommitted data" is a very easy mistake to make when writing a config for hg fix, or when the formatter has a bug, etc.
2. Add a --source/-s flag to hg fix, where "-s foo" means "-r (foo)::" or "-r (foo):: -w" depending on whether "." is contained in "(foo)::". Similar to rebase.
3. Maybe remove the -r flag since it's a bit of a footgun.
4. Alternatively, keep the -r flag and make merges smart enough that "hg evolve" can apply formatters when that makes sense as a cleanup for "foo~-1" after "hg fix -r foo".

REPOSITORY
  rHG Mercurial

BRANCH
  default

CHANGES SINCE LAST ACTION
  https://phab.mercurial-scm.org/D7570/new/

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

To: mharbison72, #hg-reviewers, durin42
Cc: durin42, hooper, yuja, martinvonz, mercurial-devel


More information about the Mercurial-devel mailing list