项目目录结构和源代码控制的最佳实践 [英] Best practice for project directory structure and source control

查看:27
本文介绍了项目目录结构和源代码控制的最佳实践的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试提出一种规范的方法来构建我的源代码项目.我使用 JetBrains IntelliJ IDEA 和 Subversion (1.6.12)(使用 SmartSVN 作为我的 GUI).

I am trying to come up with a canonical way to structure my source code projects. I use JetBrains IntelliJ IDEA and Subversion (1.6.12) (using SmartSVN as my GUI).

我已经创建了这样的源目录结构:

I have created a source directory structure like this:

project
  + trunk
  + branches
  + tags

并在 trunk 目录中打开一个新的 IDEA 项目.我写了一些代码:-).

and open a new IDEA project in the trunk directory. I write some code :-).

我现在要将项目添加到我在 SVN 服务器上创建的新存储库 (svnadmin create myproject).我使用的是 SmartSVN 6.6.2.

I am now going to add the project to a new repository I created on the SVN server (svnadmin create myproject). I am using SmartSVN 6.6.2.

在 SmartSVN 中,我告诉它使用 SVN+SSH 将代码导入新项目并指向我的存储库.SmartSVN 警告我,我正在导入一个不同于惯用 trunk 的目录,因为我给了它顶级 project 目录.我很迷惑.不应该把整个目录结构导入SVN吗?

In SmartSVN I tell it to import the code into a new project and point it at my repository using SVN+SSH. SmartSVN warns me that I am importing a directory other than the customary trunk because I gave it the top-level project directory. I am confused. Shouldn't I import the whole directory structure into SVN?

谢谢.

推荐答案

当使用标准的 Subversion 目录结构时,您通常不会拥有所有的 trunkbranchestags 在你的机器上检出,因为一旦你有多个标签或分支,这将在你的系统上为你提供许多相同文件的许多副本.相反,您通常只签出 trunk,如果需要,稍后可以将签出切换为指向分支或标签,或者在单独的目录中签出您感兴趣的分支或标签为他们工作.

When using the standard Subversion directory structure, you don't usually have all of trunk, branches and tags checked out on your machine, because that will give you many, many copies of the same files on your system, once you have multiple tags or branches. Instead, you usually just have trunk checked out, and may later switch your checkout to point to a branch or tag, or check out a branch or tag you are interested in in a separate directory, if you need to work on them.

我以前没有使用过 SmartSVN,但听起来它希望在创建新项目时只提供 trunk 目录,因为它希望您只检出该目录.在服务器上拥有您描述的目录结构是完全正确的,只是不希望在导入时获得它.请注意,如果您已经在客户端的标签或分支文件夹中创建了任何内容,Subversion 将不知道它们与主干的关系,因此只会将它们视为完全独立的文件.但是如果这些目录在导入时是空的,你应该没问题,它只是警告你正在以一种有点出乎意料的方式导入代码.

I haven't used SmartSVN before, but it sounds like it expects to be given just the trunk directory when creating a new project, because it expects that you will only have that checked out. It is perfectly correct to have the directory structure you describe on the server, it just isn't expecting to get that for the import. Note that if you have already created anything in the tags or branches folders on the client, Subversion won't know how how they relate to the trunk, and will thus just treat them as entirely separate files. But if those directories are empty upon import, you should be just fine, it's just warning you that you were importing the code in a slightly unexpected way.

这篇关于项目目录结构和源代码控制的最佳实践的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆