在 Subversion 中标记存储库的一部分

发布于 2024-07-08 12:25:20 字数 823 浏览 6 评论 0原文

我有 CVS 背景。 我目前正在研究使用 SVN 进行项目。 我处理的代码往往位于以下目录结构中。

项目\libs\lib1

项目\libs\lib1\test

项目\libs\lib1\mock

项目\libs\lib2

等。

当我在 CVS 中标记一个版本时,我倾向于创建两个标记,其中一个是“project-release-1”其中之一是“project-release-1-with-tests”。 “project-release-1”标签不包括测试目录和模拟目录以及可能的其他一些文件。 我们的想法是,我们通常不会将测试源发送给客户,通过导出“project-release-1”标签,我们可以获得客户的一组源代码,我们可以将其发送给他们,并通过在“project-release-1-with-tests”标签我们得到了所有可以用于分支(如果需要持续开发)的标签。

我如何使用 SVN 做类似的事情? 最好采用可编写脚本的形式; 使用 SVN,我们每个项目都有一个脚本,它将应用这两个标签并通过简单地从测试和模拟目录中删除标签等来创建客户端标签...

我猜在 SVN 中我会创建“带有测试”标签,然后(以某种方式)检查出来,删除测试和模拟目录并创建客户端发布标签?

更新

我决定改变我的做事方式...而不是每个项目都有一个脚本来设置我的旧样式双标签,我现在每个项目都有一个脚本来获取标记的版本(其中包括我不运送给客户的东西)并删除我不运送给客户的东西。 工作完成,只需要一个标签。

I come from a CVS background. I'm currently investigating using SVN for a project. The code that I work on tends to be in the following directory structure.

project\libs\lib1

project\libs\lib1\test

project\libs\lib1\mock

project\libs\lib2

etc.

When I tag a release, in CVS, I tend to create two tags one being "project-release-1" and one being "project-release-1-with-tests". The "project-release-1" tag excludes the test directories and mock directories and possibly some other files. The idea being that we often don't ship our test source to clients and by doing an export of the "project-release-1" tag we get a client's set of source that we can ship to them and by doing a checkout on the "project-release-1-with-tests" tag we get the whole lot that we can use for branching if need be for ongoing development.

How do I do something similar with SVN? Ideally in a form that can be scriptable; with SVN we have a script per project which will apply both tags and create the client tag by simply removing the tag from the test and mock directories, etc...

I'm guessing that in SVN I'd create the "with tests" tag, then (somehow) check that out, delete the test and mock directories and create the client release tag?

Update:

I've decided to change how I do things... Rather than having a script per project that sets up my old style twin tags I now have a script per project that takes the tagged release (which includes the stuff that I don't ship to clients) and removes the stuff that I don't ship to clients. Job done, only one tag needed.

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

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

发布评论

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

评论(2

梦行七里 2024-07-15 12:25:20

我不知道这是否是“正确”的答案,但我可以想到两个选择。

A. 标记并删除:

  1. 将您的 /project/libs 目录标记为 project-release-1;
  2. 从project-release-1 中删除“test”和“mock”目录。
    或者,首先创建一个包含所有内容的project-release-1-with-tests 标记,然后将目录标记(复制)为project-release-1 并重复上面的#2。

B. 使用“externals”:

  1. 在tags下创建一个空的project-release-1目录。 不要真正标记,只需创建目录。
  2. 编辑该目录的属性,添加名为“svn:externals”的属性。 在该属性的值中输入:
    lib1 -r $REV url:to/project/libs/lib1
    lib2 -r $REV url:to/project/libs/lib2

其中 $REV 是标记源代码的修订号。
稍后,当您查看“无测试”目录时,您将获得两个“标记”目录。

我相信第一个选项更好,因为分析分支和标签的工具将更好地理解您所做的事情。

顺便说一句,我想知道为什么你想要无测试标签; 为什么你对标签中的测试感到困扰?

  • 诺姆。

I don't know if this is the "correct" answer, but I can think of two options.

A. Tag and delete:

  1. Tag your /project/libs directory as project-release-1;
  2. Delete "test" and "mock" directories from project-release-1.
    Alternatively, first create a project-release-1-with-tests tag with everything, then tag (copy) that directory as project-release-1 and repeat #2 above.

B. Use "externals":

  1. Create an empty project-release-1 directory under tags. Don't really tag, just create the directory.
  2. Edit the properties of that directory, add a property named "svn:externals". In that property's value enter:
    lib1 -r $REV url:to/project/libs/lib1
    lib2 -r $REV url:to/project/libs/lib2

where $REV is the revision number of the tagged source code.
Later when you'll check out the "without tests" directory you'll get the two "tagged" directories.

I believe the first option is better, as tools that analyze branches and tags will have a better change of understanding what you did.

On a side note, I wonder why you'd want the test-less tag; Why does it bother you that you have the tests in the tag?

  • Noam.
王权女流氓 2024-07-15 12:25:20

标签只是一个副本,就像任何其他副本一样。 因此,您可以在标签中创建一个空目录,以标记该版本,然后在其中创建两个目录 - 一个用于包含测试的版本,另一个用于不带测试的版本。

A tag is just a copy like any other copy. So you could create an empty directory in tags, to mark that release, then create two directories inside that--one for the release with tests, and the other for the release without the tests.

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