code_churn/fbf_churn.pl
author Chetan Kapoor <chetank@symbian.org>
Mon, 14 Sep 2009 13:40:02 +0100
changeset 49 c0d2a34bf681
child 55 7b39c2ae2526
permissions -rw-r--r--
Creating "code_churn" directory in utilities, and adding perl scripts for code chrun tool
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
49
c0d2a34bf681 Creating "code_churn" directory in utilities, and adding perl scripts for code chrun tool
Chetan Kapoor <chetank@symbian.org>
parents:
diff changeset
     1
#! perl -w
c0d2a34bf681 Creating "code_churn" directory in utilities, and adding perl scripts for code chrun tool
Chetan Kapoor <chetank@symbian.org>
parents:
diff changeset
     2
c0d2a34bf681 Creating "code_churn" directory in utilities, and adding perl scripts for code chrun tool
Chetan Kapoor <chetank@symbian.org>
parents:
diff changeset
     3
# Copyright (c) 2009 Symbian Foundation Ltd
c0d2a34bf681 Creating "code_churn" directory in utilities, and adding perl scripts for code chrun tool
Chetan Kapoor <chetank@symbian.org>
parents:
diff changeset
     4
# This component and the accompanying materials are made available
c0d2a34bf681 Creating "code_churn" directory in utilities, and adding perl scripts for code chrun tool
Chetan Kapoor <chetank@symbian.org>
parents:
diff changeset
     5
# under the terms of the License "Eclipse Public License v1.0"
c0d2a34bf681 Creating "code_churn" directory in utilities, and adding perl scripts for code chrun tool
Chetan Kapoor <chetank@symbian.org>
parents:
diff changeset
     6
# which accompanies this distribution, and is available
c0d2a34bf681 Creating "code_churn" directory in utilities, and adding perl scripts for code chrun tool
Chetan Kapoor <chetank@symbian.org>
parents:
diff changeset
     7
# at the URL "http://www.eclipse.org/legal/epl-v10.html".
c0d2a34bf681 Creating "code_churn" directory in utilities, and adding perl scripts for code chrun tool
Chetan Kapoor <chetank@symbian.org>
parents:
diff changeset
     8
#
c0d2a34bf681 Creating "code_churn" directory in utilities, and adding perl scripts for code chrun tool
Chetan Kapoor <chetank@symbian.org>
parents:
diff changeset
     9
# Initial Contributors:
c0d2a34bf681 Creating "code_churn" directory in utilities, and adding perl scripts for code chrun tool
Chetan Kapoor <chetank@symbian.org>
parents:
diff changeset
    10
# Symbian Foundation Ltd - initial contribution.
c0d2a34bf681 Creating "code_churn" directory in utilities, and adding perl scripts for code chrun tool
Chetan Kapoor <chetank@symbian.org>
parents:
diff changeset
    11
# 
c0d2a34bf681 Creating "code_churn" directory in utilities, and adding perl scripts for code chrun tool
Chetan Kapoor <chetank@symbian.org>
parents:
diff changeset
    12
# Contributors:
c0d2a34bf681 Creating "code_churn" directory in utilities, and adding perl scripts for code chrun tool
Chetan Kapoor <chetank@symbian.org>
parents:
diff changeset
    13
#
c0d2a34bf681 Creating "code_churn" directory in utilities, and adding perl scripts for code chrun tool
Chetan Kapoor <chetank@symbian.org>
parents:
diff changeset
    14
# Description:
c0d2a34bf681 Creating "code_churn" directory in utilities, and adding perl scripts for code chrun tool
Chetan Kapoor <chetank@symbian.org>
parents:
diff changeset
    15
#
c0d2a34bf681 Creating "code_churn" directory in utilities, and adding perl scripts for code chrun tool
Chetan Kapoor <chetank@symbian.org>
parents:
diff changeset
    16
c0d2a34bf681 Creating "code_churn" directory in utilities, and adding perl scripts for code chrun tool
Chetan Kapoor <chetank@symbian.org>
parents:
diff changeset
    17
use strict;
c0d2a34bf681 Creating "code_churn" directory in utilities, and adding perl scripts for code chrun tool
Chetan Kapoor <chetank@symbian.org>
parents:
diff changeset
    18
use Getopt::Long;
c0d2a34bf681 Creating "code_churn" directory in utilities, and adding perl scripts for code chrun tool
Chetan Kapoor <chetank@symbian.org>
parents:
diff changeset
    19
c0d2a34bf681 Creating "code_churn" directory in utilities, and adding perl scripts for code chrun tool
Chetan Kapoor <chetank@symbian.org>
parents:
diff changeset
    20
use FindBin;
c0d2a34bf681 Creating "code_churn" directory in utilities, and adding perl scripts for code chrun tool
Chetan Kapoor <chetank@symbian.org>
parents:
diff changeset
    21
#my $churn_core = "D:\\mirror\\churn_core.pl";
c0d2a34bf681 Creating "code_churn" directory in utilities, and adding perl scripts for code chrun tool
Chetan Kapoor <chetank@symbian.org>
parents:
diff changeset
    22
my $churn_core = "$FindBin::Bin\\churn_core.pl";
c0d2a34bf681 Creating "code_churn" directory in utilities, and adding perl scripts for code chrun tool
Chetan Kapoor <chetank@symbian.org>
parents:
diff changeset
    23
my $churn_output_temp = "$FindBin::Bin\\fbf_churn_output";
c0d2a34bf681 Creating "code_churn" directory in utilities, and adding perl scripts for code chrun tool
Chetan Kapoor <chetank@symbian.org>
parents:
diff changeset
    24
mkdir $churn_output_temp;
c0d2a34bf681 Creating "code_churn" directory in utilities, and adding perl scripts for code chrun tool
Chetan Kapoor <chetank@symbian.org>
parents:
diff changeset
    25
c0d2a34bf681 Creating "code_churn" directory in utilities, and adding perl scripts for code chrun tool
Chetan Kapoor <chetank@symbian.org>
parents:
diff changeset
    26
sub Usage($)
c0d2a34bf681 Creating "code_churn" directory in utilities, and adding perl scripts for code chrun tool
Chetan Kapoor <chetank@symbian.org>
parents:
diff changeset
    27
  {
c0d2a34bf681 Creating "code_churn" directory in utilities, and adding perl scripts for code chrun tool
Chetan Kapoor <chetank@symbian.org>
parents:
diff changeset
    28
  my ($msg) = @_;
c0d2a34bf681 Creating "code_churn" directory in utilities, and adding perl scripts for code chrun tool
Chetan Kapoor <chetank@symbian.org>
parents:
diff changeset
    29
  
c0d2a34bf681 Creating "code_churn" directory in utilities, and adding perl scripts for code chrun tool
Chetan Kapoor <chetank@symbian.org>
parents:
diff changeset
    30
  print "$msg\n\n" if ($msg ne "");
c0d2a34bf681 Creating "code_churn" directory in utilities, and adding perl scripts for code chrun tool
Chetan Kapoor <chetank@symbian.org>
parents:
diff changeset
    31
  
c0d2a34bf681 Creating "code_churn" directory in utilities, and adding perl scripts for code chrun tool
Chetan Kapoor <chetank@symbian.org>
parents:
diff changeset
    32
	print <<'EOF';
c0d2a34bf681 Creating "code_churn" directory in utilities, and adding perl scripts for code chrun tool
Chetan Kapoor <chetank@symbian.org>
parents:
diff changeset
    33
c0d2a34bf681 Creating "code_churn" directory in utilities, and adding perl scripts for code chrun tool
Chetan Kapoor <chetank@symbian.org>
parents:
diff changeset
    34
	
c0d2a34bf681 Creating "code_churn" directory in utilities, and adding perl scripts for code chrun tool
Chetan Kapoor <chetank@symbian.org>
parents:
diff changeset
    35
fbf_churn.pl - simple script for calculating code churn in between two revisions 
c0d2a34bf681 Creating "code_churn" directory in utilities, and adding perl scripts for code chrun tool
Chetan Kapoor <chetank@symbian.org>
parents:
diff changeset
    36
or labels for a package. This script can also be used to calculate code size for 
c0d2a34bf681 Creating "code_churn" directory in utilities, and adding perl scripts for code chrun tool
Chetan Kapoor <chetank@symbian.org>
parents:
diff changeset
    37
a package.
c0d2a34bf681 Creating "code_churn" directory in utilities, and adding perl scripts for code chrun tool
Chetan Kapoor <chetank@symbian.org>
parents:
diff changeset
    38
c0d2a34bf681 Creating "code_churn" directory in utilities, and adding perl scripts for code chrun tool
Chetan Kapoor <chetank@symbian.org>
parents:
diff changeset
    39
When used without a package name or filter, this script runs for all the packages
c0d2a34bf681 Creating "code_churn" directory in utilities, and adding perl scripts for code chrun tool
Chetan Kapoor <chetank@symbian.org>
parents:
diff changeset
    40
in the BOM (build-info.xml) file supplied to it. 
c0d2a34bf681 Creating "code_churn" directory in utilities, and adding perl scripts for code chrun tool
Chetan Kapoor <chetank@symbian.org>
parents:
diff changeset
    41
c0d2a34bf681 Creating "code_churn" directory in utilities, and adding perl scripts for code chrun tool
Chetan Kapoor <chetank@symbian.org>
parents:
diff changeset
    42
Important: 
c0d2a34bf681 Creating "code_churn" directory in utilities, and adding perl scripts for code chrun tool
Chetan Kapoor <chetank@symbian.org>
parents:
diff changeset
    43
  This script uses clone_all_packages.pl which clones all repositories listed in 
c0d2a34bf681 Creating "code_churn" directory in utilities, and adding perl scripts for code chrun tool
Chetan Kapoor <chetank@symbian.org>
parents:
diff changeset
    44
  the BOM or pull changes into a previously cloned repository.
c0d2a34bf681 Creating "code_churn" directory in utilities, and adding perl scripts for code chrun tool
Chetan Kapoor <chetank@symbian.org>
parents:
diff changeset
    45
  
c0d2a34bf681 Creating "code_churn" directory in utilities, and adding perl scripts for code chrun tool
Chetan Kapoor <chetank@symbian.org>
parents:
diff changeset
    46
  This script uses its accompayning script churn_core.pl - which should be
c0d2a34bf681 Creating "code_churn" directory in utilities, and adding perl scripts for code chrun tool
Chetan Kapoor <chetank@symbian.org>
parents:
diff changeset
    47
  present in the same directory as this script.
c0d2a34bf681 Creating "code_churn" directory in utilities, and adding perl scripts for code chrun tool
Chetan Kapoor <chetank@symbian.org>
parents:
diff changeset
    48
c0d2a34bf681 Creating "code_churn" directory in utilities, and adding perl scripts for code chrun tool
Chetan Kapoor <chetank@symbian.org>
parents:
diff changeset
    49
Limitations:
c0d2a34bf681 Creating "code_churn" directory in utilities, and adding perl scripts for code chrun tool
Chetan Kapoor <chetank@symbian.org>
parents:
diff changeset
    50
  If a BOM is not supplied to the script using the -bom option, then the script 
c0d2a34bf681 Creating "code_churn" directory in utilities, and adding perl scripts for code chrun tool
Chetan Kapoor <chetank@symbian.org>
parents:
diff changeset
    51
  runs on the package locations inside both MCL and FCL producing two results
c0d2a34bf681 Creating "code_churn" directory in utilities, and adding perl scripts for code chrun tool
Chetan Kapoor <chetank@symbian.org>
parents:
diff changeset
    52
  for a single package. For running the script for calculating code churn between 
c0d2a34bf681 Creating "code_churn" directory in utilities, and adding perl scripts for code chrun tool
Chetan Kapoor <chetank@symbian.org>
parents:
diff changeset
    53
  two release buils (using labels) or for calculating code size for a release build,
c0d2a34bf681 Creating "code_churn" directory in utilities, and adding perl scripts for code chrun tool
Chetan Kapoor <chetank@symbian.org>
parents:
diff changeset
    54
  it is essential that a BOM (preferably for the newer build) is passed as an 
c0d2a34bf681 Creating "code_churn" directory in utilities, and adding perl scripts for code chrun tool
Chetan Kapoor <chetank@symbian.org>
parents:
diff changeset
    55
  argument using the -bom option.
c0d2a34bf681 Creating "code_churn" directory in utilities, and adding perl scripts for code chrun tool
Chetan Kapoor <chetank@symbian.org>
parents:
diff changeset
    56
  
c0d2a34bf681 Creating "code_churn" directory in utilities, and adding perl scripts for code chrun tool
Chetan Kapoor <chetank@symbian.org>
parents:
diff changeset
    57
c0d2a34bf681 Creating "code_churn" directory in utilities, and adding perl scripts for code chrun tool
Chetan Kapoor <chetank@symbian.org>
parents:
diff changeset
    58
Options:
c0d2a34bf681 Creating "code_churn" directory in utilities, and adding perl scripts for code chrun tool
Chetan Kapoor <chetank@symbian.org>
parents:
diff changeset
    59
c0d2a34bf681 Creating "code_churn" directory in utilities, and adding perl scripts for code chrun tool
Chetan Kapoor <chetank@symbian.org>
parents:
diff changeset
    60
-o --old		old revision or label for a package/respoitory
c0d2a34bf681 Creating "code_churn" directory in utilities, and adding perl scripts for code chrun tool
Chetan Kapoor <chetank@symbian.org>
parents:
diff changeset
    61
c0d2a34bf681 Creating "code_churn" directory in utilities, and adding perl scripts for code chrun tool
Chetan Kapoor <chetank@symbian.org>
parents:
diff changeset
    62
-n --new		new revision or label for a package/respoitory
c0d2a34bf681 Creating "code_churn" directory in utilities, and adding perl scripts for code chrun tool
Chetan Kapoor <chetank@symbian.org>
parents:
diff changeset
    63
c0d2a34bf681 Creating "code_churn" directory in utilities, and adding perl scripts for code chrun tool
Chetan Kapoor <chetank@symbian.org>
parents:
diff changeset
    64
--rev			revision for package/respoitory - Use this while calculating code size for a single package
c0d2a34bf681 Creating "code_churn" directory in utilities, and adding perl scripts for code chrun tool
Chetan Kapoor <chetank@symbian.org>
parents:
diff changeset
    65
			
c0d2a34bf681 Creating "code_churn" directory in utilities, and adding perl scripts for code chrun tool
Chetan Kapoor <chetank@symbian.org>
parents:
diff changeset
    66
--label			revision tag for package or release build - Use this while calculating code size
c0d2a34bf681 Creating "code_churn" directory in utilities, and adding perl scripts for code chrun tool
Chetan Kapoor <chetank@symbian.org>
parents:
diff changeset
    67
c0d2a34bf681 Creating "code_churn" directory in utilities, and adding perl scripts for code chrun tool
Chetan Kapoor <chetank@symbian.org>
parents:
diff changeset
    68
-bom --bom		build-info.xml files supplied with Symbian PDKs
c0d2a34bf681 Creating "code_churn" directory in utilities, and adding perl scripts for code chrun tool
Chetan Kapoor <chetank@symbian.org>
parents:
diff changeset
    69
c0d2a34bf681 Creating "code_churn" directory in utilities, and adding perl scripts for code chrun tool
Chetan Kapoor <chetank@symbian.org>
parents:
diff changeset
    70
-verbose		print the underlying "clone_all_packages" & "hg" commands before executing them
c0d2a34bf681 Creating "code_churn" directory in utilities, and adding perl scripts for code chrun tool
Chetan Kapoor <chetank@symbian.org>
parents:
diff changeset
    71
c0d2a34bf681 Creating "code_churn" directory in utilities, and adding perl scripts for code chrun tool
Chetan Kapoor <chetank@symbian.org>
parents:
diff changeset
    72
-help			print this help information
c0d2a34bf681 Creating "code_churn" directory in utilities, and adding perl scripts for code chrun tool
Chetan Kapoor <chetank@symbian.org>
parents:
diff changeset
    73
c0d2a34bf681 Creating "code_churn" directory in utilities, and adding perl scripts for code chrun tool
Chetan Kapoor <chetank@symbian.org>
parents:
diff changeset
    74
-package <RE>   	only process repositories matching regular expression <RE>
c0d2a34bf681 Creating "code_churn" directory in utilities, and adding perl scripts for code chrun tool
Chetan Kapoor <chetank@symbian.org>
parents:
diff changeset
    75
c0d2a34bf681 Creating "code_churn" directory in utilities, and adding perl scripts for code chrun tool
Chetan Kapoor <chetank@symbian.org>
parents:
diff changeset
    76
-filter <RE>    	only process repositories matching regular expression <RE>
c0d2a34bf681 Creating "code_churn" directory in utilities, and adding perl scripts for code chrun tool
Chetan Kapoor <chetank@symbian.org>
parents:
diff changeset
    77
c0d2a34bf681 Creating "code_churn" directory in utilities, and adding perl scripts for code chrun tool
Chetan Kapoor <chetank@symbian.org>
parents:
diff changeset
    78
EOF
c0d2a34bf681 Creating "code_churn" directory in utilities, and adding perl scripts for code chrun tool
Chetan Kapoor <chetank@symbian.org>
parents:
diff changeset
    79
  exit (1);  
c0d2a34bf681 Creating "code_churn" directory in utilities, and adding perl scripts for code chrun tool
Chetan Kapoor <chetank@symbian.org>
parents:
diff changeset
    80
  }
c0d2a34bf681 Creating "code_churn" directory in utilities, and adding perl scripts for code chrun tool
Chetan Kapoor <chetank@symbian.org>
parents:
diff changeset
    81
c0d2a34bf681 Creating "code_churn" directory in utilities, and adding perl scripts for code chrun tool
Chetan Kapoor <chetank@symbian.org>
parents:
diff changeset
    82
print "\n\n==Symbian Foundation Code Churn Tool v1.0==\n\n";
c0d2a34bf681 Creating "code_churn" directory in utilities, and adding perl scripts for code chrun tool
Chetan Kapoor <chetank@symbian.org>
parents:
diff changeset
    83
c0d2a34bf681 Creating "code_churn" directory in utilities, and adding perl scripts for code chrun tool
Chetan Kapoor <chetank@symbian.org>
parents:
diff changeset
    84
c0d2a34bf681 Creating "code_churn" directory in utilities, and adding perl scripts for code chrun tool
Chetan Kapoor <chetank@symbian.org>
parents:
diff changeset
    85
c0d2a34bf681 Creating "code_churn" directory in utilities, and adding perl scripts for code chrun tool
Chetan Kapoor <chetank@symbian.org>
parents:
diff changeset
    86
my $old = "null";
c0d2a34bf681 Creating "code_churn" directory in utilities, and adding perl scripts for code chrun tool
Chetan Kapoor <chetank@symbian.org>
parents:
diff changeset
    87
my $new = "";
c0d2a34bf681 Creating "code_churn" directory in utilities, and adding perl scripts for code chrun tool
Chetan Kapoor <chetank@symbian.org>
parents:
diff changeset
    88
my $filter = "";
c0d2a34bf681 Creating "code_churn" directory in utilities, and adding perl scripts for code chrun tool
Chetan Kapoor <chetank@symbian.org>
parents:
diff changeset
    89
my $codeline = "";
c0d2a34bf681 Creating "code_churn" directory in utilities, and adding perl scripts for code chrun tool
Chetan Kapoor <chetank@symbian.org>
parents:
diff changeset
    90
my $package = "";
c0d2a34bf681 Creating "code_churn" directory in utilities, and adding perl scripts for code chrun tool
Chetan Kapoor <chetank@symbian.org>
parents:
diff changeset
    91
my $licence = "";
c0d2a34bf681 Creating "code_churn" directory in utilities, and adding perl scripts for code chrun tool
Chetan Kapoor <chetank@symbian.org>
parents:
diff changeset
    92
my $packagelist = "";
c0d2a34bf681 Creating "code_churn" directory in utilities, and adding perl scripts for code chrun tool
Chetan Kapoor <chetank@symbian.org>
parents:
diff changeset
    93
my $verbose = 0;
c0d2a34bf681 Creating "code_churn" directory in utilities, and adding perl scripts for code chrun tool
Chetan Kapoor <chetank@symbian.org>
parents:
diff changeset
    94
my $help = 0;
c0d2a34bf681 Creating "code_churn" directory in utilities, and adding perl scripts for code chrun tool
Chetan Kapoor <chetank@symbian.org>
parents:
diff changeset
    95
c0d2a34bf681 Creating "code_churn" directory in utilities, and adding perl scripts for code chrun tool
Chetan Kapoor <chetank@symbian.org>
parents:
diff changeset
    96
sub do_system
c0d2a34bf681 Creating "code_churn" directory in utilities, and adding perl scripts for code chrun tool
Chetan Kapoor <chetank@symbian.org>
parents:
diff changeset
    97
	{
c0d2a34bf681 Creating "code_churn" directory in utilities, and adding perl scripts for code chrun tool
Chetan Kapoor <chetank@symbian.org>
parents:
diff changeset
    98
	my (@args) = @_;
c0d2a34bf681 Creating "code_churn" directory in utilities, and adding perl scripts for code chrun tool
Chetan Kapoor <chetank@symbian.org>
parents:
diff changeset
    99
	print "* ", join(" ", @args), "\n" if ($verbose);
c0d2a34bf681 Creating "code_churn" directory in utilities, and adding perl scripts for code chrun tool
Chetan Kapoor <chetank@symbian.org>
parents:
diff changeset
   100
	return system(@args);
c0d2a34bf681 Creating "code_churn" directory in utilities, and adding perl scripts for code chrun tool
Chetan Kapoor <chetank@symbian.org>
parents:
diff changeset
   101
	}
c0d2a34bf681 Creating "code_churn" directory in utilities, and adding perl scripts for code chrun tool
Chetan Kapoor <chetank@symbian.org>
parents:
diff changeset
   102
c0d2a34bf681 Creating "code_churn" directory in utilities, and adding perl scripts for code chrun tool
Chetan Kapoor <chetank@symbian.org>
parents:
diff changeset
   103
# Analyse the command-line parameters
c0d2a34bf681 Creating "code_churn" directory in utilities, and adding perl scripts for code chrun tool
Chetan Kapoor <chetank@symbian.org>
parents:
diff changeset
   104
if (!GetOptions(
c0d2a34bf681 Creating "code_churn" directory in utilities, and adding perl scripts for code chrun tool
Chetan Kapoor <chetank@symbian.org>
parents:
diff changeset
   105
    "n|new-rev|new-label|label|rev=s" => \$new,
c0d2a34bf681 Creating "code_churn" directory in utilities, and adding perl scripts for code chrun tool
Chetan Kapoor <chetank@symbian.org>
parents:
diff changeset
   106
    "o|old-rev|old-label=s" => \$old,
c0d2a34bf681 Creating "code_churn" directory in utilities, and adding perl scripts for code chrun tool
Chetan Kapoor <chetank@symbian.org>
parents:
diff changeset
   107
    "f|filter=s" => \$filter,
c0d2a34bf681 Creating "code_churn" directory in utilities, and adding perl scripts for code chrun tool
Chetan Kapoor <chetank@symbian.org>
parents:
diff changeset
   108
    "p|package=s" => \$filter,
c0d2a34bf681 Creating "code_churn" directory in utilities, and adding perl scripts for code chrun tool
Chetan Kapoor <chetank@symbian.org>
parents:
diff changeset
   109
    "cl|codeline=s" => \$codeline,
c0d2a34bf681 Creating "code_churn" directory in utilities, and adding perl scripts for code chrun tool
Chetan Kapoor <chetank@symbian.org>
parents:
diff changeset
   110
    "li|licence=s" => \$licence,
c0d2a34bf681 Creating "code_churn" directory in utilities, and adding perl scripts for code chrun tool
Chetan Kapoor <chetank@symbian.org>
parents:
diff changeset
   111
	"bom|bom=s" => \$packagelist,
c0d2a34bf681 Creating "code_churn" directory in utilities, and adding perl scripts for code chrun tool
Chetan Kapoor <chetank@symbian.org>
parents:
diff changeset
   112
	"v|verbose" => \$verbose,
c0d2a34bf681 Creating "code_churn" directory in utilities, and adding perl scripts for code chrun tool
Chetan Kapoor <chetank@symbian.org>
parents:
diff changeset
   113
	"h|help" => \$help,
c0d2a34bf681 Creating "code_churn" directory in utilities, and adding perl scripts for code chrun tool
Chetan Kapoor <chetank@symbian.org>
parents:
diff changeset
   114
    ))
c0d2a34bf681 Creating "code_churn" directory in utilities, and adding perl scripts for code chrun tool
Chetan Kapoor <chetank@symbian.org>
parents:
diff changeset
   115
  {
c0d2a34bf681 Creating "code_churn" directory in utilities, and adding perl scripts for code chrun tool
Chetan Kapoor <chetank@symbian.org>
parents:
diff changeset
   116
  Usage("Invalid argument");
c0d2a34bf681 Creating "code_churn" directory in utilities, and adding perl scripts for code chrun tool
Chetan Kapoor <chetank@symbian.org>
parents:
diff changeset
   117
  }
c0d2a34bf681 Creating "code_churn" directory in utilities, and adding perl scripts for code chrun tool
Chetan Kapoor <chetank@symbian.org>
parents:
diff changeset
   118
  
c0d2a34bf681 Creating "code_churn" directory in utilities, and adding perl scripts for code chrun tool
Chetan Kapoor <chetank@symbian.org>
parents:
diff changeset
   119
Usage("") if ($help);
c0d2a34bf681 Creating "code_churn" directory in utilities, and adding perl scripts for code chrun tool
Chetan Kapoor <chetank@symbian.org>
parents:
diff changeset
   120
Usage("Too few arguments....use at least one from -n|new-rev|new-label|label|rev or -bom") if ($new eq "" && $packagelist eq "");
c0d2a34bf681 Creating "code_churn" directory in utilities, and adding perl scripts for code chrun tool
Chetan Kapoor <chetank@symbian.org>
parents:
diff changeset
   121
#Usage("Too many arguments") if ($new ne "" && $packagelist ne "");
c0d2a34bf681 Creating "code_churn" directory in utilities, and adding perl scripts for code chrun tool
Chetan Kapoor <chetank@symbian.org>
parents:
diff changeset
   122
c0d2a34bf681 Creating "code_churn" directory in utilities, and adding perl scripts for code chrun tool
Chetan Kapoor <chetank@symbian.org>
parents:
diff changeset
   123
c0d2a34bf681 Creating "code_churn" directory in utilities, and adding perl scripts for code chrun tool
Chetan Kapoor <chetank@symbian.org>
parents:
diff changeset
   124
if ($old eq 'null')
c0d2a34bf681 Creating "code_churn" directory in utilities, and adding perl scripts for code chrun tool
Chetan Kapoor <chetank@symbian.org>
parents:
diff changeset
   125
  {
c0d2a34bf681 Creating "code_churn" directory in utilities, and adding perl scripts for code chrun tool
Chetan Kapoor <chetank@symbian.org>
parents:
diff changeset
   126
    print "\nCode size calculation....\n";		  
c0d2a34bf681 Creating "code_churn" directory in utilities, and adding perl scripts for code chrun tool
Chetan Kapoor <chetank@symbian.org>
parents:
diff changeset
   127
  }
c0d2a34bf681 Creating "code_churn" directory in utilities, and adding perl scripts for code chrun tool
Chetan Kapoor <chetank@symbian.org>
parents:
diff changeset
   128
else
c0d2a34bf681 Creating "code_churn" directory in utilities, and adding perl scripts for code chrun tool
Chetan Kapoor <chetank@symbian.org>
parents:
diff changeset
   129
  {
c0d2a34bf681 Creating "code_churn" directory in utilities, and adding perl scripts for code chrun tool
Chetan Kapoor <chetank@symbian.org>
parents:
diff changeset
   130
    print "\nCode churn calculation....\n";		  
c0d2a34bf681 Creating "code_churn" directory in utilities, and adding perl scripts for code chrun tool
Chetan Kapoor <chetank@symbian.org>
parents:
diff changeset
   131
  }
c0d2a34bf681 Creating "code_churn" directory in utilities, and adding perl scripts for code chrun tool
Chetan Kapoor <chetank@symbian.org>
parents:
diff changeset
   132
c0d2a34bf681 Creating "code_churn" directory in utilities, and adding perl scripts for code chrun tool
Chetan Kapoor <chetank@symbian.org>
parents:
diff changeset
   133
  
c0d2a34bf681 Creating "code_churn" directory in utilities, and adding perl scripts for code chrun tool
Chetan Kapoor <chetank@symbian.org>
parents:
diff changeset
   134
my @packagelistopts = ();
c0d2a34bf681 Creating "code_churn" directory in utilities, and adding perl scripts for code chrun tool
Chetan Kapoor <chetank@symbian.org>
parents:
diff changeset
   135
@packagelistopts = ("-packagelist", $packagelist) if ($packagelist ne "");
c0d2a34bf681 Creating "code_churn" directory in utilities, and adding perl scripts for code chrun tool
Chetan Kapoor <chetank@symbian.org>
parents:
diff changeset
   136
c0d2a34bf681 Creating "code_churn" directory in utilities, and adding perl scripts for code chrun tool
Chetan Kapoor <chetank@symbian.org>
parents:
diff changeset
   137
my @verboseopt = ();
c0d2a34bf681 Creating "code_churn" directory in utilities, and adding perl scripts for code chrun tool
Chetan Kapoor <chetank@symbian.org>
parents:
diff changeset
   138
@verboseopt = "-v" if ($verbose);
c0d2a34bf681 Creating "code_churn" directory in utilities, and adding perl scripts for code chrun tool
Chetan Kapoor <chetank@symbian.org>
parents:
diff changeset
   139
c0d2a34bf681 Creating "code_churn" directory in utilities, and adding perl scripts for code chrun tool
Chetan Kapoor <chetank@symbian.org>
parents:
diff changeset
   140
my $new_rev = $new;
c0d2a34bf681 Creating "code_churn" directory in utilities, and adding perl scripts for code chrun tool
Chetan Kapoor <chetank@symbian.org>
parents:
diff changeset
   141
$new_rev = "%REV%" if ($new_rev eq "");
c0d2a34bf681 Creating "code_churn" directory in utilities, and adding perl scripts for code chrun tool
Chetan Kapoor <chetank@symbian.org>
parents:
diff changeset
   142
c0d2a34bf681 Creating "code_churn" directory in utilities, and adding perl scripts for code chrun tool
Chetan Kapoor <chetank@symbian.org>
parents:
diff changeset
   143
#TO_DO: Locate clone_all_packages relative to the location of this script.
c0d2a34bf681 Creating "code_churn" directory in utilities, and adding perl scripts for code chrun tool
Chetan Kapoor <chetank@symbian.org>
parents:
diff changeset
   144
#TO_DO: Remove references to absolute paths, change to relative paths.
c0d2a34bf681 Creating "code_churn" directory in utilities, and adding perl scripts for code chrun tool
Chetan Kapoor <chetank@symbian.org>
parents:
diff changeset
   145
do_system("clone_all_packages.pl",@verboseopt,"-mirror","-filter","$licence.*$codeline.*$filter",@packagelistopts,"-exec","--",
c0d2a34bf681 Creating "code_churn" directory in utilities, and adding perl scripts for code chrun tool
Chetan Kapoor <chetank@symbian.org>
parents:
diff changeset
   146
   "hg","--config","\"extensions.hgext.extdiff=\"","extdiff","-p",$churn_core,"-o",$churn_output_temp,
c0d2a34bf681 Creating "code_churn" directory in utilities, and adding perl scripts for code chrun tool
Chetan Kapoor <chetank@symbian.org>
parents:
diff changeset
   147
   "-r","$old","-r","$new_rev");
c0d2a34bf681 Creating "code_churn" directory in utilities, and adding perl scripts for code chrun tool
Chetan Kapoor <chetank@symbian.org>
parents:
diff changeset
   148
c0d2a34bf681 Creating "code_churn" directory in utilities, and adding perl scripts for code chrun tool
Chetan Kapoor <chetank@symbian.org>
parents:
diff changeset
   149
exit(0);