如何更新 Subversion 外部组件

发布于 2024-10-03 19:54:06 字数 234 浏览 0 评论 0原文

我们有几个 Subversion 存储库:一个用于公共代码,一个用于每个顶级项目。顶级项目有一个 svn:external 链接到公共存储库的主干。

在构建项目的版本之前,我们创建顶级项目的分支,并在公共存储库中创建并行分支。

我们如何自动确保分支顶级项目中的 svn:external 属性指向公共目录中的并行分支 - 目前它将指向公共存储库中的“trunk”。我们目前必须在分支项目中手动编辑它。

谢谢

We have several subversion repositories: one for common code and one for each top level project. The top level projects have a svn:external link to the trunk of the common repository.

Before we build a release of a project we create a branch of the top level project and also create a parallel branch in the common repository.

How can we automatically ensure the svn:external property in the branched top level project points to the parallel branch in the common directory - currently it will be pointing to "trunk" in the common respository. We are currently having to manually edit this in the branched project.

Thanks

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

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

发布评论

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

评论(1

以可爱出名 2024-10-10 19:54:06

如果我理解你的意思,你想确保 foo 和 bar 共享同一个分支。 foo 是您的主项目,并且其上有一个 svn:externals 指向 bar。当您分支 foo 时,您需要确保 bar 使用相同的分支。确保这一点的唯一方法是在存储库的根目录而不是项目的根目录中使用 tagsbranches 目录创建存储库(就像大多数网站一样) )。

然后,您可以使用相对外部引用从包含 svn:externalfoo 目录指向 bar。另外,如果您使用相同的标签标记 foo 和 bar,则 foo 和 bar 将保持它们的关系:

$ svn propset svn:externals ../../bar common

如果您的分支位于存储库的根目录,则 common 目录将指向同一分支对于 foo 来说,就像它在 bar 上一样。

snv:externals 的一个大问题是,如果您不小心,您就会指向所链接目录的不断变化的版本。假设有人

$ svn propset svn:externals /projects/bar/trunk common

在我的 foo 项目中这样做了。我进行发布并将 foo 复制到标签。但是,当有人更新 bar/trunk 时,我标记的 common 目录将会被修改。这使得重建foo几乎不可能。

当我使用 svn:externals 时,我总是确保链接到 bar 的标记版本或特定修订版,并且如果我链接到特定版本如果有人决定删除我链接到 svn:externals 属性的目录,我还会将我的 URL 与该修订版挂钩。

Subversion 中没有任何内容会自动更新您的 svn:externals 属性,但您可以使用

$svn propget -v -R svn:externals .

我发现 svn:externals 搜索目录树上的所有 svn:externals > 通常最终会带来比其价值更大的痛苦。

相反,我只是将 bar 的构建对象或源代码的压缩副本存储在我的发布存储库中,并且作为构建过程的一部分,我将对象或压缩源代码从我的发布存储库中复制出来。

即使我没有做 Maven 项目,甚至没有在基于 Java 的项目中工作,我也使用 Nexus 或 Artifactory 等 Maven 站点存储库作为我的发布存储库。本地 Maven 存储库提供了上传和下载依赖包所需的所有工具,此外 Maven 还具有发布存储库(其中代码永远不会更改)和快照的概念。 em> 存储库,您计划在其中发布代码,但它可能会发生变化。如果您怀疑 bar 可能因为 foo 中需要的内容而发生变化,这会很有帮助。

If I understand you, you want to make sure that foo and bar share the same branch. foo is your master project and has an svn:externals on it somewhere pointing to bar. When you branch foo, you want to make sure bar is using the same branch. The only way to ensure that is to create your repository with the tags and branches directories at the root of your repository instead of at the root of the project (like most sites do).

Then you can use relative external references to point from the foo directory that contains the svn:external back to bar. Also, if you tag foo and bar with the same tag, foo and bar will maintain their relationship:

$ svn propset svn:externals ../../bar common

If your branches were at the root of your repository, then the common directory will be pointing to the same branch for foo as it is on bar.

The big problem with snv:externals is that if you're not careful, you're pointing to an ever changing version of the directory you're linking to. Let's say someone did this:

$ svn propset svn:externals /projects/bar/trunk common

in my foo project. I do a release and copy foo to a tag. However, the common directory that I've tagged will be modified when someone updates bar/trunk. This makes it almost impossible to rebuild foo.

When I use svn:externals, I always make sure I'm linking to either a tagged version of bar, or a specific revision, and if I am linking to a specific revision, I also peg my URL to that revision in case someone decides to delete the directory I'm linking to my svn:externals property.

There's nothing in Subversion that will automatically update your svn:externals properties, but you can search for all svn:externals on a directory tree by using

$svn propget -v -R svn:externals .

I've found that svn:externals usually ends up being a bigger pain than it's worth.

Instead, I simply store the built object of bar or a zipped up copy of the source in my release repository, and as part of my build procedure, I copy the object or zipped source out of my release repository.

I use Maven site repositories like Nexus or Artifactory as my release repository even if I am not doing a Maven project or even working in a Java based project. The local Maven repository provides all the tools you need to upload and download your dependent packages, plus Maven has the concept of release repository -- where the code never changes -- and a snapshot repository where you're planning on releasing the code, but it could change. This is helpful if you suspect that bar could change because of stuff you need in foo.

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