[Bug 5189] New: Hg installed from source on Windows causes "hg" command to be a batch file, with unexpected behavior
mercurial-bugs at selenic.com
mercurial-bugs at selenic.com
Tue Apr 5 11:47:18 UTC 2016
https://bz.mercurial-scm.org/show_bug.cgi?id=5189
Bug ID: 5189
Summary: Hg installed from source on Windows causes "hg"
command to be a batch file, with unexpected behavior
Product: Mercurial
Version: 3.5.2
Hardware: PC
OS: Windows
Status: UNCONFIRMED
Severity: feature
Priority: wish
Component: Mercurial
Assignee: bugzilla at selenic.com
Reporter: gabor.stefanik at nng.com
CC: mercurial-devel at selenic.com
The official Windows Mercurial installers include a "hg.exe" file for
implementing the command "hg".
However, when Mercurial is installed on Windows from source "Pythonically", the
hg command will instead be a batch file.
Due to an impossible-to-disable MS-DOS 1.0 backwards compatibility quirk in
cmd.exe, this makes it impossible to write a batch file that calls "hg" and
works on both binary and source installations.
E.g. this batch file will fail if "hg" is hg.bat:
--BEGIN--
hg status
hg diff --stat
--END--
Instead, you have to write this, which will instead fail if "hg" is hg.exe or
hg.py:
--BEGIN--
call hg status
call hg diff --stat
--END--
Oddly, this backwards compatibility hack is applied even for ".cmd" files,
which are specific to Windows and cmd.exe, and never need MS-DOS/command.com
compatibility hacks.
One way to fix this would be using the "bat2exe" utility to generate an exe
file from hg.bat when installing Pythonically.
Alternatively, if .PY is in PATHEXT, we should skip generating a hg.bat file
entirely, and let hg.py handle the "hg" command.
--
You are receiving this mail because:
You are on the CC list for the bug.
More information about the Mercurial-devel
mailing list