aboutsummaryrefslogtreecommitdiffstats
path: root/romanian/whatsnew.pl
blob: 1e49914154b464ca845d0985aaf0b6ddf3a318e8 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
#!/usr/bin/perl

# $Id$
#
# find what's out of sync in a folder compared to the original one
# usage
#  <script> root-folder original-folder translation-folder [newer|nomatch] [dirs]
#    newer   - report newer files in original if translation present
#    nomatch - report files in original that have no corespondent transl
#    dirs    - print dirs also
#  ex: whatsnew.pl '..' english romanian newer
#

$action = "newer";
$rdir   = ".."; #root dir
$odir   = "english";
$tdir   = "romanian";
$nodir  = "nodir";

die "Unsupported since the move to git\n";

&usage;

if ($ARGV[0]) { $rdir = $ARGV[0]; };
if ($ARGV[1]) { $odir = $ARGV[1]; };
if ($ARGV[2]) { $tdir = $ARGV[2]; };
if ($ARGV[3]) { $action = $ARGV[3]; };
if ( !($action =~ m/^newer$/i)  && !($action =~ m/^nomatch$/i))
{
    die "Unsupported action: $action \n"
}
if ($ARGV[4]) { $nodir = $ARGV[4]; };

#first update current branch, then the reference one
printf "Updating from CVS repository **local branch**...\n";
`cvs update -d`;

chdir $rdir || die "*** No such root dir: $rdir\n";
chomp($rdir = `pwd`);

chdir $odir || die "*** No such dir: $rdir + $odir\n";
printf "\nUpdating from CVS repository **reference branch**...\n";
`cvs update -d`;

chdir ".." || die "*** No such root dir: $rdir\n";
@files  = `find "./$odir" -name '*' -print`;
#print @files;

for ($i=$#files; $i>=0; $i--)
{
    chomp $files[$i];
    if ( $files[$i] =~ m=/CVS= ) { goto _loop;}
    
    $tfile = $files[$i];
    $tfile =~ s=$odir=$tdir=;
    $mtimeo = (stat($files[$i]))[9];
    $mtimet = (stat($tfile))[9];
    
    if ( $action =~ m/newer/i )
    {
        if ( ($mtimeo > $mtimet) && -e $tfile )
        {
            print "Newer original than translation: $files[$i] \n";
        }
        
        if ( !(-e $tfile) && -d $files[$i] && !($nodir =~m/nodir/i) )
        {
            print "Original dir without correspondent: $files[$i] \n";
        }
    }
    elsif ( $action =~ m/nomatch/i )
    {
        if ( -f $files[$i] && !(-e $tfile) )
        {
            print "File without translation: $files[$i] \n";
        }
        elsif ( -d $files[$i] && !(-e $tfile)  && !($nodir =~m/nodir/i) )
        {
            print "Dir without correspondent: $files[$i] \n";
        }
        else
        {
            #
        }
    }

_loop:
}

print "\n=== Done ===\n";

#----------------------------------------------------------------
sub usage
{
    print "\nUsage: \n";
    print "  <script> root-folder original-folder translation-folder [newer|nomatch] [dirs]\n\n";
}
#----------------------------------------------------------------

© 2014-2024 Faster IT GmbH | imprint | privacy policy