2

I need to list the latest baseline for each component in a clearcase UCM stream one by one. I am aware of the "%[latest_bls]p" option used with -fmt . The problem is that it lists all the latest baselines for all components together.

What I need is, given component name C and stream name S, display the latest baseline for component C in the stream S.

Thanks for your help.

Sneftel
  • 40,271
  • 12
  • 71
  • 104
Pulak Agrawal
  • 2,481
  • 4
  • 25
  • 49

2 Answers2

7

If you consider the fmt_ccase options, %[latest_bls]CXp will always list the latest baseline for all components of a given Stream.

So it is best to parse the result, and for each baseline name, to display its component name:

cleartool describe -fmt "%[component]Xp" aBaselineName@/aPVob

Also:

%[latest_bls]CXp seems to be the only way to get directly the latest baseline, and it is always for all components.
What you can also do is list all baselines for a given component and stream:

 cleartool lsbl -comp C -stream S

, and select the last one.
That should be more in line with what you want (ie use only your 6 component names instead of all that parsing/grep'ing)

VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250
  • Ok.. this will mean some messy business for me , where I'll first get 10 baselines, then get 10 component names by parsing, then filter to six components and back to pick up corresponding six baselines. What I'd have preferred is just list the latest baseline for a given component in a stream. That way my six hard-coded component list would have given me the answer. – Pulak Agrawal Nov 15 '11 at 07:43
  • What I am in interested in finding out is why is Tamir's answer not working for me, as I can see -l and -s options working which leads me to believe -fmt should also work as its just rearranging the output of -l for a given cleartool command. – Pulak Agrawal Nov 15 '11 at 07:46
  • 1
    @PulakAgrawal: I understand, but `%[latest_bls]CXp` seems to be the only way to get *directly* the latest baseline, and it is always for *all* components. What you can do is list all baselines for a given component and stream: `cleartool lsbl -comp C -stream `S` and select the last one. That should be more in line with what you want (ie use only your 6 component names instead of all that parsing/grepping) – VonC Nov 15 '11 at 07:47
  • thanks.. I think you are right.. `%[latest_bls]CXp` is the only way it seems what with describe and lscomp not giving any other options.. so I'll have to go with the way of selecting the last one for each component using a regex. Now I'd need a regex to do that. I'll post another question if I am not able to find one myself. Thanks again – Pulak Agrawal Nov 15 '11 at 07:53
  • @PulakAgrawal: you are welcome. I have edited my answer to have both options visible (`%[latest_bls]CXp` or `lsbl -comp -stream`) – VonC Nov 15 '11 at 07:57
  • I've got the regex to select the last line and it works , so combining `cleartool lsbl -comp C -stream S` and the regex @ this post [link](http://stackoverflow.com/questions/8178864/regx-to-select-last-line-in-a-multi-line-string), my job is done. Thanks again – Pulak Agrawal Nov 21 '11 at 04:15
1

Check this:

cleartool lsbl -fmt "%[latest_bls]p" -component C -stream S

Further more, do you know "R&D Reporter"? It helps you generate a report which is based on all changes made between latest baseline and previous to latest baseline, for each component. More than that, it enables you to define what your "latest baseline" is: you can use regular expressions , streams or promotion levels to filter out unimportant baselines. If you have further questions, let me know.

Tamir Gefen
  • 1,128
  • 2
  • 18
  • 35
  • I tried this option and it doesn't give anything.. just waits a second and goes to my interactive cleartool/cmd cleartool again.. I am thinking its doing some processing and not able to find any results , so displays nothing. Any tips on what could I be missing. I have made sure I am in the view context already. – Pulak Agrawal Nov 15 '11 at 06:28
  • Also `lsbl -s -component C -stream S` and `lsbl -s -component C -stream S` are working and giving me correct output so that should help find out why -fmt is not working. – Pulak Agrawal Nov 15 '11 at 06:37
  • If you need the latest of one component only, so you may just take the first one from the output list. – Tamir Gefen Nov 15 '11 at 06:47
  • Sorry.. I didn't understand your last comment.. I need the latest baseline for 6 components out of 10 modifiable ones in the project. I know which 6 and the same six always, so was thinking of writing a script to get that. Now `lsstream -fmt "%[latest_bls]p" S ` gives me all the 10 baselines separated by space with no way to find out which baseline belongs to which component except that the first one is always the rootless parent component – Pulak Agrawal Nov 15 '11 at 07:01
  • Thanks for all the help.. you provided the initial pointers, though I am accepting VonC's answer as the one which will lead me to results. – Pulak Agrawal Nov 15 '11 at 07:54
  • That's ok... I didn't checked the syntax when I wrote it ... just what I remembered by heart – Tamir Gefen Nov 15 '11 at 08:38