Suggestion: Add "label" as a keyword string.

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

Moderator: SourceGear

Post Reply
Dave Schulte
Posts: 55
Joined: Thu Dec 02, 2004 1:59 pm

Suggestion: Add "label" as a keyword string.

Post by Dave Schulte » Mon Dec 20, 2004 11:43 am

It would be useful to have "label" as an expandable keyword string. Given that we plan to use labels that match our product release number it would be useful to be able to refer to this label as a keyword string in files that report this information via a "help about" menu selection, without having to edit our source each time we issue a new release.
Just a suggestion.

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

Post by dan » Tue Dec 21, 2004 8:58 am

We can add this as a feature request, but I'd need to know more about what you are looking for. What should a $Label: $ keyword expand to? The most recently applied label?

Dave Schulte
Posts: 55
Joined: Thu Dec 02, 2004 1:59 pm

Post by Dave Schulte » Tue Dec 21, 2004 10:09 am

This might be more difficult than it sounds.

What we would like to do is to have a "label" keyword expanded to equal the label used when doing a "Get Label". The default behavior when doing a simple "Get" might be to expand the label to the latest label applied to the given source file.

The purpose of this feature would be to enable us to automatically update a source module with release information that is based on the label applied in Vault, without having to edit the file each time we release/label our product.

Does this help?

GregM
Posts: 485
Joined: Sat Mar 13, 2004 9:00 am

Post by GregM » Tue Dec 21, 2004 10:35 am

Doesn't keyword expansion only happen in comments?

Dave Schulte
Posts: 55
Joined: Thu Dec 02, 2004 1:59 pm

Post by Dave Schulte » Tue Dec 21, 2004 10:39 am

No, keyword expansion will occur anywhere in the code where something like "$Header: $" appears.

Example:

static char *test "$Header: /dave.schulte/tmp/Actions.cpp 2 2004-12-21 11:38:33-05:00 dave.schulte $";

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

Post by dan » Tue Dec 21, 2004 11:06 am

Dave Schulte wrote:What we would like to do is to have a "label" keyword expanded to equal the label used when doing a "Get Label". The default behavior when doing a simple "Get" might be to expand the label to the latest label applied to the given source file.
I understand the second part of this but not the first (because a Get by Label requires you to specify a label, which wouldn't work so easily in keyword expansion). Perhaps an example would help:

If a source file had a label "Version 1" applied to it, then a "Version 2", a Get on the file with this:

$Label: $

would expand to this:

$Label: Version 2 $

If another label were applied "Version 3", a new Get one then have:

$Label: Version 3 $

This could be done, but it might not have the effect you want, because a Get will only replace the keyword if there has been a new version of the file checked in. If the only thing that has happened is a new label applied to the file, the Get is not designed to catch that (because Get downloads files when a new version is available, and wouldn't know to check the keywords inside the file).

So, to get this to do what you want, you'd need to not use working folders when doing builds, and get fresh copies of the files each time.

Dave Schulte
Posts: 55
Joined: Thu Dec 02, 2004 1:59 pm

Post by Dave Schulte » Tue Dec 21, 2004 11:11 am

I figured this would be a problem (in that keywords are only expanded on add or checkin). In this scenario, we would apply the label after we finalize a release, which would result in none of the files associated with the label having the correct keyword expansion.

Yes, this is not what we want. If such a feature were added, it would mean for the "Label" keyword alone we would have to have the keyword expanded at the time a Get, Get from Label, or even Branch from Label, is done.

Never mind. This is probably too much of a change for how Vault currently behaves.

GregM
Posts: 485
Joined: Sat Mar 13, 2004 9:00 am

Post by GregM » Tue Dec 21, 2004 12:40 pm

Ah, yes, I forgot about that. I've used that in the past, so you'd think I'd remember that.

Post Reply