[PATCH] run-tests: alias hg to hg.exe for Windows

Adrian Buehlmann adrian at cadifra.com
Tue Jun 26 20:17:16 CDT 2012


# HG changeset patch
# User Adrian Buehlmann <adrian at cadifra.com>
# Date 1340759693 -7200
# Node ID 52b63762a69feaf2e2a959a41a4d6947d0c922b0
# Parent  ab4644c3064fd12738b18d6f65c6acd5799d57b3
run-tests: alias hg to hg.exe for Windows

This allows to keep the hg file in place, yet have the vast majority of the hg
calls in the tests use the hg.exe.

If we just keep the hg file while running the tests (without this alias), sh.exe
of MSYS will take the hg file for almost every hg call in the tests - not the
hg.exe.

Taking the hg file works, because sh.exe reads into the hg file, sees the
hashbang (#!/usr/bin/env python), thus calls env.exe (part of MSYS), which in
turn calls python.exe with the hg file. But that's slower than using the hg.exe.

And the hg.exe is required anyway: a few tests don't work without having a
hg.exe (e.g. test-commandserver.py). So, having a hg.exe is mandatory anyway.
If it's required, then we should use it as much as we can. The testsuite runs
faster that way, and if we use hg.exe more, it will be better tested.

But without the hg file, e.g. test-merge-tools.t currently fails. So, leaving
the hg file in place will let test-merge-tools.t pass again.

diff --git a/tests/run-tests.py b/tests/run-tests.py
--- a/tests/run-tests.py
+++ b/tests/run-tests.py
@@ -617,6 +617,7 @@
         script.append('set -x\n')
     if os.getenv('MSYSTEM'):
         script.append('alias pwd="pwd -W"\n')
+        script.append('alias hg=hg.exe\n')
     for n, l in enumerate(t):
         if not l.endswith('\n'):
             l += '\n'


More information about the Mercurial-devel mailing list