gpt4 book ai didi

svn - Subversion 存储库布局

转载 作者:行者123 更新时间:2023-12-03 03:32:25 25 4
gpt4 key购买 nike

大多数 subversion 工具都会使用/trunk、/branches 和/tags 创建默认存储库布局。该文档还建议不要为每个项目使用单独的存储库,以便更轻松地共享代码。

遵循这个建议,我拥有了一个具有以下布局的存储库:

/trunk      /Project1      /Project2/branches         /Project1         /Project2/tags     /Project1     /Project2

等等,你就明白了。随着时间的推移,我发现这种结构有点笨拙,我想到这些建议还有另一种解释,例如:

/Project1         /trunk         /branches         /tags/Project2         /trunk         /branches         /tags       

那么,人们使用哪种布局,为什么?或者 - 有另一种方法可以完成我完全错过的事情吗?

最佳答案

我发现 Subversion Repository Layout博客文章很好地总结了这一点:

(...) there are several common layouts that have been adopted by the community as best practices and therefore one could think of these as recommendations. If your repository is accessible to the public, following these conventions might make it easier for users that have accessed other Subversion repositories to find what they are looking for.

There are two commonly used layouts:

trunk
branches
tags

This first layout is the best option for a repository that contains a single project or a set of projects that are tightly related to each other. This layout is useful because it is simple to branch or tag the entire project or a set of projects with a single command:

svn copy url://repos/trunk url://repos/tags/tagname -m "Create tagname"

This is probably the most commonly used repository layout and is used by many open source projects, like Subversion itself and Subclipse. This is the layout that most hosting sites like Tigris.org, SourceForge.net and Google Code follow as each project at these sites is given its own repository.

The next layout is the best option for a repository that contains unrelated or loosely related projects.

ProjectA
trunk
branches
tags
ProjectB
trunk
branches
tags

In this layout, each project receives a top-level folder and then the trunk/branches/tags folders are created beneath it. This is really the same layout as the first layout, it is just that instead of putting each project in its own repository, they are all in a single repository. The Apache Software Foundation uses this layout for their repository which contains all of their projects in one single repository.

With this layout, each project has its own branches and tags and it is easy to create them for the files in that project using one command, similar to the one previously shown:

svn copy url://repos/ProjectA/trunk url://repos/ProjectA/tags/tagname -m "Create tagname"

What you cannot easily do in this layout is create a branch or tag that contains files from both ProjectA and ProjectB. You can still do it, but it requires multiple commands and you also have to decide if you are going to make a special folder for the branches and tags that involve multiple projects. If you are going to need to do this a lot, you might want to consider the first layout.

所以,解释一下:

  • 对单个或多个相关项目使用第一个布局。
  • 不相关项目使用第二种布局。

整篇文章值得一读。

关于svn - Subversion 存储库布局,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/2611237/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com