是否可以将 Mercurial 子存储库路径从绝对路径更改为相对路径
最初我的子存储库是用 .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 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
是的,它应该是可以改变的(你是对的,relative 可以提供更好的工作流程),但是,相对 url 路径被视为相对于存储库的
hg root
,其中 < code>.hgsub 存在——而不是你碰巧推送的地方(来自.hg/hgrc
的deafult
条目在这是一个非常正常的
子存储库布局:
克隆后,一切正常,并且相同的 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
'sdeafult
entry in thepaths
section.Here's a pretty normal subrepo layout:
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.请注意,在以下情况下存在问题:
请参阅 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:
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)