/[SVNBrowser]/trunk/lib/SVNBrowser/ColorDiff.pm
This is repository of my old source code which isn't updated any more. Go to git.rot13.org for current projects!
ViewVC logotype

Contents of /trunk/lib/SVNBrowser/ColorDiff.pm

Parent Directory Parent Directory | Revision Log Revision Log


Revision 36 - (show annotations)
Mon Dec 11 17:58:07 2006 UTC (17 years, 4 months ago) by dpavlin
File size: 836 byte(s)
kick out Text::VimColor which doesn't seem to work well with Jifty
1 package SVNBrowser::ColorDiff;
2
3 use strict;
4 use HTML::Entities;
5 use Data::Dump qw/dump/;
6
7
8 =head1 Name
9
10 SVNBrowser::ColorDiff
11
12 =head1 Description
13
14 Output color diff changes from revision
15
16 =cut
17
18 =head3 diff
19
20 my $html = SVNBrowser::ColorDiff::diff($repository_path, $revision);
21
22 =cut
23
24 sub diff {
25
26 warn "diff args = ",dump( @_ );
27
28 my ($repository_path, $revision) = @_;
29
30 my $cmd = 'svn diff -c ' . $revision;
31 $cmd .= ' ' . $repository_path;
32
33 warn "## svn change: $cmd";
34
35 my $diff;
36 open(my $diff_fh, '-|', $cmd) || die "can't exec $cmd: $!";
37 {
38 local $/;
39 $diff = <$diff_fh>;
40 }
41 close($diff_fh); # or warn "error closing $cmd: $!";
42
43 $diff =~ s/\r//gs;
44
45 warn "got ", length($diff), " bytes of diff output";
46
47 my $out = "<tt>$cmd</tt><br/>";
48
49 $out .= "<pre>" . encode_entities($diff, '<>&"') . "</pre>";
50
51 return $out;
52
53 }
54
55 1;

  ViewVC Help
Powered by ViewVC 1.1.26