Subject: | Add transaction support |
The following patch allow all methods to use either release or transaction argument, using a named parameter.
diff -Naur SVN-SVNLook-0.02/lib/SVN/SVNLook.pm SVN-SVNLook-0.02.transaction/lib/SVN/SVNLook.pm
--- SVN-SVNLook-0.02/lib/SVN/SVNLook.pm 2005-04-27 20:31:19.000000000 +0200
+++ SVN-SVNLook-0.02.transaction/lib/SVN/SVNLook.pm 2005-12-29 10:12:13.000000000 +0100
@@ -93,14 +93,14 @@
sub info
{
my $self = shift;
- my $rev = shift;
- my @svnlooklines;
- if ( $rev) {
- @svnlooklines = _read_from_process($self->{cmd}, 'info', $self->{repo}, '-r', $rev);
- } else {
- # print the youngest log message if no rev number is supplied
- @svnlooklines = _read_from_process($self->{cmd}, 'info', $self->{repo});
- }
+ my %args = @_;
+ my @svnlooklines = _read_from_process(
+ $self->{cmd},
+ 'info',
+ $self->{repo},
+ ($args{revision} ? ('-r', $args{revision}) : ()),
+ ($args{transaction} ? ('-t', $args{transaction}) : ()),
+ );
my $author = shift @svnlooklines; # author of this change
my $date = shift @svnlooklines; # date of change
shift @svnlooklines; # log message size
@@ -110,12 +110,32 @@
return ($author,$date,$logmessage);
}
+sub author
+{
+ my $self = shift;
+ my %args = @_;
+ my @svnlooklines = _read_from_process(
+ $self->{cmd},
+ 'author',
+ $self->{repo},
+ ($args{revision} ? ('-r', $args{revision}) : ()),
+ ($args{transaction} ? ('-t', $args{transaction}) : ()),
+ );
+ return $svnlooklines[0]; # author of this change
+}
+
sub dirschanged
{
my $self = shift;
- my $rev = shift;
+ my %args = @_;
# Figure out what directories have changed using svnlook.
- my @dirschanged = _read_from_process($self->{cmd}, 'dirs-changed', $self->{repo},'-r', $rev);
+ my @dirschanged = _read_from_process(
+ $self->{cmd},
+ 'dirs-changed',
+ $self->{repo},
+ ($args{revision} ? ('-r', $args{revision}) : ()),
+ ($args{transaction} ? ('-t', $args{transaction}) : ()),
+ );
# Lose the trailing slash in the directory names if one exists, except
# in the case of '/'.
my $rootchanged = 0;
@@ -137,10 +157,16 @@
sub fileschanged
{
my $self = shift;
- my $rev = shift;
-
+ my %args = @_;
# Figure out what files have changed using svnlook.
- my @svnlooklines = _read_from_process($self->{cmd}, 'changed', $self->{repo}, '-r', $rev);
+ my @svnlooklines = _read_from_process(
+ $self->{cmd},
+ 'changed',
+ $self->{repo},
+ ($args{revision} ? ('-r', $args{revision}) : ()),
+ ($args{transaction} ? ('-t', $args{transaction}) : ()),
+ );
+
# Parse the changed nodes.
my @adds;
my @dels;
@@ -176,10 +202,16 @@
sub diff
{
my $self = shift;
- my $rev = shift;
- my @difflines = _read_from_process($self->{cmd}, 'diff', $self->{repo},'-r', $rev,
- ('--no-diff-deleted'));
- # Ok we need to split this out now , by file
+ my %args = @_;
+ my @difflines = _read_from_process(
+ $self->{cmd},
+ 'diff',
+ $self->{repo},
+ '-r', $args{revision},
+ ($args{revision} ? ('-r', $args{revision}) : ()),
+ ($args{transaction} ? ('-t', $args{transaction}) : ()),
+ ('--no-diff-deleted')
+ );
my @lin = split(/Modified: (.*)\n=*\n/,join("\n",@difflines));
shift(@lin);
my %lines = @lin;