#! /usr/bin/perl -w use strict; =head1 Notices Originally developed for Perforce by VIZIM (www.vizim.com) Copyright (c) 2014 Perforce Software, Inc. and VIZIM Worldwide, Inc. All rights reserved. Please see LICENSE.txt in top-level folder of this distribution for license information =cut use v5.14.0; # Earliest version testing was performed against my $APPNAME = 'TFSTwoHop.pl'; my $APPWHAT = 'Two hop rename log extraction; version 1.02'; my $APPNOTICES = "Copyright (c) 2014 Perforce Software, Inc. and VIZIM Worldwide, Inc. All rights reserved. See LICENSE.txt for license information."; =head1 Two hop rename identifier Tool that scans the log output from TFSAssociate.pl for "twohop" renames. Twohop renames are a rename that is subsequently renamed to another name prior to check in. There may be other intermediate renames but TFS only reports on the first and last renames in a sequence. The output is lines to resolve the twohop renames in the format expected by the TFSRenames.pl tool. =cut if( defined $ARGV[0] && (uc $ARGV[0] eq '-V') ) { print "$APPWHAT\n"; exit(0); } if( ! defined $ARGV[0] || $ARGV[0] =~ m!^\-+[h\?]! ) { print "$APPWHAT $APPNOTICES Usage: $APPNAME -V $APPNAME [-h|-?] $APPNAME AssociateLog\n"; exit( 0 ); } if( ! -e $ARGV[0] ) { print "Associate log file does not exist - $ARGV[0]\n"; exit 1; } if( ! -f $ARGV[0] ) { print "Associate log file is not a file - $ARGV[0]\n"; exit 1; } my $hLog; open $hLog, '<', $ARGV[0] || die "Can't open $ARGV[0] $!"; my $changeset = 0; while(<$hLog>) { $changeset = $1 if m!Changeset (\d+)!; next unless m!RenameMatching delete!; print "RF $changeset $1\n" if m!\(([^\)]+)\)!; } close $hLog;