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

martinvonz (Martin von Zweigbergk) phabricator at mercurial-scm.org
Wed Dec 11 00:24:10 EST 2019


martinvonz added inline comments.
martinvonz added a subscriber: hooper.

INLINE COMMENTS

> mharbison72 wrote in test-fix.t:1336-1342
> I found a couple of things surprising here:
> 
> 1. `.::` doesn't include fixing wdir()
> 2. `.` isn't updated unless `-w` is specified
> 3. `-w` doesn't alter `wdir()` content unless there are dirty files (makes sense), but //will// update `.` if starting with a clean `wdir()`
> 
> The first issue seems related to https://www.mercurial-scm.org/wiki/RevsetVirtualRevisionPlan
> 
> I can't think of any reason you'd want to fix `.` and not `wdir()` other than "I'm afraid the fixer will eat my uncommitted data".  Is there a reason not to do it by default, and instead require --no-working-dir to get the current behavior?  If there are uncommitted changes, it seems that the user would be caught with needing to commit on top of the obsolete commit, and then evolve/rebase and deal with the merge conflicts.
> 
> I ended up spending a bunch of time troubleshooting why the content of `-r .` didn't seem to be updated here, without realizing the automatic evolve was conditional.  Part of this was not being able to easily peek into the finished test to see the state of the repo.  I guess it makes sense to keep the diff from `wdir()` unchanged, and therefore keep the original parent.  But I think this confusion is another reason to default to `-w`.
> 
> Alternately if `.` is in the set of revisions being fixed and `wdir()` is dirty, maybe it can abort and hint to add `-w` or `--force`?

> `.::` 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).

REPOSITORY
  rHG Mercurial

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

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

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


More information about the Mercurial-devel mailing list