How can I use ClearCase to “add to source control …” recursively?

一个人想着一个人 提交于 2019-11-25 23:16:41

问题


I unpacked a zip-file delivery into a clearcase view. Now I want to add the complete file tree to the repository. The GUI only provides an \"Add to source control ...\" for individual files/directories. Do you know how to recursively add the whole tree?

(I\'m on a Windows system, but have Cygwin installed.)


回答1:


I would rather go with the clearfsimport script, better equipped to import multiple times the same set of files, and automatically:

  • add new files,
  • make new version of existing files previously imported (but modified in the source set of files re-imported)
  • remove files already imported but no longer present in the source set of files.
  • make a clear log of all operations made during the import process.

So if your 'zip-file delivery needs to be updated on a regularly basis, clearfsimport is the way to go, but with the following options:

clearfsimport -preview -rec -nset c:\sourceDir\* m:\MyView\MyVob\MyDestinationDirectory

Note the :

  • -preview option: it will allow to check what would happen without actually doing anything.
  • '*' used only in Windows environment, in order to import the content of a directory
  • -nset option.

From CMWiki, about that 'nset' option:

By default, clearfsimport is meant to be used by the vob owner or a privileged user, but users often overlook the -nsetevent option, with which it may be used by any user.
This option drives clearfsimport not to set the time stamps of elements to this of the source file object outside the vob (which requires privileged access).
There is a minor non-obvious side-effect with this: once a version will have been created with a current time stamp, even the vob owner will not be able to import on top of it a version with an older (as it would be) time stamp, without this -nsetevent option. I.e. once you use this option, normal or privileged user, you are more or less bound to use it in the continuation.




回答2:


Here is one other way I found by using the Windows Explorer:

  1. Select Search... from the context menu on the target directory.
  2. Search for *.
  3. Select all (Ctrl-A) files/directories in the result list.
  4. Select ClearCase > Add to source control... from the context menu on an item in the result list.

There you go ...




回答3:


ClearTeam Explorer, version 8 (maybe earlier as well), has recursive add of subdirectories/files when you select "Add to Source Control". When the "Add to Source Control" dialog box appears, check the "Include descendant artifacts of the selected directories" checkbox and uncheck the "Checkout descendant files only, do not checkout descendant directories" checkbox.




回答4:


Since I did not have access to clearfsimport , I added the files/directories in a two step process:

1.) find . ! -path . -type d | xargs cleartool mkelem -mkpath -nc

This will create nodes for all new directories recursively

2.) find ./ -type f | xargs cleartool mkelem -nc

This will create nodes for all new files recursively




回答5:


You have to use the commandline. The Context menu in Explorer doesnt do this recursively!

clearfsimport –recurse /usr/src/projectx /vobs/projectx/src



回答6:


Heres a script to do it And tips to integrate the script from Explorer

http://www.ibm.com/developerworks/rational/library/4687.html




回答7:


Had a similar requirement to add a directory recursively to ClearCase. Since I did not have access to clearfsimport tool nor do I have ClearCase integrated with Windows Explorer, found an easy solution within ClearCase GUI.

1) Add the root directory using "Add to Source Control" menu option. 2) Click on this directory and then use "ClearCase Search" to search for all Private Files in this directory. 3) Select all from the Search Results and "Add to Source Control"

There you go ! The entire directory is recursively added from within ClearCase GUI




回答8:


you can get a fix at

http://www-01.ibm.com/support/docview.wss?ratlid=cctocbody&rs=984&uid=swg21117629




回答9:


You can also add this command to your context menu with a small script...

Ten best Triggers

edit: oh, sorry. didn't saw that this was already suggested...




回答10:


I agree, find+select+add-to-source-control from Windows explorer is not a good option if the number of files to be version controlled is huge. As already mentioned above, explorer.exe crashes if we try to add a large number of files.

clearfsimport is the best and the most hassle free utility for this task.

-GP



来源:https://stackoverflow.com/questions/138321/how-can-i-use-clearcase-to-add-to-source-control-recursively

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!