Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support mercurial subrepositories #1

Open
nathanpalmer opened this issue May 25, 2014 · 4 comments
Open

Support mercurial subrepositories #1

nathanpalmer opened this issue May 25, 2014 · 4 comments

Comments

@nathanpalmer
Copy link

Any plans to support mercurial subrepositories via .hgsub? I just checked out a repository with them and noticed they weren't pulled.

@fingolfin
Copy link
Contributor

That seems tricky to do, esp. if you want it to work bidirectional.

Thing is, git-remote-hg only converts commits and the data contained in them. The actual "checkout" (i.e. the operation which takes a commit ref, extracts a tree ref from it, then updates the working tree to match the files present in that tree) is completely out of our control. So, I think one would have to patch git itself to parse and handle the .hgsub and .hgsubstate files.

That seems overkill. A somewhat simpler solution would be to add some shell scripts which parse .hgsub and .hgsubstate and create / update the required clones for the user. This way, at least pulling from a hg repo works.

Pushing seems even harder, though: "hg commit" tracks changes in the hg subrepositories, but of course "git commit" does not (unless we'd patch it to do that...). Of course one could also add helper scripts to handle the commit for you, and modify the .hgsub and .hgsubstate stuff... But at that point it might be easier to just work with hg directly?

Anyway, this seems to be a bit beyond the scope of a remote helper -- but that's just my two cents :-).

Finally, one might think about mapping hg sub repos to git submodules, but AFAIK, the latter only support adding other git repositories as submodules, not hg and SVN repos. Plus, the semantics of the two are sufficiently different to make this a potential nightmare. Overall I think such a mapping would be a bad idea, but again, that's just my two cents.

@nathanpalmer
Copy link
Author

Fair enough. In the meantime I've work around any need I had for this.

@catskul
Copy link

catskul commented Jul 12, 2016

@nathanpalmer is your work around anything worth sharing?

mnauw added a commit to mnauw/git-remote-hg that referenced this issue Aug 1, 2016
@mnauw
Copy link
Contributor

mnauw commented Aug 1, 2016

As mentioned above, there is probably no reasonable and sane one-to-one native mapping between subrepos and submodules. But some helper script(s) that manage .hgsub and .hgsubstate in a git-submodule-ish way are quite feasible (and can handle the subrepo cloning and fetching, etc)

And in fact, the above commit adds such subrepo management support to a (python) helper script (that handles some things that are beyond the scope of a remote helper).

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

No branches or pull requests

5 participants