SVN项目组织:每个模块或每个项目

时间:2023-01-13 12:21:53

I have a subversion repository that contains a number so subfolders, corresponding to the various applications, configuration files, DLLs, etc (I'll call them 'modules') that make up my project. Now we are starting to "branch" into several related projects. That is, each high-level project will use a number of the modules, possibly slightly modified from project to project. The number of projects is smaller (~5) than the number of modules (~20)

我有一个subversion存储库,其中包含一个数字子文件夹,对应于构成我的项目的各种应用程序,配置文件,DLL等(我称之为“模块”)。现在我们开始“分支”成几个相关的项目。也就是说,每个高级项目都将使用许多模块,可能会在项目之间略微修改。项目数量(~5)小于模块数量(~20)

Now I'm trying to figure out how to organize the repo. Does it make sense to keep the top level subfolders on a module-by-module basis, with sub-subfolders for each project? Or should the top level be for each project, with each project having its own module subfolders:

现在我想弄清楚如何组织回购。是否有必要逐个模块地保留*子文件夹,每个项目都有子子文件夹?或者顶层应该是每个项目,每个项目都有自己的模块子文件夹:

repo:

module 1
    Project 1
    Project 2
    ...

    Project 5
module 2
    Project 1
    ....
    Project 5
....
module 20
    Project 1
    ...
    Project 5

-or-

repo:

Project 1
   module 1
   module 2
   ...
   module 20
Project 2
   module 1
   module 2
   ...
   module 20
...
Project 5
   module 1
   module 2
   ...
   module 20

5 个解决方案

#1


3  

It would seem best to organize by Project at the top level, since you're going to want to checkout an entire branch and have a working copy for the project. If you organize by module, you'll have to do multiple checkouts (one for each module you're using) in order to build your project to a point where it's useable.

最好按照*项目进行组织,因为您将要签出整个分支并获得项目的工作副本。如果按模块组织,则必须进行多次检出(每个模块对应一个),以便将项目构建到可用的位置。

It could make sense to keep both projects and modules separate, E.g.:

将项目和模块分开是有意义的,例如:

Projects
   Project 1
   Project 2
   ...
Modules
   Module 1
   Module 2
   ...

If you use that in combination with svn externals and/or vendor branches, you could support different branches for your projects that need different module versions, but still benefit from the having a single module source when projects happen to share the same version of a module.

如果将其与svn外部和/或供应商分支结合使用,您可以为需要不同模块版本的项目支持不同的分支,但仍然可以从项目碰巧共享相同版本的模块时获得单个模块源。

#2


1  

I would organize by Projects THEN by modules (your second example) . The main reason why is because there is more overhead in managing a project, at least for me, than managing modules.

我会通过模块组织这些模块(你的第二个例子)。主要原因是因为管理项目的开销比管理模块要多,至少对我来说是这样。

Each different project needs its own build script setup, properties file, etc. and it is a lot easier to keep track of 5 working copies on your computer than 20.

每个不同的项目都需要自己的构建脚本设置,属性文件等,跟踪计算机上的5个工作副本比20个更容易。

#3


1  

I prefer the 1st one.

我更喜欢第一个。

While it does take extra effort per repository to maintain, I like my revision numbers to make sense for the project.

虽然每个存储库需要额外的维护才能维护,但我喜欢我的修订版号以便对项目有意义。

i.e. our flagship product has a revision of 48123, our new project has a revision of 31. If you have inter-repository dependencies, then you can use svn externals.

即我们的旗舰产品修订版为48123,我们的新项目修订版为31.如果您有存储库间依赖关系,则可以使用svn externals。

#4


0  

I think that your use of "high-level" to describe what a project is suggests that you should have a Projects/modules setup.

我认为您使用“高级”来描述项目是什么意味着您应该设置项目/模块。

However you could have a Modules and Projects set up - i.e., they are at the same level in the SVN repo. Your Projects can rely on Modules, and if possible the Projects can provide specific implementations of actions, turning the module into a base module with default but overrideable implementations.

但是,您可以设置模块和项目 - 即,它们在SVN仓库中处于同一级别。您的项目可以依赖于模块,如果可能,项目可以提供特定的操作实现,将模块转换为具有默认但可重写实现的基本模块。

#5


0  

I would tend to organize by project, but now always. If you have access control aspects of your code, then organize to minimize permissions-administration; this could also result in a per-team organization of the repository.

我倾向于按项目组织,但现在总是如此。如果您有代码的访问控制方面,那么组织以最小化权限管理;这也可能导致存储库的每个团队组织。

By the way: You seem to expect to work in one big repository - which I think is clever, because it means better history handling: As soon as you move stuff between repositories, you loose history. In other words, I disagree with Ben Scheirman's advice on this.

顺便说一下:你似乎希望在一个大型存储库中工作 - 我认为这很聪明,因为它意味着更好的历史记录处理:只要你在存储库之间移动东西,你就会失去历史。换句话说,我不同意Ben Scheirman对此的建议。

#1


3  

It would seem best to organize by Project at the top level, since you're going to want to checkout an entire branch and have a working copy for the project. If you organize by module, you'll have to do multiple checkouts (one for each module you're using) in order to build your project to a point where it's useable.

最好按照*项目进行组织,因为您将要签出整个分支并获得项目的工作副本。如果按模块组织,则必须进行多次检出(每个模块对应一个),以便将项目构建到可用的位置。

It could make sense to keep both projects and modules separate, E.g.:

将项目和模块分开是有意义的,例如:

Projects
   Project 1
   Project 2
   ...
Modules
   Module 1
   Module 2
   ...

If you use that in combination with svn externals and/or vendor branches, you could support different branches for your projects that need different module versions, but still benefit from the having a single module source when projects happen to share the same version of a module.

如果将其与svn外部和/或供应商分支结合使用,您可以为需要不同模块版本的项目支持不同的分支,但仍然可以从项目碰巧共享相同版本的模块时获得单个模块源。

#2


1  

I would organize by Projects THEN by modules (your second example) . The main reason why is because there is more overhead in managing a project, at least for me, than managing modules.

我会通过模块组织这些模块(你的第二个例子)。主要原因是因为管理项目的开销比管理模块要多,至少对我来说是这样。

Each different project needs its own build script setup, properties file, etc. and it is a lot easier to keep track of 5 working copies on your computer than 20.

每个不同的项目都需要自己的构建脚本设置,属性文件等,跟踪计算机上的5个工作副本比20个更容易。

#3


1  

I prefer the 1st one.

我更喜欢第一个。

While it does take extra effort per repository to maintain, I like my revision numbers to make sense for the project.

虽然每个存储库需要额外的维护才能维护,但我喜欢我的修订版号以便对项目有意义。

i.e. our flagship product has a revision of 48123, our new project has a revision of 31. If you have inter-repository dependencies, then you can use svn externals.

即我们的旗舰产品修订版为48123,我们的新项目修订版为31.如果您有存储库间依赖关系,则可以使用svn externals。

#4


0  

I think that your use of "high-level" to describe what a project is suggests that you should have a Projects/modules setup.

我认为您使用“高级”来描述项目是什么意味着您应该设置项目/模块。

However you could have a Modules and Projects set up - i.e., they are at the same level in the SVN repo. Your Projects can rely on Modules, and if possible the Projects can provide specific implementations of actions, turning the module into a base module with default but overrideable implementations.

但是,您可以设置模块和项目 - 即,它们在SVN仓库中处于同一级别。您的项目可以依赖于模块,如果可能,项目可以提供特定的操作实现,将模块转换为具有默认但可重写实现的基本模块。

#5


0  

I would tend to organize by project, but now always. If you have access control aspects of your code, then organize to minimize permissions-administration; this could also result in a per-team organization of the repository.

我倾向于按项目组织,但现在总是如此。如果您有代码的访问控制方面,那么组织以最小化权限管理;这也可能导致存储库的每个团队组织。

By the way: You seem to expect to work in one big repository - which I think is clever, because it means better history handling: As soon as you move stuff between repositories, you loose history. In other words, I disagree with Ben Scheirman's advice on this.

顺便说一下:你似乎希望在一个大型存储库中工作 - 我认为这很聪明,因为它意味着更好的历史记录处理:只要你在存储库之间移动东西,你就会失去历史。换句话说,我不同意Ben Scheirman对此的建议。