Mercurial - Copy latest revision to an arbitrary folder on commit if commit happens on a certain named branch (hook)?
I have a mercurial repository setup with a few named branches. I want to check if a commit occurs into a named branch of a certain name, and then push a copy of the head revision of the named branch to a "publish" folder.
Example: Bobby commits a change to the "Development" branch. The script sees it was commited to the "Development" branch and then checks out Bobby's commit (the latest in the branch) to /publish. If Bobby commits the change to the "Test" branch the copy to publish does not occur.
I have been looking through the documentation, and have been able to have my hooks call an arbritrary bash script on commit, but I am having trouble making use of the variables to handle the above logic, as I am not able to find good documentation on the exposed variables.
A开发者_StackOverflow社区ny one able to help me out here?
I managed to get this working by cloning a repository into my publish folder. Then in the .hg/hgrc file for my project:
[hooks]
commit = ./publish projectname
Then for publish:
#!/bin/sh
name=$1
cd /publish/projectname
hg pull
hg update dev
精彩评论