Using subrepositories with bitbucket
Asked Answered
L

2

5

I have encountered this error when trying to push a subrepository to bitbucket:

D:\Work\agile.crm.framework>hg push
warning: bitbucket.org certificate with fingerprint 81:2b:08:90:dc:d3:71:ee:e0:7
c:b4:75:ce:9b:6c:48:94:56:a1:fe not verified (check hostfingerprints or web.cace
rts config setting)
http authorization required
realm: Bitbucket.org HTTP
user: the_drow
password:
warning: bitbucket.org certificate with fingerprint 81:2b:08:90:dc:d3:71:ee:e0:7
c:b4:75:ce:9b:6c:48:94:56:a1:fe not verified (check hostfingerprints or web.cace
rts config setting)
pushing to https://[email protected]/the_drow/agile.crm.framework
pushing subrepo Logging to https://[email protected]/the_drow/agile.crm.fra
mework/Logging
warning: bitbucket.org certificate with fingerprint 81:2b:08:90:dc:d3:71:ee:e0:7
c:b4:75:ce:9b:6c:48:94:56:a1:fe not verified (check hostfingerprints or web.cace
rts config setting)
abort: HTTP Error 404: NOT FOUND

I have encountered this link that describes how to solve the problem but I don't understand what to do.
Should I place my Logging subrepository in D:\Work\?
What exactly should I do with the mercurial subpaths? Will this enable me to clone locally?

EDIT: As requested, here are the contents of my .hgsub file

Logging = Logging
Libelee answered 11/5, 2011 at 16:27 Comment(2)
Can you post the contents of your .hgsub file?Victual
I think the answer other than the one you've marked as correct is the better one. You shouldn't have to decide where to put your repositories based on the limitations of some site. Just accommodate that site's particular limitations with a special-purpose re-write rule.Meadowlark
V
13

As noted in the link that you posted, "You have to make the subrepositories as siblings of the main repository."

So on BitBucket, you need the following structure:

https://bitbucket.org/the_drow/agile.crm.framework
https://bitbucket.org/the_drow/Logging

Then your .hgsub inside agile.crm.framework needs to contain the following:

Logging = ../Logging

Victual answered 11/5, 2011 at 17:21 Comment(2)
So I have to open another repository? That kinda defies the purpose here.Libelee
@the_drow: Adding a subrepo implies that the subrepo is a separate [project | library | whatever] with its own history. If you don't intend to use your Logging repo in multiple projects, then it should not be a subrepo in the first place. If you do want to share it between many projects, then it needs its own space.Victual
S
9

I'm going to bump an old question because I think I have a better solution. I understand why @the_drow has issues with the original accepted answer since with Logging = ../Logging your local machine has to have the Logging subrepo as a peer with the containing/master repo. This kind of defeats the purpose of subrepos from an organization point of view. However, if you use the subpaths feature, you can get Mercurial to rewrite the URI for you on push:

external/my_subrepo = external/my_subrepo

[subpaths]
([https://|ssh://hg@])bitbucket\.org/moswald/my_project/external/my_subrepo = \1bitbucket.org/moswald/my_subrepo

Now my local copy of the my_subrepo sub repository is stored inside my_project as expected, but when I push to Bitbucket, it's rerouted to the real thing. In fact, you can use that rewriting feature to point pretty much anywhere since Mercurial understands Git and SVN. I've got more than a few Bitbucket repositories that have subrepos by other authors who use Github.

Scauper answered 28/7, 2013 at 14:31 Comment(2)
Careful! This had me stumped: period is escaped only in first URL! Left of equal sign: bitbucket\.org - Right of equal sign: bitbucket.orgIncomparable
Good point. Yeah, this was tricky to get exactly correct. :+1:Scauper

© 2022 - 2024 — McMap. All rights reserved.