cellsheet
cellsheet

Reputation: 466

git submodule add failed with bitbucket repo

I'm trying to add a repo as a submodule for my project as it will depend on it. The project is hosted on bitbucket, and when I tried to add it using this: git submodule add https://bitbucket.org/blueluna/transmissionrpc, I got the following:

Cloning into 'transmissionrpc'...
fatal: repository 'https://bitbucket.org/blueluna/transmissionrpc/' not found
Clone of 'https://bitbucket.org/blueluna/transmissionrpc' into submodule path 'transmissionrpc' failed

I clicked on the link itself in terminal, which led to a valid link. I'm not sure how to add this in my github repo. It will also give me issues through git clone in both SSH and HTTPS. Note, the original command copied for cloning this repo is as follows: hg clone ssh://[email protected]/blueluna/transmissionrpc, which uses mercurial as far as I know.

Upvotes: 1

Views: 643

Answers (1)

VonC
VonC

Reputation: 1325976

Since it is a mercurial repo, the error is expected: git cannot clone it as a (git) submodule repo.

You would need a git repo in order to add your repo as a (git) submodule.
That would involve a conversion, as mentioned in "Is there a way to use a Mercurial repository as Git submodule?".

The OP cellsheet reports that the conversion part fails with repo.branchtags() unavailable in Mercurial 2.9 , but it can be fixed with the following patch to hg-fast-export.py:

270a271,287

> def legacy_branchtip(repo, heads):
>     '''return the tipmost branch head in heads'''
>     tip = heads[-1]
>     for h in reversed(heads):
>         if not repo[h].closesbranch():
>             tip = h
>             break
>     return tip
> 
> def legacy_branchtags(repo):
>     '''return a dict where branch names map to the tipmost head of
>     the branch, open heads come before closed'''
>     bt = {}
>     for bn, heads in repo.branchmap().iteritems():
>         bt[bn] = legacy_branchtip(repo, heads)
>     return bt
> 
272c289
<   branches=repo.branchtags()
---
>   branches=legacy_branchtags(repo)
> 

Blockquote

Upvotes: 3

Related Questions