在将文件签入和签入CVS时出现问题(Sticky标签)

问题描述:

我在使用release标签签出文件时遇到了一些麻烦,希望这里有人可以提供帮助。

I am having some trouble with checkout out files using a release tag and hope someone here can help.

基本上,我的存储库的结构如下:

Basically my repository is structured like this:

module1
 - src
 - jsp
 - conf

module2
 - src
 - jsp
 - conf

版本可以在 module1 中包含更改module2 或两者兼而有之。几个开发人员可能正在处理任何模块中的任何文件。

A release can include changes in either module1 or module2 or both. Several developers could be working on any files in any of the modules.

要使用新版本,我们使用以下命令检出最新版本(例如LIVE-REL-2.4):

To work on a new release, we check out the latest release (e.g., LIVE-REL-2.4) using the following command:

CVS checkout –r "LIVE-REL-2.4" moduleName

请注意,我们不会从trunc中检出。这样做的原因是,如果您从trunc中签出,则包含其他开发人员签入的文件,但您不想包含在下一个发行版中。

Note that we don't check out from trunc. The reason for this is that if you check out from trunc you include files that other developers have checked in, but you don't want to include in the next release.

签出最新版本后,我们进行更改并签入新文件。对于交付,我们使用错误特定的标记来标记我们检入的所有新文件。

After we've checked out the latest release, we make the changes and check back in the new files. For the delivery, we label all the new files we've checked in with a bug specific tag.

cvs tag BUG434 <file1> 
cvs tag BUG435 <file2>

然后,我们对当前版本中的每个文件应用一个新标签。

We then apply a new label to every file that is on the current release.

CVS tag – r "LIVE-REL-2.4" "LIVE-REL-2.5"

然后我们为签入的新文件添加新的发行标签:

We then add the new release tag for the new files we've checked in:

cvs tag –r "BUG434" "LIVE-REL-2.5"
cvs tag –r "BIG435" "LIVE-REL-2.5"

以上内容确保新版本将包含来自最新发布的版本以及我们要包含在该版本中的错误修复程序。要查看新版本,请执行以下操作:

The above ensures that the new release will include all the files from the "latest delivered release" plus bug fixes that we want to include in the release. To check out the new release, we do this:

cvs checkout –r "LIVE-REL-2.5" moduleName

上面的结帐经过构建测试并交付。关于此过程是否有效,存在一些困惑。我们突然间有些人抱怨说,如果他们按标签签出,他们将无法签入任何新文件。生成的错误如下所示:

The checkout from the above is build tested and delivered. There is though a bit of confusion as to whether this process works. We've suddenly had people complain that they can't check in any new files if they check out by tag. The error that is generated is shown below:


文件DatabaseFacade.java'的粘滞标签LIVE-REL-2.5'不是分支

sticky tag LIVE-REL-2.5' for file DatabaseFacade.java' is not a branch

我一直在阅读有关此错误的内容,但我仍无法找到解决方案。根据我在Google上搜集的信息,可用的解决方案如下:

I have been doing some reading on this error, but I haven't been able to find a solution to it. From what I gather from googling around, the solutions available are as follows:


在这些文件上运行 cvs update -A以还原工作副本到头部。

run "cvs update -A" on these files to revert the working copy to the head.

这对我不起作用,因为我不想释放头上的更改。我要发布的修订是先前版本的更新版本。 HEAD上的一个可能是某人已更新并且不会在下三个版本中发布的一个。

This wouldn't work for me because I don't want to release the changes that are on the "head". The revision that I want to release is an updated version from the previous release. The one on the 'HEAD' could be one that someone has updated and is not to be release for the next three release.


  • 标签需要制作成分支。

我希望可以这样做,但是我似乎无法说服我的任何老板我们应该支持分支机构。我们不支持它,因为它会使事情变得复杂得多。

I wish I could do this, but I can't seem to be able to convince any of my bosses that we should support branching. We don't support it because it makes things a lot more complicated than they need to be.


  • 防止人们检入尚未准备在下一版本中交付的文件。

这可能有用,因为每次发布新版本时,我都可以从 HEAD中签出。

This might work as I would then be able to check out from 'HEAD' every time there is a new release.

现在我的问题如下:


  • 有什么办法可以使用上述过程进行结帐,而不会遇到粘性标签不是分支错误?

  • 是否有更好的方法可以实现上述相同步骤而不必使用分支?

  • 这听起来像是开发环境中最常见的情况之一。他人如何在不使用分支的情况下做到这一点?

  • 最后,如果您对Subversion有所了解,您是否知道它是否以相同的方式工作,并且如果我更改为Subversion,也会遇到相同的问题吗?

  • Is there some way I can checkout using the above procedure without coming across the "sticky tag is not a branch" error?
  • Is there a better way I can achieve the same steps above without having to use branching?
  • This sounds like its one of the most common situations in a development environment. How do other people do it without using branching?
  • And finally, if you have any knowledge of subversion, do you know if it works the same way, and I will have the same problems if I change to subversion?

解决问题的自然方法是分支。但是,如果这种情况很少出现
,并且决心避免分支,则
可以将所有版本放在HEAD上并相应地设置标签。

The natural solution to your problem is branching. However if you have this scenario infrequently and are determined to avoid branches, you can put all your versions on the HEAD and set the tags accordingly.

让我们说您具有以下版本的DatabaseFacade.java:

Lets say you have the following version of DatabaseFacade.java:

1.1: original version, which has the bug
1.2: version with new feature, which you do not want to release yet

您签出了1.1和修复了您的错误,但是-可惜-您无法提交
,因为您处在粘性标签上。要解决此问题,请执行以下操作(我没有
测试代码,但应该可以说明这一点):

You checked out 1.1 and made your bug fix, but - alas - you can't commit it because you are on a sticky tag. To solve it, do the following (I didn't test the code, but it should illustrate the idea):

# backup file with fixes
mv DatabaseFacade.java DatabaseFacade.java-fixed

# revert to HEAD: remove the sticky-ness
cvs update -A DatabaseFacade.java

# get revision 1.1 (non sticky)
cvs update -p -r1.1 DatabaseFacade.java > DatabaseFacade.java

# commit it
cvs ci -m "reverted to revision 1.1." DatabaseFacade.java

# commit your file with fixes
mv DatabaseFacade.java-fixed DatabaseFacade.java
cvs ci -m "fixed BUG434" DatabaseFacade.java

# restore the latest development version to HEAD
cvs update -p -r1.2 DatabaseFacade.java > DatabaseFacade.java
cvs ci -m "reverted to revision 1.2." DatabaseFacade.java

# also fix the bug in the latest development version
cvs ci -m "fixed BUG434" DatabaseFacade.java

因此,现在DatabaseFacade.java将具有以下版本:

So now DatabaseFacade.java will have the following versions:

1.1: original version, which has the bug
1.2: version with new feature, which you do not want to release yet
1.3: same as 1.1
1.4: your bugfix to 1.1
1.5: same as 1.2
1.6: version with new feature and bugfix

现在您可以新版本的标签修订版1.4:

Now you can tag revision 1.4 for the new release:

cvs tag -r 1.4 LIVE-REL-2.5 DatabaseFacade.java

采用这种方法时,应确保没有
的其他开发人员运行 cvs更新,而您正在玩
历史记录,即1.3或1.4是HEAD上的最新记录。

When you take this approach, you should make sure that none of your fellow developers runs a cvs update while you are "playing with the history", i.e. while either 1.3 or 1.4 is the latest on the HEAD.

切换到Subversion没有任何好处。它不会帮助您解决这类问题。如果您正在认真考虑使用
不同的版本管理系统,则应查看
Mercurial或任何其他分布式版本管理系统。
Mercurial中,合并无痛且容易,因此分支是
常见且无害的。

There is no benefit in switching to Subversion. It will not help you with these kind of problems. If you are seriously considering a different version management system, you should take a look at Mercurial or any other Distributed Versionmanagement System. In Mercurial, merging is painless and easy, and so branching is commonplace and harmless.

顺便说一句:由于您正在用
Bug-identifier标记新文件,标签(例如 BUG434),您可能还希望使用相同的标签将与该错误修正相关的任何现有文件标记为

By the way: Since you are tagging your new files with bug-identifier-tags (e.g. "BUG434"), you might also want to tag any existing file related to that bugfix with the same tag.