Mercurial > public > mercurial-scm > hg
changeset 52944:33497640af7c
packagelib: allow retrieving the hg version without building hg
This is useful when trying to run docker builds
with host platforms that cannot build a recent hg
(for example RHEL8 and derivatives).
author | Mathias De Mare <mathias.de_mare@nokia.com> |
---|---|
date | Mon, 03 Feb 2025 17:17:13 +0100 |
parents | 3cb9f9166a46 |
children | 5b0b896b9d20 |
files | contrib/packaging/packagelib.sh |
diffstat | 1 files changed, 9 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/contrib/packaging/packagelib.sh Mon Feb 03 16:47:17 2025 +0100 +++ b/contrib/packaging/packagelib.sh Mon Feb 03 17:17:13 2025 +0100 @@ -8,6 +8,15 @@ # # node: the node|short hg was built from, or empty if built from a tag gethgversion() { + # allow passing the version from an environment variable + # in case of builds on an older platform that cannot build hg + if [ ! -z "$USELOCALHG" ]; then + HG="$(which hg)" + version=$($python $HG log -r . --template "{latesttag}") + distance=$($python $HG log -r . --template "{latesttagdistance}") + node=$($python $HG log -r . --template "{node|short}") + return + fi if [ -z "${1+x}" ]; then python="python3" else