author | Dario Sestito <darios@symbian.org> |
Wed, 12 May 2010 10:32:26 +0100 | |
changeset 238 | 09b83ca8e0cf |
parent 19 | 54785ea4cd2e |
permissions | -rw-r--r-- |
17
4ed8ba809509
Add utility to summarise the hg status output across multiple packages
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
1 |
#! perl |
4ed8ba809509
Add utility to summarise the hg status output across multiple packages
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
2 |
|
4ed8ba809509
Add utility to summarise the hg status output across multiple packages
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
3 |
# Copyright (c) 2009 Symbian Foundation Ltd |
4ed8ba809509
Add utility to summarise the hg status output across multiple packages
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
4 |
# This component and the accompanying materials are made available |
4ed8ba809509
Add utility to summarise the hg status output across multiple packages
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
5 |
# under the terms of the License "Eclipse Public License v1.0" |
4ed8ba809509
Add utility to summarise the hg status output across multiple packages
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
6 |
# which accompanies this distribution, and is available |
4ed8ba809509
Add utility to summarise the hg status output across multiple packages
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
7 |
# at the URL "http://www.eclipse.org/legal/epl-v10.html". |
4ed8ba809509
Add utility to summarise the hg status output across multiple packages
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
8 |
# |
4ed8ba809509
Add utility to summarise the hg status output across multiple packages
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
9 |
# Initial Contributors: |
4ed8ba809509
Add utility to summarise the hg status output across multiple packages
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
10 |
# Symbian Foundation Ltd - initial contribution. |
4ed8ba809509
Add utility to summarise the hg status output across multiple packages
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
11 |
# |
4ed8ba809509
Add utility to summarise the hg status output across multiple packages
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
12 |
# Contributors: |
4ed8ba809509
Add utility to summarise the hg status output across multiple packages
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
13 |
# |
4ed8ba809509
Add utility to summarise the hg status output across multiple packages
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
14 |
# Description: |
4ed8ba809509
Add utility to summarise the hg status output across multiple packages
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
15 |
# Summarise the "clone_all_packages.pl -exec -- hg status --rev a --rev b" output |
4ed8ba809509
Add utility to summarise the hg status output across multiple packages
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
16 |
|
4ed8ba809509
Add utility to summarise the hg status output across multiple packages
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
17 |
use strict; |
4ed8ba809509
Add utility to summarise the hg status output across multiple packages
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
18 |
|
4ed8ba809509
Add utility to summarise the hg status output across multiple packages
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
19 |
my %listings; |
4ed8ba809509
Add utility to summarise the hg status output across multiple packages
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
20 |
my $current_repo = ""; |
4ed8ba809509
Add utility to summarise the hg status output across multiple packages
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
21 |
my @filelist = (); |
19
54785ea4cd2e
Improve consistency checking for summarise_hg_status.pl
William Roberts <williamr@symbian.org>
parents:
17
diff
changeset
|
22 |
my %all_repos; |
17
4ed8ba809509
Add utility to summarise the hg status output across multiple packages
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
23 |
|
4ed8ba809509
Add utility to summarise the hg status output across multiple packages
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
24 |
sub record_file($$) |
4ed8ba809509
Add utility to summarise the hg status output across multiple packages
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
25 |
{ |
4ed8ba809509
Add utility to summarise the hg status output across multiple packages
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
26 |
my ($file, $change) = @_; |
4ed8ba809509
Add utility to summarise the hg status output across multiple packages
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
27 |
|
4ed8ba809509
Add utility to summarise the hg status output across multiple packages
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
28 |
next if ($file eq ".hgtags"); |
4ed8ba809509
Add utility to summarise the hg status output across multiple packages
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
29 |
push @filelist, "$file$change"; |
4ed8ba809509
Add utility to summarise the hg status output across multiple packages
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
30 |
return; |
4ed8ba809509
Add utility to summarise the hg status output across multiple packages
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
31 |
} |
4ed8ba809509
Add utility to summarise the hg status output across multiple packages
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
32 |
|
4ed8ba809509
Add utility to summarise the hg status output across multiple packages
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
33 |
sub finished_repo() |
4ed8ba809509
Add utility to summarise the hg status output across multiple packages
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
34 |
{ |
19
54785ea4cd2e
Improve consistency checking for summarise_hg_status.pl
William Roberts <williamr@symbian.org>
parents:
17
diff
changeset
|
35 |
if ($current_repo ne "") |
17
4ed8ba809509
Add utility to summarise the hg status output across multiple packages
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
36 |
{ |
4ed8ba809509
Add utility to summarise the hg status output across multiple packages
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
37 |
$current_repo =~ s/^.*CL\/sf/sf/; # remove leading MCL or FCL stuff |
19
54785ea4cd2e
Improve consistency checking for summarise_hg_status.pl
William Roberts <williamr@symbian.org>
parents:
17
diff
changeset
|
38 |
$all_repos{$current_repo} = 1; |
54785ea4cd2e
Improve consistency checking for summarise_hg_status.pl
William Roberts <williamr@symbian.org>
parents:
17
diff
changeset
|
39 |
if (scalar @filelist > 0) |
54785ea4cd2e
Improve consistency checking for summarise_hg_status.pl
William Roberts <williamr@symbian.org>
parents:
17
diff
changeset
|
40 |
{ |
54785ea4cd2e
Improve consistency checking for summarise_hg_status.pl
William Roberts <williamr@symbian.org>
parents:
17
diff
changeset
|
41 |
@{$listings{$current_repo}} = sort @filelist; |
54785ea4cd2e
Improve consistency checking for summarise_hg_status.pl
William Roberts <williamr@symbian.org>
parents:
17
diff
changeset
|
42 |
# printf STDERR "* %s %d\n", $current_repo, scalar @filelist; |
54785ea4cd2e
Improve consistency checking for summarise_hg_status.pl
William Roberts <williamr@symbian.org>
parents:
17
diff
changeset
|
43 |
} |
17
4ed8ba809509
Add utility to summarise the hg status output across multiple packages
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
44 |
} |
4ed8ba809509
Add utility to summarise the hg status output across multiple packages
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
45 |
@filelist = (); |
4ed8ba809509
Add utility to summarise the hg status output across multiple packages
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
46 |
$current_repo = ""; |
4ed8ba809509
Add utility to summarise the hg status output across multiple packages
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
47 |
} |
4ed8ba809509
Add utility to summarise the hg status output across multiple packages
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
48 |
|
4ed8ba809509
Add utility to summarise the hg status output across multiple packages
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
49 |
my $line; |
4ed8ba809509
Add utility to summarise the hg status output across multiple packages
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
50 |
while ($line = <>) |
4ed8ba809509
Add utility to summarise the hg status output across multiple packages
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
51 |
{ |
4ed8ba809509
Add utility to summarise the hg status output across multiple packages
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
52 |
# Processing sfl/MCL/sf/app/imgvieweruis... |
4ed8ba809509
Add utility to summarise the hg status output across multiple packages
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
53 |
if ($line =~ /^Processing (.*)\.\.\./) |
4ed8ba809509
Add utility to summarise the hg status output across multiple packages
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
54 |
{ |
4ed8ba809509
Add utility to summarise the hg status output across multiple packages
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
55 |
finished_repo(); |
4ed8ba809509
Add utility to summarise the hg status output across multiple packages
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
56 |
$current_repo = $1; |
4ed8ba809509
Add utility to summarise the hg status output across multiple packages
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
57 |
next; |
4ed8ba809509
Add utility to summarise the hg status output across multiple packages
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
58 |
} |
4ed8ba809509
Add utility to summarise the hg status output across multiple packages
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
59 |
# abort: unknown revision 'PDK_2.0.c'! |
4ed8ba809509
Add utility to summarise the hg status output across multiple packages
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
60 |
if ($line =~ /^abort/) |
4ed8ba809509
Add utility to summarise the hg status output across multiple packages
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
61 |
{ |
4ed8ba809509
Add utility to summarise the hg status output across multiple packages
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
62 |
# ignore the current repo, as it probably didn't have the right tag |
19
54785ea4cd2e
Improve consistency checking for summarise_hg_status.pl
William Roberts <williamr@symbian.org>
parents:
17
diff
changeset
|
63 |
# $current_repo = ""; |
17
4ed8ba809509
Add utility to summarise the hg status output across multiple packages
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
64 |
next; |
4ed8ba809509
Add utility to summarise the hg status output across multiple packages
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
65 |
} |
4ed8ba809509
Add utility to summarise the hg status output across multiple packages
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
66 |
if ($line =~ /^([MARC]) (\S.*\S)\s*$/) |
4ed8ba809509
Add utility to summarise the hg status output across multiple packages
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
67 |
{ |
4ed8ba809509
Add utility to summarise the hg status output across multiple packages
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
68 |
my $change = $1; |
4ed8ba809509
Add utility to summarise the hg status output across multiple packages
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
69 |
my $file = $2; |
4ed8ba809509
Add utility to summarise the hg status output across multiple packages
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
70 |
record_file($file, $change); |
4ed8ba809509
Add utility to summarise the hg status output across multiple packages
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
71 |
next; |
4ed8ba809509
Add utility to summarise the hg status output across multiple packages
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
72 |
} |
4ed8ba809509
Add utility to summarise the hg status output across multiple packages
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
73 |
} |
4ed8ba809509
Add utility to summarise the hg status output across multiple packages
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
74 |
|
4ed8ba809509
Add utility to summarise the hg status output across multiple packages
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
75 |
finished_repo(); |
4ed8ba809509
Add utility to summarise the hg status output across multiple packages
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
76 |
|
19
54785ea4cd2e
Improve consistency checking for summarise_hg_status.pl
William Roberts <williamr@symbian.org>
parents:
17
diff
changeset
|
77 |
foreach my $repo (sort keys %all_repos) |
54785ea4cd2e
Improve consistency checking for summarise_hg_status.pl
William Roberts <williamr@symbian.org>
parents:
17
diff
changeset
|
78 |
{ |
54785ea4cd2e
Improve consistency checking for summarise_hg_status.pl
William Roberts <williamr@symbian.org>
parents:
17
diff
changeset
|
79 |
next if (defined $listings{$repo}); |
54785ea4cd2e
Improve consistency checking for summarise_hg_status.pl
William Roberts <williamr@symbian.org>
parents:
17
diff
changeset
|
80 |
print STDERR "No valid comparison for $repo\n"; |
54785ea4cd2e
Improve consistency checking for summarise_hg_status.pl
William Roberts <williamr@symbian.org>
parents:
17
diff
changeset
|
81 |
} |
54785ea4cd2e
Improve consistency checking for summarise_hg_status.pl
William Roberts <williamr@symbian.org>
parents:
17
diff
changeset
|
82 |
|
17
4ed8ba809509
Add utility to summarise the hg status output across multiple packages
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
83 |
print "Package\tChange\tComponent\tFilename\tCount\n"; |
4ed8ba809509
Add utility to summarise the hg status output across multiple packages
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
84 |
foreach my $repo (sort keys %listings) |
4ed8ba809509
Add utility to summarise the hg status output across multiple packages
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
85 |
{ |
4ed8ba809509
Add utility to summarise the hg status output across multiple packages
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
86 |
my @filelist = @{$listings{$repo}}; |
4ed8ba809509
Add utility to summarise the hg status output across multiple packages
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
87 |
|
4ed8ba809509
Add utility to summarise the hg status output across multiple packages
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
88 |
my $last_component = ""; |
4ed8ba809509
Add utility to summarise the hg status output across multiple packages
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
89 |
my @component_files = (); |
4ed8ba809509
Add utility to summarise the hg status output across multiple packages
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
90 |
my @clean_files = (); |
4ed8ba809509
Add utility to summarise the hg status output across multiple packages
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
91 |
my $clean_count = 0; |
4ed8ba809509
Add utility to summarise the hg status output across multiple packages
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
92 |
my $component = ""; |
4ed8ba809509
Add utility to summarise the hg status output across multiple packages
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
93 |
|
4ed8ba809509
Add utility to summarise the hg status output across multiple packages
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
94 |
foreach my $item (@filelist, ":boo:/:hoo:/:for:/:you:M") |
4ed8ba809509
Add utility to summarise the hg status output across multiple packages
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
95 |
{ |
4ed8ba809509
Add utility to summarise the hg status output across multiple packages
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
96 |
my $change = substr($item,-1); |
4ed8ba809509
Add utility to summarise the hg status output across multiple packages
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
97 |
my $file = substr($item,0,-1); |
4ed8ba809509
Add utility to summarise the hg status output across multiple packages
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
98 |
my @names = split /\\/, $file; |
4ed8ba809509
Add utility to summarise the hg status output across multiple packages
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
99 |
$component = ""; |
4ed8ba809509
Add utility to summarise the hg status output across multiple packages
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
100 |
if (scalar @names > 2) |
4ed8ba809509
Add utility to summarise the hg status output across multiple packages
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
101 |
{ |
4ed8ba809509
Add utility to summarise the hg status output across multiple packages
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
102 |
my $collection = shift @names; |
4ed8ba809509
Add utility to summarise the hg status output across multiple packages
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
103 |
$component = shift @names; |
4ed8ba809509
Add utility to summarise the hg status output across multiple packages
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
104 |
$component = $collection . "/" . $component; |
4ed8ba809509
Add utility to summarise the hg status output across multiple packages
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
105 |
} |
4ed8ba809509
Add utility to summarise the hg status output across multiple packages
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
106 |
$file = join("/", @names); |
4ed8ba809509
Add utility to summarise the hg status output across multiple packages
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
107 |
|
4ed8ba809509
Add utility to summarise the hg status output across multiple packages
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
108 |
if ($component ne $last_component) |
4ed8ba809509
Add utility to summarise the hg status output across multiple packages
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
109 |
{ |
4ed8ba809509
Add utility to summarise the hg status output across multiple packages
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
110 |
if (scalar @component_files > 0) |
4ed8ba809509
Add utility to summarise the hg status output across multiple packages
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
111 |
{ |
4ed8ba809509
Add utility to summarise the hg status output across multiple packages
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
112 |
# previous component contained some A, M or R files |
4ed8ba809509
Add utility to summarise the hg status output across multiple packages
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
113 |
print @component_files; |
4ed8ba809509
Add utility to summarise the hg status output across multiple packages
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
114 |
} |
4ed8ba809509
Add utility to summarise the hg status output across multiple packages
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
115 |
if ($clean_count > 0) |
4ed8ba809509
Add utility to summarise the hg status output across multiple packages
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
116 |
{ |
4ed8ba809509
Add utility to summarise the hg status output across multiple packages
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
117 |
print "$repo\tsame\t$last_component\t...\t$clean_count\n"; |
4ed8ba809509
Add utility to summarise the hg status output across multiple packages
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
118 |
} |
4ed8ba809509
Add utility to summarise the hg status output across multiple packages
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
119 |
# reset, ready for next component; |
4ed8ba809509
Add utility to summarise the hg status output across multiple packages
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
120 |
$last_component = $component; |
4ed8ba809509
Add utility to summarise the hg status output across multiple packages
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
121 |
$clean_count = 0; |
4ed8ba809509
Add utility to summarise the hg status output across multiple packages
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
122 |
@component_files = (); |
4ed8ba809509
Add utility to summarise the hg status output across multiple packages
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
123 |
@clean_files = (); |
4ed8ba809509
Add utility to summarise the hg status output across multiple packages
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
124 |
} |
4ed8ba809509
Add utility to summarise the hg status output across multiple packages
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
125 |
if ($change eq "C") |
4ed8ba809509
Add utility to summarise the hg status output across multiple packages
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
126 |
{ |
4ed8ba809509
Add utility to summarise the hg status output across multiple packages
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
127 |
$clean_count += 1; |
4ed8ba809509
Add utility to summarise the hg status output across multiple packages
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
128 |
push @clean_files, "$repo\tsame\t$component\t$file\t1\n"; |
4ed8ba809509
Add utility to summarise the hg status output across multiple packages
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
129 |
} |
4ed8ba809509
Add utility to summarise the hg status output across multiple packages
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
130 |
else |
4ed8ba809509
Add utility to summarise the hg status output across multiple packages
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
131 |
{ |
4ed8ba809509
Add utility to summarise the hg status output across multiple packages
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
132 |
push @component_files, "$repo\t$change\t$component\t$file\t1\n"; |
4ed8ba809509
Add utility to summarise the hg status output across multiple packages
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
133 |
} |
4ed8ba809509
Add utility to summarise the hg status output across multiple packages
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
134 |
} |
4ed8ba809509
Add utility to summarise the hg status output across multiple packages
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
135 |
} |