SVN构建修订

SVN构建修订,svn,version-control,build,Svn,Version Control,Build,我们正在处理一个java项目,每天都有一个自动构建,大多数时候我们都会签入代码,即使只是为了保存它而没有完成,很多时候构建会因为一个人(不是因为错误,只是他的代码不完整)而中断 为了避免这种情况,在SVN中有任何选项,我可以指定一个构建版本/标记,以便它从该版本中获取文件,也就是说,已完成代码的人员将其构建版本作为最新版本,而未完成代码签入的人员将其构建版本指向早期版本,以避免破坏构建。如中所述,在需要时进行分支可能是最好的方法 The Branch-When-Needed system

我们正在处理一个java项目,每天都有一个自动构建,大多数时候我们都会签入代码,即使只是为了保存它而没有完成,很多时候构建会因为一个人(不是因为错误,只是他的代码不完整)而中断


为了避免这种情况,在SVN中有任何选项,我可以指定一个构建版本/标记,以便它从该版本中获取文件,也就是说,已完成代码的人员将其构建版本作为最新版本,而未完成代码签入的人员将其构建版本指向早期版本,以避免破坏构建。

如中所述,在需要时进行分支可能是最好的方法

The Branch-When-Needed system
    Users commit their day-to-day work on /trunk.
    Rule #1: /trunk must compile and pass regression tests at all times. Committers who violate this rule are publically humiliated.
    Rule #2: a single commit (changeset) must not be so large so as to discourage peer-review.
    Rule #3: if rules #1 and #2 come into conflict (i.e. it's impossible to make a series of small commits without disrupting the trunk), then the user should create a branch and commit a series of smaller changesets there. This allows peer-review without disrupting the stability of /trunk.

Pros: /trunk is guaranteed to be stable at all times. The hassle of branching/merging is somewhat rare.
Cons: Adds a bit of burden to users' daily work: they must compile and test before every commit.
使用
svn copy(cp)
创建分支以管理非琐碎的更改

svn copy <base url or path>/trunk <base url or path>/branches/enhancement-1
其他指南:


它被称为“svn cp”。@b这不只是一些svn修订版的本地副本吗?svn cp是在subversion中创建标记的方式。阅读文档。您应该使用“同步合并”将更改从主干合并到分支(即不带修订参数),并使用“重新整合合并”将功能分支重新整合到主干(即使用选项“重新整合”)。@nosid Good point。我以前没有使用过这两个选项(同步/重新整合),但会尝试一下。
cd branch-dir
svn merge -r <rev1>:<rev2> <base url or path>/trunk
svn ci
cd trunk-dir
svn merge -r <revX>:<revY> <base url or path>/branches/enhancement-1
svn ci
project/
├── branches
│   ├── major-refactoring-1     <= specific changes on a refactoring that can not be moved to trunk yet
│   ├── production              <= most of the time changes from trunk will be merged into this for production releases
│   ├── user-1                  <= certain changes done by a user not stable enough to move to trunk
│   └── user-2
├── tags
└── trunk