在版本控制中组织我自己的外部库
我想建立一个 SVN 存储库来“修订控制”我的项目。目前我的工作区看起来像这样,我打算保持它这样:
\workspace
\myPrj1
\myPrj2
\myLibBase
\myLibA
\myLibB
myPrj1
正在使用myLibBase
和myLibA
。 myPrj2
使用 myLibBase
和 myLibB
。我将有更多的项目即将推出,这些项目将使用这些库。我自己已经编写了并且正在编写这些库。当我从事任何项目时,我不断尝试改进项目和库:查找错误、添加功能等。
现在我如何在存储库中组织这些项目?
这是我的想法,但这是最好的解决方案吗?
- 我将始终使用工作区作为项目根。
- 我将始终将项目正在使用的库包含在 snv 项目文件夹中
- 我将始终为库提供其他 snv 项目
然后在存储库中,上面的示例将如下所示:
\repository
\myPrj1
\myPrj1
\myLibBase
\myLibA
\myProj2
\myProj2
\myLibBase
\myLibB
\myLibBase
\myLibBase
\myLibA
\myLibA
\myLibB
\myLibB
像这样
...关于项目:
每当我签入项目的工作副本时,我总是拥有所有源,包括一起签入的库。因此,当我签出修订版时,我总是会获得签入时的所有源(包括库)。
...关于库:
此外,当我认为这是一个很好且稳定的版本时,我可以在库 svn 项目中签入库的工作副本。当我创建新项目时,可以签出该版本。
有人可以确认这是一个好主意吗?最佳实践?有更好的方法吗?我可以找到有关该主题的文档/教程/..吗?在网络上?在书里?
I want to set up a SVN repository to "revision-control" my projects. Currently my workspace looks like this, and I intend to keep it like that:
\workspace
\myPrj1
\myPrj2
\myLibBase
\myLibA
\myLibB
myPrj1
is using myLibBase
and myLibA
. myPrj2
is using myLibBase
and myLibB
. I will have more Projects coming up, that will use the libraries. I've written and am writing the libraries myself. While I am working on any of the projects I constantly tried to improve not just the project but also the libraries: find bugs, add features, etc.
Now how do I organize this in a repository?
This is my idea, but is it the best solution?
- I will always use the workspace as the project root.
- I will always include the libraries a project is using in the snv project folder
- I will always have additional snv projects for the libraries
Then in the repository the above example would look like this:
\repository
\myPrj1
\myPrj1
\myLibBase
\myLibA
\myProj2
\myProj2
\myLibBase
\myLibB
\myLibBase
\myLibBase
\myLibA
\myLibA
\myLibB
\myLibB
Having it like this
...concerning the projects:
Whenever I check-in a working-copy of a project, I always have all sources, including the libraries check-in together. So when I check-out a revision, I always get all sources (including the libraries) as they were at the moment of the check-in.
...concerning the libraries:
Additionally I can check-in a working-copy of a library in the libraries svn project, when I think it is a nice and stable version. That version could then be checked-out when I create a new project.
Can somebody confirm that this is a good idea? Best practise? Is there a better approach? Can I find documentation/tutorials/.. on this topic? On the web? In a book?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
看来这就是您要找的: 外部
摘抄:
“有时,构建由许多不同的签出组成的工作副本很有用。例如,您可能希望不同的子目录来自存储库中的不同位置,或者可能来自不同的存储库。您当然可以设置这样的手动场景 - 使用 svn checkout 创建您想要实现的嵌套工作副本结构,但是如果此布局对于使用您的存储库的每个人都很重要,那么每个其他用户都需要执行与您相同的签出操作。 ”。
它基本上按照你想要的方式工作。当您出于某种原因需要使用不同的修订版时,拥有多个依赖项副本是可以的,也是必要的。
Seems this is what you're looking for: Externals
Excerpt:
"Sometimes it is useful to construct a working copy that is made out of a number of different checkouts. For example, you may want different subdirectories to come from different locations in a repository or perhaps from different repositories altogether. You could certainly set up such a scenario by hand—using svn checkout to create the sort of nested working copy structure you are trying to achieve. But if this layout is important for everyone who uses your repository, every other user will need to perform the same checkout operations that you did."
It basically works the way you want. It's OK, and necessary, to have multiple copies of dependencies when you need them to be at different revisions for whatever reason.
在存储库中拥有多个库副本(例如
myLibBase
)似乎没有意义 - 版本控制可以帮助您编辑单个副本的代码,同时跟踪所有更改。按照您建议的方式(如果我理解正确的话),您将拥有每个项目的myLibBase
版本副本,这意味着如果您对项目中的库进行了更改,您最终会得到两者之一:这两种可能性对我来说都没有意义。
为什么不只拥有每个库的一个版本副本,并且当您签出一个项目时,您还必须签出该项目所需的库?也就是说,如果您想避免签出其他项目 - 否则您可以签出整个工作区。
It doesn't seem to make sense having more then one copy of your library (let's say
myLibBase
) in the repository - version control is there to help you edit a single copy of your code, while keeping track of all changes. In the way you suggest (if I understand it correctly), you will have a versioned copy ofmyLibBase
for each project, meaning that if you made a change to the library in your project, you end up with one of the 2:Either of the possibilities doesn't make sense to me.
Why wouldn't you have just one versioned copy of each library, and when you check-out a project, you'll have to also check-out the libraries this project need? That is, if you want to avoid checking-out other projects - otherwise you could just check-out the whole workspace.