Page 1 of 1

RENAMELABEL and Vault 9.1 API Question/Request

Posted: Fri Mar 04, 2016 10:21 am
by ejhansen71

We use RENAMELABEL as part of our promotion process.

Ex. Need to promote 5 files from DEV to PRODUCTION
file: a ---> Label: promote_a
file: b ---> Label: promote_a
file: c ---> Label: promote_a
file: d ---> Label: promote_a
file: e ---> Label: promote_a

We use GETLABELS to have vault write those updates to the production server. Once it writes to the production server, we use RENAMELABEL to add a prefix to the label: _prod_
RENAMELABEL -repository [repository] [item] [from_label] [to_label]

RENAMELABEL -repository Chicago $/datamgmt/script/a promote_a _prod_promote_a
file: a ---> Label: _prod_promote_a
RENAMELABEL -repository Chicago $/datamgmt/script/b promote_a _prod_promote_a
file: b ---> Label: _prod_promote_a
RENAMELABEL -repository Chicago $/datamgmt/script/c promote_a _prod_promote_a
file: c ---> Label: _prod_promote_a
RENAMELABEL -repository Chicago $/datamgmt/script/d promote_a _prod_promote_a
file: d ---> Label: _prod_promote_a
RENAMELABEL -repository Chicago $/datamgmt/script/e promote_a _prod_promote_a
file: e ---> Label: _prod_promote_a

This works fine for small promotion jobs. The problem is when a developer needs to move an entire folder or a lot of programs (which happens about 20% of the time.)

i.e. Right click on Chicago repository's $/projecta and label it promote_projectA ( contains 7 folders each with 200 programs)

In this case, we have to loop through every program to see if the label was created for the file. If so, rename the label...then it goes to loop through each of the directory names to see if a label was placed on it and if so, rename the label.

So in this example, it has to loop through 1400 programs (none of which have a label to be renamed since the label was done on the root folder + each RENAMELABEL command takes between 10 and 15 seconds.) And then it loops through the 7 folders (none of which have a label to be renamed since the label was done on the root folder.) Finally, it checks the root folder and renames the label to _prod_promote_projectA.

There is no way to short circuit this process without the possibility of failing to rename a file or folder from a different location but containing the same label.

This type of promotion occurs about 20% of the time.

What we would like is a C# code and/or a CLI program that allows all files/folders with a given label to be updated all at once.

So instead of :
RENAMELABEL -repository [repository] [item] [from_label] [to_label]
RENAMELABEL -repository Chicago $/datamgmt/script/a promote_projectA _prod_promote_projectA


Because of the [item] we have to loop through each and every file and folder to renamelabel one at a time.

Ideal usage:
RENAMELABELS -repository [repository] [from_label] [to_label]
RENAMELABELS -repository Chicago promote_projectA _prod_promote_projectA


or

RENAMELABEL -repository [repository] -wildcard [yes|no] [item(s)] [from_label] [to_label]
RENAMELABEL -repository Chicago -wildcard yes * promote_projectA _prod_promote_projectA


This would look for all files and folders in the "Chicago" repository with the label "promote_projectA" and change it to "_prod_promote_projectA"

The command only needs to be triggered once and could save hours of processing time and a lot of extra code.


Is there any existing part of the API that we can leverage to make this happen? If not, can we request that you add this ability in the next release? This single problem is responsible for a lot of wasted time and is prone to errors.

Re: RENAMELABEL and Vault 9.1 API Question/Request

Posted: Fri Mar 04, 2016 1:48 pm
by Beth
When a label is initially created, is it created on a folder or a file?

When you are promoting, is that also the latest code?

Re: RENAMELABEL and Vault 9.1 API Question/Request

Posted: Mon Mar 07, 2016 10:36 am
by ejhansen71
When a label is initially created, is it created on a folder or a file?

It can be either. Sometimes a developer will select the whole folder and only place a label on it. Other times they add the labels to individual files only. Sometimes they add a label to folder a and add the same label to files under folder b: b/a.sas, b/b.sas and b.c.sas. So in the last case, they labeled a folder and files in another folder.

In any case, we have to roll through every individual file and folder to see if it is assigned to the label.


When you are promoting, is that also the latest code?

Yes. We are always promoting the latest code.

Re: RENAMELABEL and Vault 9.1 API Question/Request

Posted: Mon Mar 07, 2016 5:01 pm
by Beth
We have a copy label command in our CLC, which creates a copy of the label with a different name. Might be able to loop through a structure with that.

http://download.sourcegear.com/Vault/9. ... #COPYLABEL

I'll check with the developers on the API.

Re: RENAMELABEL and Vault 9.1 API Question/Request

Posted: Tue Mar 08, 2016 12:27 pm
by ejhansen71
Well, we don't want to loop through anything. It takes too long. We want to simply rename LABEL-A to LABEL-B on a given repository no matter what the label is placed on.


The COPYLABEL requires looping through every program and file just like RENAMELABEL does. There is no time savings, in fact there is an extra step because every file or folder that gets copied to the new label then has to have their old version deleted.

Really, we are looking for a CLC or API to do a SQL Server update:
"update repositoryABC.repositorypathDEF set labelname = '_TEST_pdq' where labelname = 'pdq'"

All records get updated in about 5 seconds and we move on.

Can you make that happen in a future release?