Skip to content

Instantly share code, notes, and snippets.

@K4zuki
Last active May 27, 2019 19:32
Show Gist options
  • Save K4zuki/c7845778eb1c85b04554fd440e3f880e to your computer and use it in GitHub Desktop.
Save K4zuki/c7845778eb1c85b04554fd440e3f880e to your computer and use it in GitHub Desktop.
can make a hg repo as git submodule?

Idea

  • clone a mbedTM repository as mercurial repo
  • put the cloned repo to github(or similar) as a git repo with mbed repo revision status history
  • another git repo uses the converted github repo as a submodule

Hints

  • fast-export
    • seems best, but one direction convert?
  • cosmin/hg-git
    • clones mercurial repo as git repo, uses fast-export, but has issue
      • I faced the same problem also(automatically aborts)
      • not tested what happens to mbed repo with this issue
  • glandium/git-cinnabar
    • seems to have forward/backward converters
    • not tested
  • felipec/git-remote-hg
    • most likely this is the official helper from git project

Requirement

  • python 2.7 and mercurial

Now working

  • $ sudo apt-get install git-remote-hg
  • Ubuntu 16.04 has a package

Clone and commit

$ git clone hg::https://k4zuki:<password>@developer.mbed.org/users/k4zuki/code/AkiSpiLcd/
$ cd AkiSpiLcd
$ touch README.md
$ git add README.md
$ git commit -m"add README.md"

Try a push back to mbed repository

$ git push

searching for changes
no changes found
searching for changes
remote: adding changesets
remote: adding manifests
remote: adding file changes
remote: added 1 changesets with 1 changes to 1 files
To hg::https://k4zuki:********@developer.mbed.org/users/k4zuki/code/AkiSpiLcd/
   b7cc2d6..3b430ff  master -> master

Add github remote, and push to it

$ git remote add github git@github.com:K4zuki/AkiSpiLcd.git

if you have made non-blank repo, pull first

$ git pull github master
*** merge commit editor appears; edit if necessary, and save-close ***

then push both remotes

$ git push origin master
$ git push github master
@hsgw
Copy link

hsgw commented Aug 22, 2016

Using git-hg

But this is really complicated way.
I think mbed repository should be managed in git too.

A simplest way is pull and push manually :)

@K4zuki
Copy link
Author

K4zuki commented Aug 24, 2016

Thanks!!
It seems moved to https://github.com/cosmin/git-hg

@Ruin0x11
Copy link

git-hg is broken for me due to this issue. I used git-remote-hg instead and it seemed to work.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment