您将如何为内部软件项目组织Subversion存储库?

时间:2023-01-12 16:03:22

I work for a company whose primary business is not software related. Most documentation for using source control is written with a development team writing for commercial or open source projects in mind. As someone who writes in house software I can say that work is done differently then it would be in a commercial or open source setting. In addition there are stored procedures and database scripts that need to be kept in sync with the code.

我在一家主要业务与软件无关的公司工作。大多数使用源代码控制的文档都是由开发团队编写的,用于编写商业或开源项目。作为编写内部软件的人,我可以说工作的方式不同于商业或开源设置。此外,存储过程和数据库脚本需要与代码保持同步。

In particular I am looking to get suggestions on how best to structure the repository with in house software in mind. Most documentation suggests trunk, branches, tags etc. And procedures for keeping production, test and development environments in sync with their respective sections in the repository etc.

特别是我希望得到关于如何最好地使用内部软件构建存储库的建议。大多数文档都建议使用主干,分支,标签等。以及保持生产,测试和开发环境与存储库中各自部分保持同步的过程。

9 个解决方案

#1


19  

Setting up SVN repositories can be tricky only in the sense of how you organize them. Before we setup SVN, I actually RTFM'd the online Subversion manual which discusses organizational techniques for repositories and some of the gotchas you should think about in advance, namely what you cannot do after you have created your repositories if you decide to change your mind. I suggest a pass through this manual before setup.

设置SVN存储库只是在组织它们的意义上才是棘手的。在我们设置SVN之前,我实际上是RTFM的在线Subversion手册,该手册讨论了存储库的组织技术以及您应该提前考虑的一些问题,即如果您决定改变主意,在创建存储库之后无法做到的事情。我建议在安装之前通过本手册。

For us, as consultants, we do custom and in-house software development as well as some document management through SVN. It was in our interest to create one repository for each client and one for ourselves. Within each repository, we created folders for each project (software or otherwise). This allowed us to segment security access by repository and by client and even by project within a repository. Going deeper, for each software project we created 'working', 'tags' and 'branches' folders. We generally put releases in 'tags' using 'release_w.x.y.z' as the tag for a standard.

对于我们,作为顾问,我们通过SVN进行定制和内部软件开发以及一些文档管理。为每个客户创建一个存储库,为自己创建一个存储库符合我们的利益。在每个存储库中,我们为每个项目(软件或其他)创建了文件夹。这使我们能够按存储库和客户端甚至存储库中的项目对安全访问进行分段。更进一步,我们为每个软件项目创建了“工作”,“标签”和“分支”文件夹。我们通常使用'release_w.x.y.z'作为标准的标记将版本放在'标签'中。

In your case, to keep sprocs, scripts, and other related documents in synch, you can create a project folder, then under that a 'working' folder, then under that 'code' and next to it 'scripts', etc. Then when you tag the working version for release, you end up tagging it all together.

在你的情况下,为了保持sprocs,脚本和其他相关文档的同步,你可以创建一个项目文件夹,然后在那个“工作”文件夹下,然后在那个'代码'下面,然后在'脚本'旁边,等等。当您标记要发布的工作版本时,您最终会将它们全部标记在一起。

\Repository
   \ProjectX
      \Working
         \Code       
         \Scripts
         \Notes       
      \Tags
      \Branches

As for non-code, I would suggest a straight folder layout by project or document type (manuals, policies, etc.). Generally with documents and depending on how your company operates, just having the version history/logs is enough.

对于非代码,我建议按项目或文档类型(手册,政策等)进行直接文件夹布局。通常使用文档并根据公司的运作方式,只需拥有版本历史记录/日志即可。

We run SVN on Windows along with WebSVN which is a great open source repository viewer. We use it to give clients web access to their code and it's all driven by the underlying Subversion security. Internally, we use TortoiseSVN to manage the repositories, commit, update, import, etc.

我们在Windows上运行SVN以及WebSVN,这是一个很棒的开源存储库查看器。我们使用它来为客户提供对其代码的Web访问,并且它都是由底层的Subversion安全性驱动的。在内部,我们使用TortoiseSVN来管理存储库,提交,更新,导入等。

Another thing is that training should be considered an integral part of your deployment. Users new to version control may have a hard time understanding what is going on. We found that giving them functional instructions (do this when creating a project, do this when updating, etc.) was very helpful while they learned the concepts. We created a 'sandbox' repository where users can play all they want with documents and folders to practice, you may find this useful as well to experiment on what policies to establish.

另一件事是培训应该被视为部署的一个组成部分。不熟悉版本控制的用户可能很难理解发生了什么。我们发现给他们提供功能性指令(在创建项目时执行此操作,在更新时执行此操作等)在学习概念时非常有用。我们创建了一个“沙盒”存储库,用户可以在其中播放他们想要的文档和文件夹以进行练习,您可能会发现这对于确定要建立的策略有用。

Good luck!

#2


6  

For subversion, there is Assembla too which comes with Trac and other useful tools. It's free or you could pay for an account if you need more space or users per project.

对于subversion,还有Assembla,它带有Trac和其他有用的工具。如果您需要更多空间或每个项目的用户,它是免费的,或者您可以为帐户付款。

#3


3  

You could use a service like www.unfuddle.com to set up a free SVN or GIT repository.

您可以使用www.unfuddle.com等服务来建立免费的SVN或GIT存储库。

We use Unfuddle and it's really great. There are free and paid versions (depending on your needs).

我们使用Unfuddle,它真的很棒。有免费和付费版本(根据您的需要)。

Or, you could of course set up a local copy. There are plenty of tutorials to be found via Google for that: http://www.google.com/search?rlz=1C1GGLS_enUS291&aq=f&sourceid=chrome&ie=UTF-8&q=set+up+svn

或者,您当然可以设置本地副本。通过Google可以找到大量的教程:http://www.google.com/search?rlz = 1C1GGLS_enUS291&aq = f&sourceid = chrome&ie = UTF-8&q = set + up + snn

#4


3  

One repository for your projects is probably sufficient. I like the typical approach that indexes the layout by project (see this section from the O'Reilly Subversion book):

您的项目的一个存储库可能就足够了。我喜欢通过项目索引布局的典型方法(参见O'Reilly Subversion书中的这一部分):

/first-project/trunk
/first-project/branches
/first-project/tags
/another-project/trunk
/another-project/branches
/another-project/tags
/common-stuff/trunk
/common-stuff/branches
/common-stuff/tags

Keep in mind that you can always reorganize the repository later.

请记住,您以后可以随时重新组织存储库。

Also, for in-house stuff, I prefer FSFS for the data-store, as opposed to Berkeley DB. FSFS is more resilient and the speed of checkouts is not much concern for small teams/projects. You can compare and decide for yourself.

此外,对于内部的东西,我更喜欢FSFS用于数据存储,而不是Berkeley DB。 FSFS更具弹性,结账速度对小型团队/项目来说并不是很重要。您可以自己比较和决定。

Other standard parts of the recipe include Trac and a minimal Linux server to host the repository on the LAN.

该配方的其他标准部分包括Trac和用于在LAN上托管存储库的最小Linux服务器。

#5


3  

After posting this question I spoke with a coworker who suggested I read the article:

在发布这个问题后,我与一位同事建议我阅读了这篇文章:

http://www.codinghorror.com/blog/archives/000968.html

In short, it advocates that programmers be more aware of branching. It helped me to see there is no right way to go about organizing our repository. For our team we will have a trunk and two long term branches for test and development. In addition we will make seperate branches for each task do we and merged the changes from the task branches as we promote the task up to testing and production.

简而言之,它主张程序员更加意识到分支。它帮助我看到没有正确的方法来组织我们的存储库。对于我们的团队,我们将有一个主干和两个长期分支进行测试和开发。此外,我们将为每个任务制作单独的分支,并在我们将任务推广到测试和生产时合并来自任务分支的更改。

#6


2  

I agree with using the common conventions of trunk/branches/tags. Beyond that, I think you might be looking for something like my answer at How do you organize your version control repository?.

我同意使用trunk / branches / tags的通用约定。除此之外,我想你可能正在寻找像你如何组织你的版本控制存储库的回答?

#7


2  

For my company, I use svn+ssh and key-based authentication. You can do this with both windows clients and linux clients. This is real easy to use once you get your keys straight as you use an ssh key to login rather than typing a password.

对于我的公司,我使用svn + ssh和基于密钥的身份验证。您可以使用Windows客户端和Linux客户端执行此操作。当您使用ssh密钥登录而不是输入密码时,如果直接拿到密钥,这真的很容易使用。

Here's an article on setting up svn+ssh with notes on security. If you understand all of this stuff and follow these steps, you'll be off to a good start.

这是一篇关于使用安全性注释设置svn + ssh的文章。如果您了解所有这些内容并按照这些步骤操作,那么您将有一个良好的开端。

This article describes a number of ways to further secure your ssh logins for the svn accounts.

本文介绍了进一步保护svn帐户的ssh登录的多种方法。

I recommend creating accounts specifically for svn access with no other access to that server. My guess is that you would use a daily build or automated script to update your stored procs in the db. Daily builds can have their own special accounts and their own ssh keys. I don't like for my automated tools to run with the same login as a human user (so I know which tool is broken).

我建议专门为svn访问创建帐户,而不能访问该服务器。我的猜测是你会使用每日构建或自动脚本来更新db中的存储过程。每日构建可以拥有自己的特殊帐户和自己的ssh密钥。我不喜欢我的自动化工具使用与人类用户相同的登录名运行(因此我知道哪个工具已损坏)。

If you don't understand all of the security tricks, searching google can get you some help. If you have trouble, set one up without the security tricks first. That makes it a bit simpler to troubleshoot.

如果你不了解所有的安全技巧,搜索谷歌可以得到一些帮助。如果您遇到问题,请先安装一个没有安全技巧。这使得排除故障变得更加简单。

Good luck, and enjoy having the benefits of source control!

祝你好运,享受源代码控制带来的好处!

#8


0  

As specified in this thread, distributed VCSs (git, Mercurial) are a better model than centralized ones, due to branch creation ease, branch merging ease, no need to setup a special server, no need to have network access to work and some other advantages. If you'll work alone the DVCS allows you to incorporate people to your projects if the need arises very easily.

正如在这个线程中指出的那样,分布式VCS(git,Mercurial)是比集中式更好的模型,因为分支创建容易,分支合并容易,不需要设置特殊服务器,不需要网络访问工作和其他一些好处。如果您单独工作,DVCS允许您在需要时很容易地将人员纳入您的项目。

Anyhow, answering directly your question, a way to set up SVN would be to have a repository per project and, depending on if stored procedures and scripts and libraries are shared or not, create a directory on each project tree for scripts and stored procedures, or a full repository for the shared code.

无论如何,直接回答你的问题,设置SVN的方法是每个项目都有一个存储库,并且根据是否共享存储过程和脚本和库,在每个项目树上为脚本和存储过程创建一个目录,或共享代码的完整存储库。

#9


0  

I believe in following the basic pattern with a project dir with trunk,tags,branches beneath it. I usually like to setup the top level like this

我相信跟随基本模式的项目目录有树干,标签,树枝下面的分支。我通常喜欢像这样设置*

Projects holds all of the individual project or modules Releases holds release tags that involve multiple modules Users holds private user branches Admin holds my hook scripts, backup scripts etc.

Projects包含所有单个项目或模块Releases保存涉及多个模块的发布标签用户拥有私有用户分支Admin拥有我的钩子脚本,备份脚本等。

The release tags are useful if you have a product that is made up of several modules that all may be a different tags for a specific release (one ring to bind them and all that). It makes it easy for source escrow and for developments to reference what made up release 1 or 2.

如果您的产品由多个模块组成,这些模块可能是特定版本的不同标签(一个环用于绑定它们以及所有这些标签),则发布标签非常有用。它使源托管和开发更容易参考构成版本1或2的内容。

#1


19  

Setting up SVN repositories can be tricky only in the sense of how you organize them. Before we setup SVN, I actually RTFM'd the online Subversion manual which discusses organizational techniques for repositories and some of the gotchas you should think about in advance, namely what you cannot do after you have created your repositories if you decide to change your mind. I suggest a pass through this manual before setup.

设置SVN存储库只是在组织它们的意义上才是棘手的。在我们设置SVN之前,我实际上是RTFM的在线Subversion手册,该手册讨论了存储库的组织技术以及您应该提前考虑的一些问题,即如果您决定改变主意,在创建存储库之后无法做到的事情。我建议在安装之前通过本手册。

For us, as consultants, we do custom and in-house software development as well as some document management through SVN. It was in our interest to create one repository for each client and one for ourselves. Within each repository, we created folders for each project (software or otherwise). This allowed us to segment security access by repository and by client and even by project within a repository. Going deeper, for each software project we created 'working', 'tags' and 'branches' folders. We generally put releases in 'tags' using 'release_w.x.y.z' as the tag for a standard.

对于我们,作为顾问,我们通过SVN进行定制和内部软件开发以及一些文档管理。为每个客户创建一个存储库,为自己创建一个存储库符合我们的利益。在每个存储库中,我们为每个项目(软件或其他)创建了文件夹。这使我们能够按存储库和客户端甚至存储库中的项目对安全访问进行分段。更进一步,我们为每个软件项目创建了“工作”,“标签”和“分支”文件夹。我们通常使用'release_w.x.y.z'作为标准的标记将版本放在'标签'中。

In your case, to keep sprocs, scripts, and other related documents in synch, you can create a project folder, then under that a 'working' folder, then under that 'code' and next to it 'scripts', etc. Then when you tag the working version for release, you end up tagging it all together.

在你的情况下,为了保持sprocs,脚本和其他相关文档的同步,你可以创建一个项目文件夹,然后在那个“工作”文件夹下,然后在那个'代码'下面,然后在'脚本'旁边,等等。当您标记要发布的工作版本时,您最终会将它们全部标记在一起。

\Repository
   \ProjectX
      \Working
         \Code       
         \Scripts
         \Notes       
      \Tags
      \Branches

As for non-code, I would suggest a straight folder layout by project or document type (manuals, policies, etc.). Generally with documents and depending on how your company operates, just having the version history/logs is enough.

对于非代码,我建议按项目或文档类型(手册,政策等)进行直接文件夹布局。通常使用文档并根据公司的运作方式,只需拥有版本历史记录/日志即可。

We run SVN on Windows along with WebSVN which is a great open source repository viewer. We use it to give clients web access to their code and it's all driven by the underlying Subversion security. Internally, we use TortoiseSVN to manage the repositories, commit, update, import, etc.

我们在Windows上运行SVN以及WebSVN,这是一个很棒的开源存储库查看器。我们使用它来为客户提供对其代码的Web访问,并且它都是由底层的Subversion安全性驱动的。在内部,我们使用TortoiseSVN来管理存储库,提交,更新,导入等。

Another thing is that training should be considered an integral part of your deployment. Users new to version control may have a hard time understanding what is going on. We found that giving them functional instructions (do this when creating a project, do this when updating, etc.) was very helpful while they learned the concepts. We created a 'sandbox' repository where users can play all they want with documents and folders to practice, you may find this useful as well to experiment on what policies to establish.

另一件事是培训应该被视为部署的一个组成部分。不熟悉版本控制的用户可能很难理解发生了什么。我们发现给他们提供功能性指令(在创建项目时执行此操作,在更新时执行此操作等)在学习概念时非常有用。我们创建了一个“沙盒”存储库,用户可以在其中播放他们想要的文档和文件夹以进行练习,您可能会发现这对于确定要建立的策略有用。

Good luck!

#2


6  

For subversion, there is Assembla too which comes with Trac and other useful tools. It's free or you could pay for an account if you need more space or users per project.

对于subversion,还有Assembla,它带有Trac和其他有用的工具。如果您需要更多空间或每个项目的用户,它是免费的,或者您可以为帐户付款。

#3


3  

You could use a service like www.unfuddle.com to set up a free SVN or GIT repository.

您可以使用www.unfuddle.com等服务来建立免费的SVN或GIT存储库。

We use Unfuddle and it's really great. There are free and paid versions (depending on your needs).

我们使用Unfuddle,它真的很棒。有免费和付费版本(根据您的需要)。

Or, you could of course set up a local copy. There are plenty of tutorials to be found via Google for that: http://www.google.com/search?rlz=1C1GGLS_enUS291&aq=f&sourceid=chrome&ie=UTF-8&q=set+up+svn

或者,您当然可以设置本地副本。通过Google可以找到大量的教程:http://www.google.com/search?rlz = 1C1GGLS_enUS291&aq = f&sourceid = chrome&ie = UTF-8&q = set + up + snn

#4


3  

One repository for your projects is probably sufficient. I like the typical approach that indexes the layout by project (see this section from the O'Reilly Subversion book):

您的项目的一个存储库可能就足够了。我喜欢通过项目索引布局的典型方法(参见O'Reilly Subversion书中的这一部分):

/first-project/trunk
/first-project/branches
/first-project/tags
/another-project/trunk
/another-project/branches
/another-project/tags
/common-stuff/trunk
/common-stuff/branches
/common-stuff/tags

Keep in mind that you can always reorganize the repository later.

请记住,您以后可以随时重新组织存储库。

Also, for in-house stuff, I prefer FSFS for the data-store, as opposed to Berkeley DB. FSFS is more resilient and the speed of checkouts is not much concern for small teams/projects. You can compare and decide for yourself.

此外,对于内部的东西,我更喜欢FSFS用于数据存储,而不是Berkeley DB。 FSFS更具弹性,结账速度对小型团队/项目来说并不是很重要。您可以自己比较和决定。

Other standard parts of the recipe include Trac and a minimal Linux server to host the repository on the LAN.

该配方的其他标准部分包括Trac和用于在LAN上托管存储库的最小Linux服务器。

#5


3  

After posting this question I spoke with a coworker who suggested I read the article:

在发布这个问题后,我与一位同事建议我阅读了这篇文章:

http://www.codinghorror.com/blog/archives/000968.html

In short, it advocates that programmers be more aware of branching. It helped me to see there is no right way to go about organizing our repository. For our team we will have a trunk and two long term branches for test and development. In addition we will make seperate branches for each task do we and merged the changes from the task branches as we promote the task up to testing and production.

简而言之,它主张程序员更加意识到分支。它帮助我看到没有正确的方法来组织我们的存储库。对于我们的团队,我们将有一个主干和两个长期分支进行测试和开发。此外,我们将为每个任务制作单独的分支,并在我们将任务推广到测试和生产时合并来自任务分支的更改。

#6


2  

I agree with using the common conventions of trunk/branches/tags. Beyond that, I think you might be looking for something like my answer at How do you organize your version control repository?.

我同意使用trunk / branches / tags的通用约定。除此之外,我想你可能正在寻找像你如何组织你的版本控制存储库的回答?

#7


2  

For my company, I use svn+ssh and key-based authentication. You can do this with both windows clients and linux clients. This is real easy to use once you get your keys straight as you use an ssh key to login rather than typing a password.

对于我的公司,我使用svn + ssh和基于密钥的身份验证。您可以使用Windows客户端和Linux客户端执行此操作。当您使用ssh密钥登录而不是输入密码时,如果直接拿到密钥,这真的很容易使用。

Here's an article on setting up svn+ssh with notes on security. If you understand all of this stuff and follow these steps, you'll be off to a good start.

这是一篇关于使用安全性注释设置svn + ssh的文章。如果您了解所有这些内容并按照这些步骤操作,那么您将有一个良好的开端。

This article describes a number of ways to further secure your ssh logins for the svn accounts.

本文介绍了进一步保护svn帐户的ssh登录的多种方法。

I recommend creating accounts specifically for svn access with no other access to that server. My guess is that you would use a daily build or automated script to update your stored procs in the db. Daily builds can have their own special accounts and their own ssh keys. I don't like for my automated tools to run with the same login as a human user (so I know which tool is broken).

我建议专门为svn访问创建帐户,而不能访问该服务器。我的猜测是你会使用每日构建或自动脚本来更新db中的存储过程。每日构建可以拥有自己的特殊帐户和自己的ssh密钥。我不喜欢我的自动化工具使用与人类用户相同的登录名运行(因此我知道哪个工具已损坏)。

If you don't understand all of the security tricks, searching google can get you some help. If you have trouble, set one up without the security tricks first. That makes it a bit simpler to troubleshoot.

如果你不了解所有的安全技巧,搜索谷歌可以得到一些帮助。如果您遇到问题,请先安装一个没有安全技巧。这使得排除故障变得更加简单。

Good luck, and enjoy having the benefits of source control!

祝你好运,享受源代码控制带来的好处!

#8


0  

As specified in this thread, distributed VCSs (git, Mercurial) are a better model than centralized ones, due to branch creation ease, branch merging ease, no need to setup a special server, no need to have network access to work and some other advantages. If you'll work alone the DVCS allows you to incorporate people to your projects if the need arises very easily.

正如在这个线程中指出的那样,分布式VCS(git,Mercurial)是比集中式更好的模型,因为分支创建容易,分支合并容易,不需要设置特殊服务器,不需要网络访问工作和其他一些好处。如果您单独工作,DVCS允许您在需要时很容易地将人员纳入您的项目。

Anyhow, answering directly your question, a way to set up SVN would be to have a repository per project and, depending on if stored procedures and scripts and libraries are shared or not, create a directory on each project tree for scripts and stored procedures, or a full repository for the shared code.

无论如何,直接回答你的问题,设置SVN的方法是每个项目都有一个存储库,并且根据是否共享存储过程和脚本和库,在每个项目树上为脚本和存储过程创建一个目录,或共享代码的完整存储库。

#9


0  

I believe in following the basic pattern with a project dir with trunk,tags,branches beneath it. I usually like to setup the top level like this

我相信跟随基本模式的项目目录有树干,标签,树枝下面的分支。我通常喜欢像这样设置*

Projects holds all of the individual project or modules Releases holds release tags that involve multiple modules Users holds private user branches Admin holds my hook scripts, backup scripts etc.

Projects包含所有单个项目或模块Releases保存涉及多个模块的发布标签用户拥有私有用户分支Admin拥有我的钩子脚本,备份脚本等。

The release tags are useful if you have a product that is made up of several modules that all may be a different tags for a specific release (one ring to bind them and all that). It makes it easy for source escrow and for developments to reference what made up release 1 or 2.

如果您的产品由多个模块组成,这些模块可能是特定版本的不同标签(一个环用于绑定它们以及所有这些标签),则发布标签非常有用。它使源托管和开发更容易参考构成版本1或2的内容。