是否可以将 Mercurial 子存​​储库路径从绝对路径更改为相对路径

发布于 2024-09-24 03:26:19 字数 621 浏览 3 评论 0原文

最初我的子存储库是用 .hgsub 中的绝对 URL 定义的,现在这引起了一些麻烦。它使“友好独裁者”工作流程变得不可能,因为我想使用用户从中克隆其工作副本的中间服务器。然后,我会将更改拉到中间服务器,然后再将其推送到主存储库(中间服务器也是持续集成主机,因此我不会将内容直接拉到主存储库)。绝对路径可以防止这种情况,因为克隆的存储库将直接推送到主存储库。

现在的问题是,当我尝试推送在 .hgsub 文件中所做的更改时,我的 hg 服务器会抛出 404 错误。下面是我所做的更改的示例

# original subrepo definition
common = http://hgserver/disp/common
# and after the change
common = common

这不起作用,它会发出以下错误

$ hg push
pushing to http://hgserver/disp
pushing subrepo common
abort: HTTP Error 404: Not Found

是否可以通过这种方式更改子存储库配置,或者我是否必须重新创建整个存储库?

Originally my subrepo's were defined with an absolute URL in .hgsub, which is now causing some trouble. It makes "friendly dictator" workflow impossible since I want to use an intermediate server where users clone their working copies from. Then I would pull changes to the intermediate server before pushing them to the master repository (intermediate server is also the continuous integration host, thus I won't pull stuff directly to the master). The absolute paths prevent this as the cloned repo's would be pushed directly to the master.

Now the problem is that my hg server spews out 404 errors when I try to push my changes made in the .hgsub file. Below is an example of a change I made

# original subrepo definition
common = http://hgserver/disp/common
# and after the change
common = common

This does not work, it spews out the following error

$ hg push
pushing to http://hgserver/disp
pushing subrepo common
abort: HTTP Error 404: Not Found

Is is possible to change the subrepo configuration in this way or do I have to recreate the whole repository?

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

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

发布评论

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

评论(2

烏雲後面有陽光 2024-10-01 03:26:19

是的,它应该是可以改变的(你是对的,relative 可以提供更好的工作流程),但是,相对 url 路径被视为相对于存储库的 hg root ,其中 < code>.hgsub 存在——而不是你碰巧推送的地方(来自 .hg/hgrcdeafult 条目在 这是一个非常正常的

子存储库布局:

on server http://hgserver/disp/main
    http://hgserver/disp/common # the "common" repo
    http://hgserver/disp/main # the main repo
        http://hgserver/disp/main/.hgsub # contains "common=../common"

克隆后,一切正常,并且相同的 hgsub 在服务器上也运行良好

。设置,虽然我没有尝试从一种切换到另一种,但我认为如果您使用我在上面显示的 "../sibling" 执行“next to”样式的子存储库,它会工作正常。

Yes, it should be changeable (and you're right that relative makes for a better work flow), however, the relative url path is taken as relative to the hg root of the repo in which the .hgsub lives -- not to where you happen to be pushing (which comes from .hg/hgrc's deafult entry in the paths section.

Here's a pretty normal subrepo layout:

on server http://hgserver/disp/main
    http://hgserver/disp/common # the "common" repo
    http://hgserver/disp/main # the main repo
        http://hgserver/disp/main/.hgsub # contains "common=../common"

Then after a clone everything just works and the same hgsub works fine on the server too.

There are a lot of stack overflow questions where people walk through the best layouts for relative subrepo setups, and while I've not tried switching from one to the other I think if you do the "next to" style of sub-repo with "../sibling" I show above it'll work fine.

归途 2024-10-01 03:26:19

请注意,在以下情况下存在问题:

  1. 使用 ssh(顶级存储库)
  2. 相对于顶级列出的子存储库(如此处建议 - 通常需要) - 以及
  3. 绝对路径引用的顶级(ssh)存储库。

请参阅 http://mercurial .808500.n3.nabble.com/subrepos-with-ssh-urls-with-absolute-paths-td1462834.html。从本质上讲,它强制在 .hgsub 文件中使用绝对路径 - 这会破坏所提到的“友好独裁者”/集成服务器工作流程。

我们非常需要一个解决方案,但现在我们必须使用绝对路径并在 [subpaths] 部分中针对每个用户进行重新映射。 :-(

注意:现已修复: https://www.mercurial-scm.org/repo/hg-stable/rev/71ea5b2b9517 这是 Hg 版本 1.8.3(及更高版本)

Note that a problem exist(ed) when:

  1. Using ssh (top repo)
  2. Subrepos listed relative to top (as suggested here - and generally desired) - and
  3. The top (ssh) repo referenced by absolute path.

See http://mercurial.808500.n3.nabble.com/subrepos-with-ssh-urls-with-absolute-paths-td1462834.html. Essentially it forces the use of absolute paths in the .hgsub file - which break the referred "friendly dictator" / integration server workflow.

A solution is much desired, but for now we'll have to use absolute paths and do a per-user re-map in a [subpaths] section. :-(

Note: This is now fixed: https://www.mercurial-scm.org/repo/hg-stable/rev/71ea5b2b9517 This is Hg version 1.8.3 (and later)

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