Mirroring Git/GitHub to Hg/BitBucket
This seemed a lot longer when I planned it in my notebook at lunch.
GitHub user | project (both sides) | BitBucket user | SCM | Schedule |
---|---|---|---|---|
ocornut | imgui | g-pechorin | None | Periodic |
- Install hg-git
- You’ll have to do this on the Jenkins server
- You’ll have to do it either for the Jenkins user or all
- I’m using an OsX machine as my host, so I was able to use
easy_install
to installhg-git
anddulwich
- setup a project on GitHub
- create a Jenkins Freestyle project which runs periodically
- Polling the SCM was NOT an option since there’s no
default
branch on GitHub- … this is a quirk of
hg-git
… I think - … IIRC/YRMV - so sling me a tweet or whatever if I’m wrong
- … this is a quirk of
- Polling the SCM was NOT an option since there’s no
program the job to pull from git, push to hg, and ignore results of
1
this was only elaborate because I needed it to not fail when there were no changes
#!/bin/bash if [ -d "imgui" ]; then echo "Re-Using ImGUI" cd imgui hg pull git+ssh://git@github.com:ocornut/imgui.git else echo "Cloning ImGUI" hg clone git+ssh://git@github.com:ocornut/imgui.git cd imgui fi hg push -f ssh://hg@bitbucket.org/g-pechorin/imgui retcode=$? if [ $retcode -eq 0 ] || [ $retcode -eq 1 ]; then exit 0 else exit $retcode fi