test-subrepo-git.t on windows

Benjamin Pollack benjamin at bitquabit.com
Tue Jun 19 10:02:07 CDT 2012


On 6/19/2012 9:00 AM, Mads Kiilerich wrote:
> On 19/06/12 14:39, Eduard-Cristian Stefan wrote:
>> Is it ok to test for Windows in subrepo.py and use 'git.cmd' instead 
>> of 'git'
>> in the subprocess.Popen call in _gitnodir?
>
> I assume you have done some analysis that shows that it would be ok? 
> Please tell us what you have found so we can agree or disagree and add 
> to that.
>
> I also wonder why 'hghave git' succeeds if the git invocation in 
> subrepo.py fails. That must be a bug in one of the places. But the git 
> convert tests do apparently run without hardcoding and .cmd. It seems 
> like it does something more right than subrepo.

hghave uses os.popen, while subrepo uses subprocess.Popen.  I don't know 
whether that's a bug or a feature, and in which place.

> it also seems strange that git on windows _always_ uses a git.cmd, and 
> it might thus not be a good idea to hardcode it. I don't know. If you 
> know then please tell.

I already submitted a patch last week that fixes this a week ago 
(http://www.selenic.com/pipermail/mercurial-devel/2012-June/041457.html). Basically, 
the most common Git on Windows (MSYS) only installs git.cmd in the path, 
and subprocess.Popen, for whatever reason, doesn't find that kind of 
batch file.  My patch tries plain "git", then falls back to an explicit 
git.cmd on Windows on failure.  It works fine and passes the test suite, 
both with and without Git installed.

--Benjamin


More information about the Mercurial-devel mailing list