0

We want all label contents of Base Clearcase VOB. I created a View for the VOB and edited the config.spec document as

element * checkedout
element * label_ID
element * /main/latest

But it brings all the components associated with the VOB and not with the label.

How to select only the elements which are labelled label_ID?

VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250
CCUSER
  • 59
  • 6

2 Answers2

1

If the label has been set on the vob itself, and on all elements (for instance: /<vobtab>/dir1, /<vobtab>/dir1/dir2/, /<vobtab>/dir1/dir2/*), then the following config spec would only bring the labelled elements, and not the rest of the vob elements:

element * checkedout
element * label_ID
element * -none

But if label_ID has been set on all elements within /<vobtab>/dir1/dir2/*, and not on /<vobtab>/dir1/ (the parent folder itself) or not on /<vobtab>/ (the root folder of the vob itself), then that config spec would bring no elements at all.
A workaround would be to select the parent elements:

element * checkedout
element * label_ID
element /<vob_tag>/dir1 /main/LATEST
element /<vob_tag> /main/LATEST
element * -none

I would recommend doing this in a dynamic view (which can be refreshed very quickly after each config spec modification), instead of a snapshot view (which has to reload after each setcs)


Another approach, not based on a config spec (since it can be difficult to select the right parent folders in order to access the labelled elements) is to use a cleartool find query.
See:

Basically, you can list only the labelled element by going into your 'preferably dynamic) view and doing:

UNIX and Linux:

cleartool find -cview -element '{lbtype_sub(REL1)}' -print

Windows:

cleartool find -cview -element "{lbtype_sub(REL1)}" -print

Instead of using -print, you can use -exec "a command", and use the exec option to execute any command, like copying what you just found:

cleartool find -cview -element "{lbtype_sub(REL1)}" -exec "copy \"%CLEARCASE_PN%\" c:\a\path"

cleartool find . –version "lbtype(LB_TYPE)"

If the command is too finicky, simply redirect the result to a file:

cleartool find -cview -element "{lbtype_sub(REL1)}" -print > file.txt

Then process that file to copy its content, as in "Batch: Copy a list (txt) of files":

@echo off
set src_folder=c:\whatever
set dst_folder=c:\target
for /f "tokens=*" %%i in (File-list.txt) DO (
    xcopy /S/E/U "%src_folder%\%%i" "%dst_folder%"
)
Community
  • 1
  • 1
VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250
  • still i'm not able to get the result after using that command,please provide the exact command and how it works,this is the error i'm facing after running this command. **M:\Race_Label\RACE>cleartool find -all -element "{lbtype_sub(BUILD_RACE_HFM_01)}" -exec "copy \"%CLEARCASE_PN%\" C:\111" ** 'cleartool: Error: Can't exec "copy "M:\Race_Label\RACE\HFM\Application Profile\RACE Profile.per" C:\111": The system cannot find the file specified.'@VonC – CCUSER Mar 13 '15 at 07:10
  • @CCUSER simply remove the `-all`, or replace it with `-cview`: that will limit the result to the labelled elements which are actually visible (and can be copied) as opposed to "all" versions which can reference elements since deleted (rmname). – VonC Mar 13 '15 at 07:44
  • M:\Race_Label\RACE>**cleartool find -cview -element "{lbtype_sub(BUILD_RACE_HFM_01 )}" -exec "copy \"%CLEARCASE_PN%\" > C:\111\" ** cleartool: Error: Pathname required. Usage: find { pname ... [-depth | -nrecurse | -directory] | [pname ...] -all [-visible | -nvisible] | -avobs [-visible | -nvisible] } [-name 'pattern'] [-cview [-type {f|d|l}...] {-print | -exec command-invocation | -ok command-invocation} it is asking the path please read the error message@VonC – CCUSER Mar 13 '15 at 08:54
  • @CCUSER why do you have a '`>`' between `\"%CLEARCASE_PN%\"` and `C:\111\"`? Could you try without `>`? Also C:\111 should end with a `"`, not a '\"`. – VonC Mar 13 '15 at 09:30
  • I Ran : cleartool find -cview -element "{lbtype_sub(BUILD_RACE_HFM_01 )}" -exec **"copy \"%CLEARCASE_PN%\" C:\a"** I got error as : **cleartool: Error: Pathname required.** I have tried all the posssibilities with this command, please provide your valuable suggestions in this. – CCUSER Mar 13 '15 at 09:32
  • @CCUSER maybe a different approach is required if the exec part if too tricky to setup right: you could use first a `-print` (instead of the `-exec`) to at least check that it does list the files that you expect. Then you can redirect that output in a file: `cleartool find ... -print > afile`, and feed that file to a little script like: http://stackoverflow.com/a/6258198/6309 – VonC Mar 13 '15 at 09:37
  • @CCUSER Strange: your first error messages show that the `find` command would find at least one file. Try to make the `find -print` work first. – VonC Mar 13 '15 at 10:39
  • the script is giving trouble – CCUSER Mar 13 '15 at 11:08
  • @CCUSER do you mean the script I mentioned in http://stackoverflow.com/a/6258198/6309? First, does the `cleartool find ... -print` work properly? Do you have the list of files you expect? – VonC Mar 13 '15 at 12:22
1

If you don't mind seeing a load of empty directories, you can do something like this:

element * CHECKEDOUT
element -file * label_ID
element -directory * /main/LATEST

This will return the LATEST or CHECKEDOUT version of every folder, but it won't display a file unless it's labelled or CHECKEDOUT

Check out the config_specs reference page - there's a load of stuff you can do with config specs (for instance if you only wanted the MSWord documentation, you could so "element -file *.doc /main/LATEST")

Garry
  • 109
  • 4