1

I have a perl script that I use to copy the modified elements to a certain folder.

I use the following cleartool command:

cleartool find . -version "{brtype(Branch) && created_since(28-Feb-2014) && (version(...\\Branch\\LATEST))}

And then I parse the result using perl script to copy the files modified as per the date criteria above over to the specified folder:

foreach $file (@files)
{
    $file =~ s/@@.*$//g;
        if ($file =~ /\.csp$/i) {
    if ( -e $file) { die "$file exists" }; 
    chomp($file);
    $dname=dirname($file);
    $dname=~ s/\///g;
    $dname1=substr($dname,1);
    $dirname="C:\\AutoDeliver" . "$dname1";
    unless(-d $dirname){
    mkpath $dirname or die "cannot create dir";
    }
    copy ("$file",$dirname) or die "File cannot be copied. It may already exist.";
    print STDOUT $file;
    }
}

This works fine in every stream except one. That one stream is only used for delivering code to and from and is the child directly under the integration stream. With my script, I get all the modified elements correclty but the elements have the wrong version. All the element versions copied are same as the integration stream. This seems to me that since the child stream does not have any elements version created and the version tree eyeball is always looking at the integration stream causing the integration version to be copied. How do I avoid this so that I get the version from the child stream. Please help. Thanks.

toolic
  • 57,801
  • 17
  • 75
  • 117

1 Answers1

0

A Child stream would reference the same version of the parent stream when it has foundation baselines created on the parent stream, and simply rebased on the child stream.

In that case, there is no point of running your script on that specific branch, as it would always reflect versions created on its parent.


The OP comments:

I see the issue now after stepping into my script. My script is run against the dynamic view.

The dynamic view is holding on to the element versions from the integration while the snapshot view on the same stream is properly updated and showing the latest version of the same elements.
I thought the dynamic view is updated on the fly and will always have the latest content.

In fact:

The dynamic view was incorrectly setup.
I just created a brand new view and it's working as expected

Community
  • 1
  • 1
VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250
  • Thanks Von. But the child branch gets changes delivered from the other branches as well. An element has 4 versions (as a result of delivery from other branches) on the branch with a much newer date and the element picked up is from the integration branch. How do I force it to look into the latest version in its own branch and not the integration. Thanks. – user3365116 Feb 28 '14 at 20:05
  • @user3365116 if, for a specific element, the "version tree eyeball is always looking at the integration stream", check the config spec associated with the view showing that particular version tree: it should explain why this specific version is picked out. – VonC Feb 28 '14 at 20:21
  • Thanks again. Load rules for all the views are loading everything (folders and subfolders) from the same component vob. This is true with other views as well. – user3365116 Feb 28 '14 at 21:17
  • @user3365116 I am not talking about the load rules (for snapshot views). I am talking about the selection rules (`element * ...`): those would explain why a certain version is selected. – VonC Feb 28 '14 at 21:37
  • Thanks again Von but this is a UCM view. Does the selection rule scenerio still applies? – user3365116 Feb 28 '14 at 22:29
  • @user3365116 sure: go to your UCM view root folder, and do a `cleartool catcs`. – VonC Feb 28 '14 at 22:56
  • here is the output: # Select checked out versions element * CHECKEDOUT # Component selection rules... element "[e9012500c34511d5bc050b0d0b544f0=\CVOB]/..." .../ChildStream/LATEST element "[e9012500c34511d5bc050b0d0b544f0=\CVob]/..." Foundation_BL_xxx -mkbranch ChildStream element "[e9012500c34511d5bc050b0d0b544f0=\CVob]/..." /main/0 -mkbranch ChildStream I am trying to get my head around it but can use some help. Thanks. – user3365116 Mar 03 '14 at 14:40
  • @user3365116 it looks legit, and should always display the LATEST from ChildStream. If it doesn't, open a shell, go to the parent folder of the file with the wrong version, and do a `cleartool ls`: you will see which selection rule is used in that specific instance. – VonC Mar 03 '14 at 15:04
  • it looks like that any element that has been delivered to the childStream has Rule: elementName@@\main\childStream\LATEST but anything that has not been delivered is showing up has Rule: FoundationBL -mkbranch childStream. Now how can I make my script pick the LATEST version only and not the old version from the foundation BL? Sorry, I may have been not very clear in my explanation. Thanks a lot. – user3365116 Mar 03 '14 at 16:14
  • @user3365116 no, it seems clear: any element without any version on `childStream` would rightly be selected with `FoundationBL`. You need that second rule in order for parent folders to be correctly selected (in the case they haven't any version on `childStream`) – VonC Mar 03 '14 at 16:16
  • Yeah, I understand that. But, I still need to be able to pull the latest element version those got delivered to the child stream. Thanks. – user3365116 Mar 03 '14 at 16:25
  • @user3365116 you will: if there are version in `childStream`, the first selection rule *will* pick it up. If not, go back to my previous comment, where I suggest a `cleartool ls`, to see why it isn't. – VonC Mar 03 '14 at 16:26
  • OK, I see the issue now after stepping into my script. My script is run against the dynamic view. The dynamic view is holding on to the element versions from the integration while the snapshot view on the same stream is properly updated and showing the latest version of the same elements. I thought the dynamic view is updated on the fly and will always have the latest content. Any ideas? Thanks. – user3365116 Mar 03 '14 at 18:33
  • @user3365116 is the dynamic view an UCM view on the same stream? If you go to `m:\yourDynamicView` and do a `cleartool catcs`, do you see the *same* config spec than your snapshot view? – VonC Mar 03 '14 at 18:34
  • Thanks a lot Von, I got it now. The dynamic view was incorrectly setup. I just created a brand new view and it's working as expected. I am getting all the correct versions. You are the man with heck of a patience :) – user3365116 Mar 03 '14 at 19:11
  • @user3365116 Great! I have included your conclusion in the answer for more visibility for others. – VonC Mar 03 '14 at 19:13