Comments on Mercurial hooks

  1. Fun with remote execution policy

    Thanks for the info. I was trying out your suggestions above when I encounter the message:
    File C:\Temp\SamplePowershellScripts\Sample.ps1 cannot be loaded because the execution of scripts is disabled on this system. Please see "get-help about_signing" for more details.

    I ran Set-ExecutionPolicy unrestricted and tried again, and the same error. If I navigate to the directory that contains my Powershell script, and run it within the Powershell command prompt, my script runs fine. But when I try to run the same script as a Mercurial commit script, it throws the error. Is there a trick for getting around this?

  2. That's odd

    Strange. I'm not sure what's going on there. I actually don't use this method anymore (I ported my hook script to bash and moved it to the server), but I don't recall having to do anything special to get the Powershell script to run. My execution policy has always been set to RemoteSigned and it worked just fine.

    The only thing I can think of that might be an issue is if the hook script is not being run as your user account. I believe that in Win7 the execution policy is per-user, so if the script runs as another account you would have to set the execution policy for that account too. I'm not sure if that's applicable to your situation, though. I just don't have any other brilliant suggestions.

  3. Try changing scope

    Ryan - try
    Set-ExecutionPolicy RemoteSigned -Scope LocalMachine

Add your comments #

A comment body is required. No HTML code allowed. URLs starting with http:// or ftp:// will be automatically converted to hyperlinks.