Follow-up to planetmaker's answer
- Install hg-git extension
- (for simplicity, not mandatory) Add remote git-repo to
[paths]
section of local repository
- Push to Git-repo by hand, get successful push results
- Create outgoing hook in
[hooks]
section of repository hg push GIT
, where GIT - name of your git-repository from [paths]
- Have fun
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
[paths]
github = git+ssh://git@github.com/lazybadger/Fiver-l10n.git
default = ssh://bigbadger@hg.code.sf.net/u/bigbadger/code
...
[hooks]
outgoing = hg push github
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)
[alias]
pushc = !hg push && hg push github
and only hg pushc
for pushes