Getting version number for a folder

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

Moderator: SourceGear

Post Reply
Hans Olav Nymand
Posts: 55
Joined: Wed Sep 29, 2004 8:09 am
Location: Denmark, Copenhagen
Contact:

Getting version number for a folder

Post by Hans Olav Nymand » Mon Jun 30, 2008 1:45 am

Hi,

When I use the "Show history" function on a folder and select "View folder history by version", the resulting view will have a maximum (or latest) version number in the 1st line (top line).

I take this can be referred to as the "folder version".

I am looking for a way to get the "folder version" for a specified folder either via command-line or even better via Keyword expansion.

The reason is that I would like to use this number as a kind of build-number.

Today we work with a version number with a classical structure major.minor.release.build.

All 4 are updated manually - it would be great if the last of the 4 could be assigned automatically from vault, preferably by keyword expansion (I imagine something like $FolderVersion <foldername>$ or by command-line (we can then make a small script for this).

Best regards,
Hans Olav Nymand

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

Post by GregM » Mon Jun 30, 2008 1:36 pm

This is what we use to make our build number out of the transaction ID.

$vaultexe = $ENV{'VAULT_EXE'};
$vault = $ENV{'VAULT_TRUNK'};

$commandline = "\"$vaultexe\" versionhistory -rowlimit 1 -datesort desc -norecursive -excludeactions label -repository \"Default Repository\" $vault";

#Run the vault command and store results
$result = `$commandline`;

#Extract the value of the 'txid="*"' field
$result =~ /txid=\"(\d+)\"/;

$txid = $1;

#Extract the value of the 'version="*"' field
$result =~ /version=\"(\d+)\"/;

$folderversion = $1;

Post Reply