1

What is the ClearCase windows command to get latest label of a latest version file? I found below command at command in clearcase to get list of all labels applied on an element but it lists all latest labels. How to get last label applied instead of all?

cleartool descr -fmt "%l" myFile
Community
  • 1
  • 1
GORa
  • 61
  • 6

3 Answers3

1

I am able to get last applied label by processing cleartool descr command as mentioned above. Following is the batch file content.

@echo off
@cls
setlocal
SET Command='START "" /B /wait cleartool describe -fmt "%%l\n\n" "filename"'

(FOR /F %%a IN (%Command%) DO (
    FOR /F "delims=," %%b in ("%%a") do (
            FOR /F "delims=)" %%c in ("%%b") do (
                FOR /F "delims=(" %%d in ("%%c") do (
                    echo %%d 
                )
            )
    )
)
)

Output: LABEL5

GORa
  • 61
  • 6
0

Building upon my old answer, you will have to process the output of cleartool descr -fmt "%lN" myFile in order to display the date for each label and sort by date.

Using %lN will print one label per line.

cleartool descr -fmt "%lN" myFile | xargs cleartool descr -fmt "%Nd %n" | sort | tail -1

Using %ln will use a date format easily sortable: (Numeric) Date and time in numeric form — yyyymmdd.time.

Community
  • 1
  • 1
VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250
  • 1
    @GORa those are commands available for Windows: simply install https://github.com/bmatzelle/gow (gnu on Windows) – VonC Nov 08 '15 at 20:59
  • This command won't work. it will attempt to describe the labels as if they were files. – Brian Cowan Nov 24 '15 at 19:29
  • If (and only if) the mklabel events aren't scrubbed yet (they are "minor" events and not needed to reconstruct the VOB database in a mkreplica or reformat), you could use lshistory -minor on each of the files to get the most recently attached label. – Brian Cowan Nov 24 '15 at 19:31
  • @BrianCowan I agree. I suspect there is lbtype missing somewhere. I stayed away from lshistory on purpose. – VonC Nov 24 '15 at 19:37
0

If you're looking for recently applied labels, try using cleartool lshistory -minor... I applied a bunch of labels to test element and got this:

> [brian@thishost cvsimport]$ cleartool lshist -min -last 6 co.dll
> --11-24T14:27  brian      make label "LABEL4" on version "co.dll@@/main/2" (LABEL4, LABEL5, LABEL6, LABEL3, LABEL2, ...)
> --11-24T14:26  brian      make label "LABEL5" on version "co.dll@@/main/2" (LABEL4, LABEL5, LABEL6, LABEL3, LABEL2, ...)
> --11-24T14:26  brian      make label "LABEL6" on version "co.dll@@/main/2" (LABEL4, LABEL5, LABEL6, LABEL3, LABEL2, ...)
> --11-24T14:26  brian      make label "LABEL3" on version "co.dll@@/main/2" (LABEL4, LABEL5, LABEL6, LABEL3, LABEL2, ...)
> --11-24T14:26  brian      make label "LABEL2" on version "co.dll@@/main/2" (LABEL4, LABEL5, LABEL6, LABEL3, LABEL2, ...)
> --11-24T14:26  brian      make label "LABEL1" on version "co.dll@@/main/2" (LABEL4, LABEL5, LABEL6, LABEL3, LABEL2, ...)

These events only last 2-4 weeks (depending on scrubbing parameters), so be aware that this is a time-limited lookup.

Brian Cowan
  • 1,048
  • 6
  • 7