Watch The Superbowl online

SuperBowl

super bowl

live superbowl stream

live superbowl stream

watch superbowl live

Watch The Superbowl online

watch superbowl online

watch superbowl online

watch superbowl live

Querying MS Visual Source Safe in Perl – List Check-Ins

Posted by jonathan on August 15, 2007

The following code needs Visual Source Safe to be installed, and produces a list of all file versions for the project folder set up as ‘my $project’.  Remember to set the network folder where the ss.ini file lives.

The program outputs a tab separated list of:
filename->version->user->date->comment.

Enjoy! My next post will take this file and dump out the lines added, changed, deleted for whatever subset of the check-ins that you are interested in.



#!/usr/bin/perl -w
use strict;

#-------------------------------------------------------------------
# Given a source project folder, list the files and check-in details
#
# ToDo:
# Progress indicator
# Usage output.
# Take command-line arguments
#-------------------------------------------------------------------

$ENV{'SSDIR'} = "";
my $project = "";

# Start with the project folder
my @files;
open( ssFiles, "ss Dir \$/$project|");

# Iterate through the list of files
while( ) {

# Get all the cpp and .h files
if( /.*\.cpp/ || /.*\.h/ ) {
push @files, $_;
}
}
close( ssFiles );

# Print a header line
print "Filename\tVersion\tDeveloper\tDate\tComment\n";

# Iterate over the list of chomp'ed files (removes trailing newlines)
chomp( @files );
foreach( @files ) {

# What we are looking at
my $file = $_;
my $lastver = -1;
my( $ver, $use, $date, $com );

# Get history of versions for file, excluding build labels
open( ssHistory, "ss History \$/$project/$_|");
while( ) {

# Get version number
if( m/^.*Version (\d*) .*/ ) {
$ver = $1;
}

# Get user name
if( m/^.*User\: (\w*).*Date\:.* (\d+)\/(\d*)\/(\d*) .*Time.*/ ) {
$use = $1;
$date = "$2/$3/20$4";
}

# Get comment
if( m/^.*Comment\: (.*).*$/ ) {
$com = $1;
}

# If we have all vars populated and haven't already printed this version check-in
# then go ahead and print it out
if( /^$/ && $ver && $use && $lastver!=$ver ) { # $com optional
$lastver = $ver;
print "$file\t$ver\t$use\t$date\t$com\n";

# We are done with this data now
$ver = $use = $date = $com = undef;
}
}

# Close command stream
close( ssHistory );

}
exit 0;

Trackbacks

Use this link to trackback from your own site.

Comments

Leave a response

Comments