如何使用 .hgsub 中的 [subpaths] 部分重新映射本地子存储库以在 bitbucket 中使用

发布于 2024-12-15 15:56:35 字数 1959 浏览 2 评论 0 原文

<块引用>

注意:由于我是新人,他们不允许我发布链接,这意味着所有配置文件都将具有格式不正确的 URL。这只是为了绕过 stackoverflow 的限制,我在实践中使用了正确的 URL。

我尝试设置一个子存储库,我们称之为 A/B。为了使克隆正常工作,我想要一个正常的相对路径将其放入存储库中,因此从逻辑上讲我有 .hgsub

A/B = A/B

但是,当尝试将其推入 bitbucket 时,我得到通常的 404 (未找到)错误,因为 bitbucket B 上不能是本地的,实际上是另一个项目(http s://[email protected]/username/B)

然后我说,好吧,为了让 bitbucket 工作,我可以放入 .hgsub

A/B = https://[email protected]/username/B

但是,我最近发现据说这里有一个解决方法: https://www.mercurial-scm.org/wiki/Subrepository 您使用的位置[subpaths] 部分,以便本地克隆正常工作,但 bitbucket 将请求项目的特殊路径。

所以我尝试复制他们的说明。 .hgsub:

A/B = A/B
[subpaths]
https://[email protected]/username/project/A/B = https://[email protected]/username/B

但我得到了同样的 404 错误。据说每当它看到 https://[email protected]/username/project/A/B,它将重新映射到后者 https://[email protected]/username/B 可以使用。然而,情况似乎并非如此。我也尝试过不将 username@ 放在开头。

任何帮助将不胜感激。 :)

NOTE: Since I'm new they won't let me post links, which means all the config files will have improperly formatted URLs. This is simply to get around stackoverflow's limitations, I have used the correct URL in practice.

I tried to setup a subrepo, let's call it A/B. So that cloning works properly, I wanted a normal relative path to put it inside the repository, so logically I had .hgsub:

A/B = A/B

However when trying to push this into bitbucket I get the usual 404 (NOT FOUND) error because on bitbucket B cannot be local, and is actually another project (http s://[email protected]/username/B)

So then I said, OK just to make bitbucket work I can put .hgsub:

A/B = https://[email protected]/username/B

However, I recently found out that supposedly there was a workaround here: https://www.mercurial-scm.org/wiki/Subrepository where you use the [subpaths] section so that cloning locally works normal, but bitbucket will request the special path for the project.

So I tried copying their instructions. .hgsub:

A/B = A/B
[subpaths]
https://[email protected]/username/project/A/B = https://[email protected]/username/B

But I get the same 404 error. Supposedly whenever it sees https://[email protected]/username/project/A/B, it will instead remap to the latter https://[email protected]/username/B which will work. However, this doesn't appear to be the case. I have also tried without putting the username@ at the beginning.

Any help would be much appreciated. :)

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

苍白女子 2024-12-22 15:56:35

事实证明,我认为我正在另一个仓库进行测试,所以它没有抓住比赛。这是所有感兴趣的人的工作配置:

.hgsub:

A/B = A/B

[子路径]

bitbucket\.org/用户名/项目名/A/B = bitbucket.org/用户名/B

Turns out I think I was testing at a different repo so it wasn't grabbing the match. Here's the working config for all those interested:

.hgsub:

A/B = A/B

[subpaths]

bitbucket\.org/username/projectname/A/B = bitbucket.org/username/B

顾北清歌寒 2024-12-22 15:56:35

您的 subpaths 配置似乎不正确。左侧的字符串必须是与 .hgsub 中的条目匹配的模式。我认为您想要类似的内容:

[subpaths]
A/B = https://[email protected]/username/B

更多信息可以在以下位置找到:

以下是 hgrc 帮助的摘录:

定义子存储库源位置重写规则的形式:

<前><代码> <模式> =<替换>;

其中“pattern”是与源匹配的正则表达式
“replacement”是用于重写它的替换字符串。团体可以是
在“模式”中匹配并在“替换”中引用。例如:

http://server/(.*)-hg/ = http://hg.server/\1/

将“http://server/foo-hg/”重写为“http://hg.server/foo/”。

It looks like your subpaths config is incorrect. The string on the left side must be a pattern that matches an entry in your .hgsub. I think you want something like:

[subpaths]
A/B = https://[email protected]/username/B

More info may be found in:

Here is an excerpt from the hgrc help:

Defines subrepositories source locations rewriting rules of the form:

  <pattern> = <replacement>

Where "pattern" is a regular expression matching the source and
"replacement" is the replacement string used to rewrite it. Groups can be
matched in "pattern" and referenced in "replacements". For instance:

  http://server/(.*)-hg/ = http://hg.server/\1/

rewrites "http://server/foo-hg/" into "http://hg.server/foo/".
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文