3

As the title said: I would like to find all elements that are on a branch (e.g. DEV_BRANCH) with LATEST version but that has not yet had any label applied to them.

I know how to find elements that does not have a particular label applied (as in:

But I don't know how to find elements that hasn't got any label applied.

Thanks in advance Mikael

Community
  • 1
  • 1
Micke P
  • 43
  • 1
  • 1
  • 4

2 Answers2

3

The simplest way would be to:

  • find all element with a version in the right branch
cleartool find . -type f -ele "version(.../myBranch/LATEST)" -print
  • ask for a lsvtree and grep for an opening parenthesis (meaning there is at least one label)
cleartool find . -type f -ele "version(.../DEV_BRANCH/LATEST)" \
-exec "cleartool lsvtree \"%CLEARCASE_PN%\"" | findstr "DEV_BRANCH\\[0-9]* ("

You need a pattern in your find (or grep on Unix) in order to detect:

  • DEV_BRANCH
  • a '\'
  • a version number
  • a space followed by a '(' (meaning there are one or several labels)

That will give you the list of all elements with any label on it.
Given that you can generate the list of any element with versions in the right branch, you then need to diff the two lists in order to extract all elements from the first list (versions in the right branch) but not in the second one (element with a label).

I don't know of a one-liner solution which would list right away the elements with no labels on them in a given branch...

VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250
1

Thanks VonC,

using your patter matching approach I realized that I could use describe instead of lsvtree to find the labes like below:

cleartool find . -type f -ele 'version(/main/DEV_BRANCH/LATEST)'
-exec 'cleartool describe -fmt "%n labels:%l\n" $CLEARCASE_PN' | grep labels:\w*$

This seems to do the trick for me. I just grep for all elements that yields a line where there is nothing after the "label:" string.

I think this does what I want. Hopefully I am not missing any files without lables...

Micke P
  • 43
  • 1
  • 1
  • 4
  • +1 on the general idea, but I wonder if that would only grep elements with a version in LATEST without any labels, as opposed to elements with *any* version in a given branch with labels... So it might not be possible in one pass like you are proposing, but in two passes like I mention in my answer. – VonC Mar 06 '11 at 12:21
  • @VonC Neither. It (almost) greps for the version selected by the active config spec of each element that has a version on DEV_BRANCH, that has labels applied. That is because "$CLEARCASE_PN" returns the pathname without the "@@" at the end, which means it will not refer to an element, but a version. Also, the grep is wrong, because it does not use -i and "Labels" would start with a capital L, and \w* is redundant as the labels will be on subsequent lines. – Larry Jul 22 '19 at 16:16
  • My comment is wrong about the grep part, but the part about the find command itself stands. – Larry Jul 22 '19 at 16:28