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
  1. 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 install hg-git and dulwich
  2. setup a project on GitHub
  3. 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
  4. 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

      if [ -d "imgui" ]; then
          echo "Re-Using ImGUI"
          cd imgui
          hg pull git+ssh://git@github.com:ocornut/imgui.git
          echo "Cloning ImGUI"
          hg clone git+ssh://git@github.com:ocornut/imgui.git
          cd imgui
      hg push -f ssh://hg@bitbucket.org/g-pechorin/imgui
      if [ $retcode -eq 0 ] || [ $retcode -eq 1 ]; then
          exit 0
          exit $retcode
Peter LaValle avatar
About Peter LaValle
honks at geese. speaks the byzantine languages that make the magic boxes do the things.
comments powered by Disqus