File indexing completed on 2024-05-12 15:39:11

0001 #!/usr/bin/perl
0002 #
0003 # Copyright (C) 2009 Germain Garand <germain@ebooksfrance.org>
0004 #
0005 # This library is free software; you can redistribute it and/or
0006 # modify it under the terms of the GNU Library General Public
0007 # License as published by the Free Software Foundation; either
0008 # version 2 of the License, or (at your option) any later version.
0009 #
0010 # This library is distributed in the hope that it will be useful,
0011 # but WITHOUT ANY WARRANTY; without even the implied warranty of
0012 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
0013 # Library General Public License for more details.
0014 #
0015 # You should have received a copy of the GNU Library General Public License
0016 # along with this library; see the file COPYING.LIB.  If not, write to
0017 # the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
0018 # Boston, MA 02110-1301, USA.
0019 
0020 # Run this from the svn directory containing your |tests| and |baseline| directories for testregression.
0021 # It will output a list of all tests/baselines that have been updated on the SVN server,
0022 # in a form suitable to be used with testregression - so you may regenerate selected tests
0023 # using 'testregression -g'
0024 #
0025 # It makes it easier to maintain a private baseline.
0026 #
0027 # Say for instance that you have a private baseline generated with:
0028 #   testregression -g -r baseline_priv .
0029 #
0030 # From time to time, people will have to add/update tests in the svn-kept baseline.
0031 # So instead of regenerating your whole private baseline to update it, you may run:
0032 #   testregression -g -r baseline_priv `list-updated-tests` .
0033 # to update those tests in your own baseline ( check first that list-updated-tests does have an output a all)
0034 #
0035 # Of course, this will only work *before* you 'svn update'.
0036 
0037 use strict;
0038 
0039 my @local;
0040 my %dist;
0041 
0042 my $svn = `which svn`;
0043 chomp $svn;
0044 
0045 open S, "-|", "$svn status -u tests baseline", or die "Couldn't get status: $!.\n";
0046 
0047 while (<S>) {
0048     /^([AMCDR]?)\s+(\*)?.*?(\S+)$/;
0049     my $loc = $1;
0050     my $dist = $2;
0051     my $fname = $3;
0052 
0053     if ($loc and $dist and ($loc eq "M" || $loc eq "C")) {
0054         push @local, $fname;
0055     } elsif ($dist and not -d $fname and not $fname =~ /svnignore/ ) {
0056         if ($fname =~ s|baseline/||) {
0057             $fname =~ s/-(?:dump.png|render|dom)//;
0058         } else {
0059             $fname =~ s|tests/||;
0060         }
0061         $dist{ $fname } =1 if (! -d $fname);
0062     }
0063 }
0064 close S;
0065 
0066 if (scalar @local) {
0067    print STDERR "Locally changed/conflicting files found:\n",join(" ", @local), "\n";
0068    print STDERR "A more recent version of those files exist on the server. Please resolve.\n";
0069    die;
0070 }
0071 
0072 if (scalar keys %dist) {
0073     print "-t ".join(" -t ", keys %dist)."\n";
0074 }