Git repo as Hg subrepo

1.2k Views Asked by At

Please explain me an exact right way to add git repository to hg repository as subrepository.

I just need to possibility to

  1. clone hg repository with all its subrepositories (git and hg);
  2. include no source code from subrepo to parent repo, because of subrepo already have its own (git) repo and develops apart from me.

I've tried some things and I am really disoriented now. Should I create hg subrepo to hold git subrepo? What revision directs .hgsubstate (hg or git) to? Should I commit git code to hg subrepo and why?

Now I am trying to embed https://bitbucket.org/espinosa/z025-gwt-maven-alternative-setup into https://bitbucket.org/cube54/mavemples/src. At this moment on bitbucket this task looks done, but when I clone parent (mavemples) repo, it creates empty hg subrepo in my working directory.

My .hgsub:

GWT_multiple_apps = GWT_multiple_apps

[subpaths]
GWT_multiple_apps = git://[email protected]:espinosa/z025-gwt-maven-alternative-setup.git

My .hgsubstate:

0000000000000000000000000000000000000000 GWT_multiple_apps

So when on bitbucket I click on revision number, I get 404 error, because revision 000000000000 of git repo does not exist. Then if I change .hgsubstate like this:

d35a3fb7e627b5598fb763f480e3f76932cf4232 GWT_multiple_apps

So it directs on actual head of git repo, than when I clone my repo, I get this message:

requesting all changes
adding changesets
adding manifests
adding file changes
added 10 changesets with 27 changes to 19 files
updating to branch default
cloning subrepo GWT_multiple_apps from https://[email protected]/cube54/mavemples/git%3A//git%40bitbucket.org%3Aespinosa/z025-gwt-maven-alternative-setup.git
requesting all changes
adding changesets
adding manifests
adding file changes
added 10 changesets with 27 changes to 19 files
abort: unknown revision 'd35a3fb7e627b5598fb763f480e3f76932cf4232'!

And also, my hg subrepo's hgrc file contains this:

[paths]
default = https://[email protected]/cube54/mavemples/git%3A//git%40bitbucket.org%3Aespinosa/z025-gwt-maven-alternative-setup.git

If I remove .hg folder in subrepo folder, then clone git repo to subrepo folder, than TortoiseHg in commit dialog told me that subrepository deleted.

So I don't know what I gotta do at all.

2

There are 2 best solutions below

0
On BEST ANSWER
  1. If you want to make git subrepo, update your hg. Make sure that your hg and git are up to date and installed in the proper way. Latter versions give more comprehensible error messages. When hg gives just abort: message only you can use options --traceback --debug.
    For example hg push --traceback --debug https://someurl
  2. On bitbucket use https URL instead of git@ one. You can copy-paste it from project web-page.
  3. .hgsubstate revisions direct to subrepos' revisions.
  4. If .hgsub is written properly, there will no .hg subfolder appear in your git subrepo folder.

My new .hgsub

GWT_multiple_apps = [git]https://bitbucket.org/espinosa/z025-gwt-maven-alternative-setup.git

.hgsubstate

d35a3fb7e627b5598fb763f480e3f76932cf4232 GWT_multiple_apps
0
On

Please, re-read Git subrepositories from Subrepository Wiki-page and remember format of .hgsub for foreign repo and sequence of operations (maybe BB-superrepo have to be re-created)

nested = [git]git://example.com/nested/repo/path.git