I have a mercurial repository and a git repository. Both are using the same code and same change-sets.
When I make any changes to my hg repository, commit it and push it to hg repository, the same changes should get pushed to the git repository also. Is this possible? How?
Follow-up to planetmaker's answer
[paths]
section of local repository[hooks]
section of repositoryhg push GIT
, where GIT - name of your git-repository from[paths]
Final notes and samples
Beware: outgoing hook fired in repo in two cases: on push and on bundle. additional push to GIT in case of using bundle will do nothing dangerous in repote Git (more precisely - do nothing, because haven't anything for push), but if you want to be perfect, you can (in simple if) check value of an environment variable named HG_SOURCE and push only if it equal to "push"
My real two-remotes repo
and this way I'll have push to GitHub's repo after push to SF's repo - and push can be done from any Mercurial client: command line, TortoiseHG, SmartGit.
(I don't use hook name, because it's single hook for now, I have to run Pageant with my key for accessing ssh-type of Git-repo before pushing to sf)
For pure CLI use-case you can also use the lazy way: create alias, which will combine two pushes in new command and push from command line with this command only, not "classic"
hg push
. For my repo in sample it can be something like (dirty fast sample without error-checking)and only
hg pushc
for pushes