tools/check_for_mercurial_updates.pl
changeset 118 177393f3fa3e
equal deleted inserted replaced
117:7a0ca3b2ef33 118:177393f3fa3e
       
     1 # Copyright (c) 2010 Symbian Foundation Ltd.
       
     2 # All rights reserved.
       
     3 # This component and the accompanying materials are made available
       
     4 # under the terms of the License "Eclipse Public License v1.0"
       
     5 # which accompanies this distribution, and is available
       
     6 # at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     7 #
       
     8 # Initial Contributors:
       
     9 # Symbian Foundation - initial contribution.
       
    10 #
       
    11 # Contributors:
       
    12 #
       
    13 # Description: 
       
    14 # Check in Mercurial for updates to files branched to make stem versions
       
    15 
       
    16 use strict;
       
    17 use Getopt::Long;
       
    18 
       
    19 my $old_rev = "PDK_3.0.2";
       
    20 my $new_rev = "PDK_3.0.4";
       
    21 my $mercurial_tree = "Q:";
       
    22 GetOptions(
       
    23   "old=s" => \$old_rev,             # revision which is the current basis for modified files
       
    24   "new=s" => \$new_rev,             # new revision we need to catch up to
       
    25   "hgtree=s" => \$mercurial_tree,   # location of a tree of mercurial repositories
       
    26   );
       
    27 
       
    28 sub do_system(@)
       
    29 	{
       
    30 	my @args = @_;
       
    31 	my $cmd = join(" ", @args);
       
    32 	# print STDERR "* $cmd\n";
       
    33 	my @lines = `$cmd`;
       
    34 	# print STDERR join("    ", "", @lines);
       
    35 	return @lines;
       
    36 	}
       
    37 
       
    38 my $line;
       
    39 while ($line = <>)
       
    40 	{
       
    41 	chomp $line;
       
    42 	my ($localdir,$repo,$path,$file) = split /\t/, $line;
       
    43 	next if (!defined $file);
       
    44 	
       
    45 	my @output = do_system ("hg", "--cwd", "$mercurial_tree$repo", "status", "--rev", $old_rev, "--rev", $new_rev, "$path/$file");
       
    46 	next if (!@output);	# must be unchanged
       
    47 	
       
    48 	# what's the difference?
       
    49 	my @diff_output = do_system ("hg", "--cwd", "$mercurial_tree$repo", "diff", "--rev", $old_rev, "--rev", $new_rev, "$path/$file");
       
    50 	next if (!@diff_output); # none
       
    51 	
       
    52 	print "\n$localdir/$file might need updating\n", @diff_output;
       
    53 	}
       
    54