Label Comparison

If you are having a problem using Vault, post a message here.

Moderator: SourceGear

Post Reply
danvault

Label Comparison

Post by danvault » Tue Sep 27, 2005 10:45 am

Does anyone know of a good way, through the Client, the command line, or the API, of ensuring that an item has a matching set of labels? For example, we want to ensure that a version of a source code item has a code review label and a build request label before the build is executed. We can take the information in report form (i.e., list all files with a build request label that do not have a code review label at the same version) or as a preventaive measure (i.e., don't allow a build request label unless there is a code review label).

Any ideas or suggestions?

dan
Posts: 2448
Joined: Wed Dec 17, 2003 5:03 pm
Location: SourceGear
Contact:

Post by dan » Tue Sep 27, 2005 11:35 am

The GUI client shows labels of a file or folder by invoking either the Show History and Show Labels commands. However, only show history allows you to output the results to a file for inclusion in a report.

If you want something automated to prevent builds that don't have labels, you might need to use or modify the the command line client. The CLC has a HISTORY command that shows history output in XML format, but doesn't have a corresponding show labels command. The source for the CLC is available in the Client API installer on the download page, which would allow you to modify it to work exactly like you want.

danvault

API Help

Post by danvault » Wed Sep 28, 2005 11:26 am

What I really need to do is:
A. Produce a list of file versions that have a particular label (whether the label is on the file itself or inherited from a folder) by the string of the label, not label id
THEN
B. For each file version in the list from A, pull the list of labels for that version and make sure the "paired" partner is there. If it is not, report it.

This sounds simple enough to write down, but I'm having a heck of time trying to figure out which API commands will get me there.

Any ideas?

dan
Posts: 2448
Joined: Wed Dec 17, 2003 5:03 pm
Location: SourceGear
Contact:

Post by dan » Wed Sep 28, 2005 12:23 pm

Does the command line client "HISTORY -labels" code have any useful examples, or perhaps the GETLABELDIFFS command?

danvault

Almost....

Post by danvault » Wed Sep 28, 2005 12:56 pm

Thanks! The HISTORY code helps with part B, but not with the first part. Getting the list of files (and versions) by label is the tricky part from where I'm sitting....

dan
Posts: 2448
Joined: Wed Dec 17, 2003 5:03 pm
Location: SourceGear
Contact:

Post by dan » Wed Sep 28, 2005 1:23 pm

I think what you want is ClientInstance.BeginLabelQuery(), which works a lot like a history query. You would need to get the label ID first though (passed in through _queryObjectID parameter), since there is no method that takes a label name for this. I think there are examples in the CLC code for getting a label ID from a label name - let me know if you can't find it.

Post Reply