File: diff-hist.PL

package info (click to toggle)
libvcs-perl 0.14-4
  • links: PTS
  • area: main
  • in suites: etch, etch-m68k
  • size: 216 kB
  • ctags: 97
  • sloc: perl: 1,083; makefile: 51
file content (90 lines) | stat: -rw-r--r-- 1,928 bytes parent folder | download | duplicates (2)
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
#!/usr/local/bin/perl

# standard perl modules to assist with .PL extraction
use Config;
use File::Basename qw(&basename &dirname);
use Cwd;

my $origdir = cwd();
chdir dirname($0);
my $name = basename($0, '.PL');
   $name .= '.com' if $^O eq 'VMS';
   $name .= '.bat' if $^O eq 'MSWin32';
open EXE ,">$name" or die "Cannot create $name: $!";
print "Extracting $name (with variable substitutions)\n";
print EXE << "!GROK!THIS!";
$Config{'startperl'}
!GROK!THIS!
if ($^O eq 'VMS') {
print EXE <<'!NO!SUBS!';
#!/perl
!NO!SUBS!
}
print EXE << '!NO!SUBS!';

$| = 1;

#use FindBin;
#use lib "$FindBin::Bin/../";
use VCS;

if (scalar(@ARGV) == 0) {
    print << "EOUSAGE";
Usage:

    diff-hist file [file...]
EOUSAGE
    exit;
}


foreach my $arg (@ARGV) {
    my $file = VCS::File->new($arg);
    my @versions = $file->versions;
    my @diff_pairs;
    for (my $count = @versions - 1; $count > 0; $count--) {
        push @diff_pairs, [ $versions[$count - 1], $versions[$count] ];
    }
    map {
        my $old = $_->[0];
        my $new = $_->[1];
        print
            '*** Changes from version ',
            $old->version,
            ' to version ',
            $new->version,
            ' (',
            $new->date,
            ")\n",
            'What: ', $new->path, "\n",
            'Version: ', $new->version, "\n",
            'When: ', $new->date, "\n",
            'Who: ', $new->author, "\n",
            'Tags: ', (join "\n      ", $new->tags), "\n",
            'Why: ', (join "\n     ", $new->reason), "\n",
            $old->diff($new)
    } @diff_pairs;
}

__END__

=head1 NAME

diff-hist - view revision history of file under version control

=head1 SYNOPSIS

diff-hist file [file...]

=head1 DESCRIPTION

For each file specified, the differences (in diff -u2 format) are shown
between each successive version back to the first, in reverse
chronological order.

=head1 SEE ALSO

L<VCS>.

=cut
!NO!SUBS!