This is an archive of the discontinued Mercurial Phabricator instance.

chg: make is possible to call by default an hg binary located next to chg
ClosedPublic

Authored by valentin.gatienbaron on Sep 10 2020, 2:12 PM.

Details

Summary

When a single version of hg is in use and it's in the PATH, using chg
is just a matter of calling chg.

But when there are multiple installations of hg+chg around, and hg is
referred to with an absolute path, using chg is more annoying because
it requires both changing the invocation to hg to use chg, but also
setting CHGHG.

Currently, we set HGPATH when we build chg to remove the need to set
CHGHG in the previous paragraph. But that means chg now hardcodes its
installation path, which makes the installation not relocatable. Hence
this proposal to make chg find ./hg relative to itself (as opposed to
CHGHG=./hg which find hg relative to cwd).

This only works on linux as written, but since it's opt-in, it sounds
fine.

Tested by hand, as I'm not sure how else to test this.

Diff Detail

Repository
rHG Mercurial
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.

Event Timeline

@yuja something which should not miss your eyes I guess :)

The behavior and the code looks good to me. I guess we should document the variable and the behavior somewhere. However I am not sure of where that might be. @yuya do you know where the chg documentation lives ?

marmoute accepted this revision.Sep 17 2020, 4:01 AM
pulkit accepted this revision.Sep 24 2020, 3:38 AM
This revision is now accepted and ready to land.Sep 24 2020, 3:38 AM