Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Composer does not properly determine version of mercurial #10955

Closed
exteon opened this issue Jul 19, 2022 · 3 comments
Closed

Composer does not properly determine version of mercurial #10955

exteon opened this issue Jul 19, 2022 · 3 comments
Labels
Milestone

Comments

@exteon
Copy link
Contributor

exteon commented Jul 19, 2022

When compiling mercurial from, say, https://www.mercurial-scm.org/repo/hg/archive/stable.tar.gz :

hg --version
Mercurial Distributed SCM (version 6.2+hg7.4a1f0bc0713e)

\Composer\Util\Hg::getVersion doesn't parse that, resulting in

[RuntimeException]                                       
  hg was not found in your PATH, skipping source download 

I don't know what the check is for anyway, the actual version doesn't seem used further... I would remove the check altogether, or usehg --version -q and update the parsing to allow for 6.2+.

I would also add a mechanism to specify hg, git etc. path, but especially hg because a lot of people use chg ( see https://www.mercurial-scm.org/wiki/CHg ) and alias hg=chg doesn't seem to work with symfony process.

@stof
Copy link
Contributor

stof commented Jul 19, 2022

and alias hg=chg doesn't seem to work with symfony process.

bash aliases indeed don't work when launching a subprocess, because bash is not involved to process the command. However, if you create hg executable in your PATH that is a symlink to chg, this would work (for any tool relying on the PATH).

Regarding the version parsing, it indeed seems to missed support non-tag versions.

@exteon
Copy link
Contributor Author

exteon commented Jul 19, 2022

bash aliases indeed don't work when launching a subprocess

Yes, sometimes process helpers do sh -c command to get around this... I personally don't find it a good idea, and anyway, this is beyond the point.

A way to specify the hg path via env or config variables seems more than welcome though. I see in Fedora 36, it seems we have mercurial and mercurial-chg packages... chg needs the path to hg... While it can be compiled with an absolute path to /usr/local/bin/hg, I don't think it is (too lazy to check right now), so it might go into a self-loop trying to call the original hg.

I don't use the official repos and routinely compile from the stable branch with rust, so I did a mv hg hg_slow && mv chg hg (and compiled chg with the path to hg_slow) to get around hardcoded hg calls.

@Seldaek Seldaek added this to the 2.2 milestone Jul 20, 2022
@Seldaek Seldaek added the Bug label Jul 20, 2022
@Seldaek
Copy link
Member

Seldaek commented Jul 20, 2022

Fixed the version parsing as that's an easy one and definitely a bug. Allowing customizing path though is more work and frankly I am not sure it's needed/worth it. The PATH is how this should work.

Adding support for chg might be a thing.. but that also sounds like more work I'd like to do on this given 99% of Composer users are using git.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants