I have a bash script that I'm trying to execute anytime an hg update
occurs. The goal of this bash script is to switch to the correct virtualenv. For the sake of simplicity, this script is called .test
- shown as follows:
#!/bin/bash
echo 'testing hg update hook'
source ~/.virtualenvs/myvirtualenv/bin/activate
Whenever I call this script from my shell using source .test
everythying works properly; I can see the results of echo and my shell changes to reflect the activated virtualenv
However,when I do an hg update
, the virtualenv is not being activated. The script is firing as I can see the echo result; however, my shell is not updated to reflect the activated virtualenv. Below is the hook setup in my .hg/hgrc
file is below. Any ideas why my virtualenv isn't being activated in this hook?
[hooks]
# Update to the correct virtualenv when switching branches (hg update branchname)
update = source .test
UPDATE 1: Per this answer, I don't believe the hg update
hook is firing in my current shell; which is why the virtualenv activates when I run the script manually but fails from the hook