This is an archive of the discontinued Mercurial Phabricator instance.

chg: make `chg --cwd $anything -R $relativepath` behave better
ClosedPublic

Authored by valentin.gatienbaron on Apr 20 2022, 11:34 AM.

Details

Summary

We're seeing this kind of issue:

$ (cd repo1; chg --cwd ../repo2 -R .)
chg: abort: too many redirections.
Please make sure $path/hg is not a wrapper which changes sensitive environment variables before executing hg. If you have to use a wrapper, wrap chg instead of hg.
[255]

chgserver is interpreting -R as relative to its cwd, instead of
relative to --cwd like regular hg does, which I think causes an
inconsistency leading to the above.

Diff Detail

Repository
rHG Mercurial
Branch
default
Lint
No Linters Available
Unit
No Unit Test Coverage

Event Timeline

valentin.gatienbaron edited the summary of this revision. (Show Details)Apr 20 2022, 11:35 AM
Alphare accepted this revision.Apr 20 2022, 11:55 AM
This revision is now accepted and ready to land.Apr 20 2022, 11:55 AM

I'll queue this on stable.

Unfortunately, this breaks a lot of the tests. I think the condition is too wide since wd is always populated at the top of the function.
https://foss.heptapod.net/mercurial/mercurial-devel/-/pipelines/53316

I'll prune the change, you can send it again in a different revision.

Oops, clearly I should have run all the tests.
Although even though I didn't realize that wd was filled in by the function, this should have merely caused small differences of output. We see that in the failures, but we also errors with hg -R union:..., so the change is maybe not quite right.