如何最好地在Clearcase中分支? [英] How best to branch in Clearcase?

查看:75
本文介绍了如何最好地在Clearcase中分支?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我以前记录了我对Clearcase作为源代码控制系统的看法,但不幸的是,我仍在使用它。因此,我请你们帮我减轻一个挫败感。

I've previously documented my opinions on Clearcase as a source control system, but unfortunately I am still using it. So I turn to you guys to help me alleviate one of my frustrations.

我们刚刚从每个开发人员的分支机构转移到一个分支机构-每个任务,以尝试改善我们在确定为什么更改某些文件时遇到的一些问题。通常,我对解决方案感到满意,但是有一个主要问题。我们正在使用简单的脚本来开始和结束任务,这些任务创建了一个新的分支,并使用用户名和任务号命名,然后更新本地快照视图以具有类似于以下内容的配置规范:

We have just moved from a one-branch-per-developer system, to a one-branch-per-task in an attempt to improve some of the issues that we've been having with determining why certain files were changed. Generally I am happy with the solution, but there is one major issue. We are using simple scripts to start and end tasks which create a new branch named with the username and task number and then updates the local snapshot view to have a config spec similar to the following:


    element * CHECKEDOUT 
    element * .../martin_2322/LATEST  
    element * /main/LATEST -mkbranch martin_2322 
    load /Project/Application

让我们说我的项目有两个耦合文件A.cs和B.cs。对于我的第一个任务,我对分支上的A进行更改。然后,无论出于何种原因,我都需要停止执行任务2322,并开始执行任务2345(任务2322尚未完成,因此我不会将其合并回主任务)。
我创建一个新的任务分支2345,同时编辑A.cs和B.cs并将结果合并回main。现在,我回到2322上工作,因此我将配置规格更改为上面定义的规格。此时,我从任务分支中看到了A.cs文件(如我先前所编辑的那样,因此我获得了该分支的本地版本),并且从main分支中看到了B.cs的最新版本。由于我没有对2345分支上的A.cs进行任何更改,因此构建中断了。相反,我需要的是能够从我上次中断的地方接任务2322,并使用旧版本的A.cs来查看它-创建分支时最新的A.cs版本。

Let's say that my project has two coupled files A.cs and B.cs. For my first task I make changes to A on the branch. Then I need to stop working on task 2322 for whatever reason and start work on task 2345 (task 2322 is not finished, so I don't merge it back into main). I create a new task branch 2345, edit both A.cs and B.cs and merge the results back into main. Now I go back to work on 2322, so I change my config spec back to one defined above. At this point I see the A.cs file from the task branch (as I edited it earlier, so I get the version local to that branch) and the latest version of B.cs from main. Since I don't have the changes made to A.cs on the 2345 branch the build breaks. What I need instead is to be able to pick up task 2322 from where I left off and see it with the old version of A.cs - the one that was latest in main when the branch was created.

我看到的方式有几种解决方法:

The way I see it I have a few options to fix this:


  • 更改配置规范,以便它在正确的日期从main获取文件。如果我知道日期并且不介意手动设置日期,那么这样做就很容易,但是我不知道如何将其自动化到我们的任务切换脚本中。无论如何,要获取分支的创建日期吗?

  • Change the config spec so that it gets files from main at the right date. This is easy enough to do if I know the date and don't mind setting it by hand, but I can't figure out how to automate this into our task switching scripts. Is there anyway to get the creation date of a branch?

为main上的每个分支创建标签。从理论上讲很容易做到,但是我们安装的CC中的标签系统已经在数百个标签的重量下崩溃了,所以我不知道它是否可以满足每个分支每个开发人员的要求(请注意,示例中的任务是2322,而我们只是整个项目的四分之一)。

Create a label for each branch on main. Theoretically simple to do, but the labelling system in our install of CC is already collapsing under the weight of a few hundred labels, so I don't know if it will cope with one per developer per branch (notice that the task in my example is 2322 and we're only about an quarter of the way through the project)

从main合并到任务分支。再次可以正常工作,但是长期运行的分支将不仅包含为该任务更改的文件,还包含所有需要合并的文件,以使不相关的内容正常工作。这使得它们和每个开发人员的方法一样复杂。我想查看更改了哪些文件以完成特定任务。

Merge out from main into the task branch. Once again should work, but then long running branches won't just contain the files changed for that task, but all files that needed to be merged across to get unrelated things working. This makes them as complicated as the branch-per-developer approach. I want to see which files were changed to complete a specific task.

我希望我只是在这里丢失了一些东西并且有一种设置我的配置规范的方法,这样它就可以从main检索期望的文件,而不会遇到麻烦的解决方法。那么,你们如何在Clearcase中分支呢?

I hope I'm just missing something here and there is a way of setting my config spec so that it retrieves the expected files from main without clunky workarounds. So, how are you guys branching in Clearcase?

推荐答案

您可以使用获取分支的创建日期。在cleartool中描述命令。

cleartool describe -fmt "%d" -type martin_2322

这将打印出创建分支的日期和时间。您可以使用它来实现您的第一个选择。有关更多信息,您可以阅读以下cleartool手册页,但希望上面的命令是您所需要的。

This will printout the date and time that the branch was created. You can use this to implement your first option. For more information, you could read the following cleartool man pages, but hopefully the above command is all you need.

cleartool man describe

cleartool man fmt_ccase

这篇关于如何最好地在Clearcase中分支?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆