mnauw / git-remote-hg

Transparent bidirectional bridge between Git and Mercurial for Git
GNU General Public License v2.0
62 stars 5 forks source link

git-remote-hg does not run in windows because of extensionless script file #23

Closed amyspark closed 5 years ago

amyspark commented 5 years ago

I've installed this script in Windows 7 with Python 2.7.15. D:\Python27\Scripts is on the PATH and all Python files are associated with 3.7's Python Launcher.

The script install successfully, but when trying to clone a repo, I get:

C:\Users\Amalia\Desktop>git clone hg::https://... xxx
Cloning into 'xxx'...
fatal: 'remote-hg' appears to be a git command, but we were not
able to execute it. Maybe git-remote-hg is broken?

The script can be run if I use py -2 git-remote-hg or any other way, just not through CMD.

mnauw commented 5 years ago

I tried to reproduce with an environment as in issue #22; so windows Git 2.20.1 and windows CPython 2.7.15 installed. I placed git-remote-hg and git-hg-helper in C:\Pyhon27\Scripts (which is on the PATH). There was no problem cloning a hg repo, whether from a CMD shell or a git bash shell.

On the other hand, simply executing git-remote-hg is possible in git bash though not in CMD, which is as can be expected. So it is down to git being clever (or not) when it invokes the remote helper. Perhaps your mileage/version or git setup differs in that respect?

native-api commented 5 years ago

The problem may be in git-remote-hg's shebang #!/usr/bin/env python2. Windows Python does not create pythonXY executables (https://www.python.org/dev/peps/pep-0394/ is UNIX-only). There was a discussion on adding this feature to Windows, too, in the last year (can't find it now) which didn't end in anything in particular.

I mentioned in https://github.com/mnauw/git-remote-hg/issues/22 that I had to make a python2 symlink to make git-remote-hg work. If this is added to installation instructions, that should be a fix to this issue.

mnauw commented 5 years ago

Ah, thanks, forgot about that one. So used to having python2 (link) around ...