在分布式版本控制系统(集市)中开发库

时间:2022-06-13 06:28:59

I am relatively new to bazaar (primarily used cvs, then subversion, and at my current job we're using SourceUnsafe). My current development environment is structured like this:

我对集市比较新(主要是使用cvs,然后是颠覆,在我目前的工作中我们使用的是SourceUnsafe)。我当前的开发环境结构如下:

\dev                 (shared repository)
  \trunk
    \project1        (branch)
    \project2        (branch)
  \branches
    \proj1-bugfix123 (branch of \trunk\project1)
    \proj1-featureA  (branch of \trunk\project1)

Now, if I decide that certain aspects of project1 would be better suited as a library (or assembly, since it is a c# project) rather than classes inside the project, what would be the best approach for structuring this in bazaar. I have come up with two possibilities that I think are viable. The first I think is the "right" way.

现在,如果我认为project1的某些方面更适合作为库(或汇编,因为它是一个c#项目)而不是项目中的类,那么在集市中构建这个类的最佳方法是什么。我想出了两种我认为可行的可能性。我认为首先是“正确”的方式。

\dev                 (shared repository)
  \trunk
    \project1        (branch)
    \project2        (branch)
    \libXXX
  \branches
    \proj1-bugfix123
      \main          (branch of \trunk\project1)
      \libXXX        (branch of \trunk\libXXX)
    \proj1-featureA
      \main          (branch of \trunk\project1)
      \libXXX        (branch of \trunk\libXXX)

The problems with this is that now I need to remember to update the solution file to include the right projects whenever I make a branch and to not push that back, and also to remember to push changes back to both the project and library at the same time (for instance, if featureA in project1 requires changes to libXXX to work).

这样做的问题是,现在我需要记住更新解决方案文件,以便在我创建分支时包含正确的项目,并且不要将其推回去,并且还要记住在同一时间将更改推回到项目和库中时间(例如,如果project1中的featureA需要更改libXXX才能工作)。

\dev                 (shared repository)
  \trunk
    \project1        (branch)
    \project2        (branch)
      \libXXX
  \branches
    \proj1-bugfix123 (branch of \trunk\project1)
      \libXXX
    \proj1-featureA  (branch of \trunk\project1)
      \libXXX        

The problems with this approach are that if another project, say project3 wanted to use libXXX and be in source control, it would need to be a branch off of project1, with the project1 files deleted. It would be messy.

这种方法的问题在于,如果另一个项目,比如project3想要使用libXXX并且在源代码控制中,那么它需要是project1的一个分支,删除了project1文件。这会很混乱。

I suppose there is a third option of having the entire trunk be a branch as in subversion, but that seems to be counter to the way things I think they are supposed to work in bazaar.

我想有第三个选择让整个主干成为颠覆中的一个分支,但这似乎与我认为他们应该在集市上工作的方式相反。

If this were done in SourceSafe, I would just do it like the second example, but have the libxxx folders in both places, but shared, since that is the only mechanism sourcesafe has to do it in.

如果这是在SourceSafe中完成的,我会像第二个例子那样做,但在两个地方都有libxxx文件夹,但共享,因为这是sourcesafe必须执行的唯一机制。

3 个解决方案

#1


0  

Wouldn't you want any new libraries to have their own solution and be built as part of that and then referenced by the other projects. That way the library has only a single version being built (instead of one per solution)

您不希望任何新库拥有自己的解决方案并构建为其中的一部分,然后由其他项目引用。这样,库只构建了一个版本(而不是每个解决方案一个版本)

#2


3  

There is no simple solution yet in bzr. You need nested trees support, but it's not implemented yet (http://bazaar-vcs.org/NestedTreeSupport), but may will be soon.

在bzr中还没有简单的解决方案。您需要嵌套树支持,但它尚未实现(http://bazaar-vcs.org/NestedTreeSupport),但可能很快就会实现。

There is old tool called config-manager (https://launchpad.net/config-manager).

有一个名为config-manager的旧工具(https://launchpad.net/config-manager)。

Also there is new plugin for bzr called scmproj (https://launchpad.net/bzr-scmproj), it's alpha now and in active development.

另外还有一个名为scmproj(https://launchpad.net/bzr-scmproj)的bzr新插件,现在正处于活跃开发状态。

#3


1  

Until nested trees support in Bazaar is fixed, or Bazaar develops something akin to Subversion 'Externals' (if I understand them correctly), your flexibility in including libraries into the tree of a Bazaar branch is limited.

直到Bazaar中的嵌套树支持被修复,或者Bazaar开发类似于Subversion'Externals'的东西(如果我正确理解它们),你将库包含在Bazaar分支树中的灵活性是有限的。

Until then, maintain the library as a separate project in a nice clean 'branch' of its own. If you need the library included in a project such as its files are within the project's own tree, then copy them across. If you make any changes to files in that library that you want to contribute back to the library, bring the changes back into your local branch of that library and merge/commit there.

在此之前,将库作为​​一个单独的项目维护在一个漂亮的干净“分支”中。如果您需要项目中包含的库(例如其文件)位于项目自己的树中,则将它们复制到一起。如果对该库中要返回库的文件进行任何更改,请将更改带回该库的本地分支并在那里进行合并/提交。

#1


0  

Wouldn't you want any new libraries to have their own solution and be built as part of that and then referenced by the other projects. That way the library has only a single version being built (instead of one per solution)

您不希望任何新库拥有自己的解决方案并构建为其中的一部分,然后由其他项目引用。这样,库只构建了一个版本(而不是每个解决方案一个版本)

#2


3  

There is no simple solution yet in bzr. You need nested trees support, but it's not implemented yet (http://bazaar-vcs.org/NestedTreeSupport), but may will be soon.

在bzr中还没有简单的解决方案。您需要嵌套树支持,但它尚未实现(http://bazaar-vcs.org/NestedTreeSupport),但可能很快就会实现。

There is old tool called config-manager (https://launchpad.net/config-manager).

有一个名为config-manager的旧工具(https://launchpad.net/config-manager)。

Also there is new plugin for bzr called scmproj (https://launchpad.net/bzr-scmproj), it's alpha now and in active development.

另外还有一个名为scmproj(https://launchpad.net/bzr-scmproj)的bzr新插件,现在正处于活跃开发状态。

#3


1  

Until nested trees support in Bazaar is fixed, or Bazaar develops something akin to Subversion 'Externals' (if I understand them correctly), your flexibility in including libraries into the tree of a Bazaar branch is limited.

直到Bazaar中的嵌套树支持被修复,或者Bazaar开发类似于Subversion'Externals'的东西(如果我正确理解它们),你将库包含在Bazaar分支树中的灵活性是有限的。

Until then, maintain the library as a separate project in a nice clean 'branch' of its own. If you need the library included in a project such as its files are within the project's own tree, then copy them across. If you make any changes to files in that library that you want to contribute back to the library, bring the changes back into your local branch of that library and merge/commit there.

在此之前,将库作为​​一个单独的项目维护在一个漂亮的干净“分支”中。如果您需要项目中包含的库(例如其文件)位于项目自己的树中,则将它们复制到一起。如果对该库中要返回库的文件进行任何更改,请将更改带回该库的本地分支并在那里进行合并/提交。