Coping ClearCase with label history

79 Views Asked by At

I got a task to copy files with certain extensions from clear case while I need to :

  1. find all files with certain extension and their map
  2. copy the mapping but replace the file with a dir that has it's name
  3. copy the file labels history to that dir

So I know what do to separately but can't figure how to connect things:

Code I used :

# for the latest label :
find . -name '*.extension' | cpio -pdm /path/to/save # this helped me to copy all files and their dir map

# to copy all labels for that file
\cp -r filename.extension@@/main/ /path/to/save # the @@main/ gives me the view of the labels
1

There are 1 best solutions below

4
VonC On

and their map

The "map file" is more seen on Windows with a type manager

The map file, located in the ccase-home-dir\lib\mgrs directory, associates type manager methods with the programs that carry them out.
A map file entry has three fields: type manager, method, and program.

On Linux:

On UNIX, and Linux a type manager is a collection of programs in a subdirectory of ccase-home-dir /lib/mgrs; the subdirectory name is the name by which the type manager is specified with the –manager option in a mkeltype command.

Each program in a type manager subdirectory implements one method (data-manipulation operation).
A method can be a compiled program, a shell script, or a link to an executable.

This differs from your "dir map".

You can list labels on the current version with: cleartool descr -fmt "%l" myFile.

Using extended paths can work in a dynamic view, but it is best (to get all labels on all branches) to do a:

cleartool find . -version "!lbtype(x)" -name "yourelement" -exec "cleartool descr -fmt \"%n labels:%l\n\" \"%CLEARCASE_XPN%\""

To combine both code, do a loop on the result of the first find command.

# Make sure globstar is enabled
shopt -s globstar
for i in **/*.extension; do # Whitespace-safe and recursive
    cpio -pdm "${i}" /path/to/save
    cp -r "${i}"@@/main/ /path/to/save 
done