tobiastimm / husky-hg

:dog: Git/Mercurial hooks made easy.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Windows support

louis-bompart opened this issue Β· comments

I was trying to use husky-hg on Windows 10 and found some issues, and also about how to possibly fix them.

πŸ”΄ The package is trying to use shell scripts, which, without a proper POSIX shell, won't work.
βœ… Create an equivalent of the shell scripts in batch.

πŸ”΄ The paths are not Windows friendly.
βœ… Prefix the path with .\ and suffix it with .bat (When the batch script are written).
For example, the path is currently: .hg\hooks\precommit and should be .\.hg\hooks\precommit.bat

Thanks. I will take a look at it and see if I can fix it soon πŸ˜„

Nice ! πŸ™Œ
I didn't deep dive yet into the code, but if you need help or lack time, I can try to do so and open a PR if I manage to get something. :)

You can try if you want to. I will probably look at it Saturday or Sunday. I lack time this week sadly

@louis-bompart Any success on your side? Otherwise I will try to take a look at

@tobiastimm, close but no cigar on my side, due to my total lack of experience on bash and other scripting languages.
However, I reached out one of my colleague who's more experienced with that, especially on Microsoft side and he's looking at it. I don't recall his GitHub handle but I'll post a new comment with his name.

But, I talked about an hour about that with him and so we have a plan. Instead of using batch, which is the worst (and why I struggled this weekend), we're gonna use Powershell, and only use a batch script as an entry point.

Edit: @jialfreShakir, that's what we planned, right?

@louis-bompart I've looked at the original husky repo and found this issue
typicode#201

Give it a try and tell me if it worked.

Then it is only necessary to update the shebang

@tobiastimm the thing is, bash scripts (aka .sh files) are able to be executed only because Git is shipped with its own version of bash.

Mercurial does not ships with such fancy pants, so that's why, alas, this won't work.

@louis-bompart ah yh i forgot that :) haha sry

@louis-bompart how is it going with your issue?

Kinda in a stall right now. I looked at how to do some Powershell scripts this weekend and was a bit confused, it would take me a little while to understand how to do the 'transcoding' from bash to Powershell to be honest.

Do you have some code or a PR I can work on? I don't have a windows environment for development atm, but i will try my best to help

I'm working on a powershell/batch version of the script.

It would be possible to write the scripts for husky-hg in python instead of powershell/batch. This way it would be more plattform independent

That's not a good idea imho, that would mean that you're requiring users to use another language and an interpreter/compiler. That's bulky x)

Mercurial requires python anyway and the user does not deal with the hook scripts.

If this comment https://stackoverflow.com/questions/2482407/adding-hooks-to-tortoisehg/2483645#comment22044918_2483645 on stackoverflow is correct. It would be possible to use the python version tortoisehg for example ships with.