summaryrefslogtreecommitdiff
path: root/git-svn.perl
diff options
context:
space:
mode:
authorEric Wong <normalperson@yhbt.net>2009-01-17 22:11:44 -0800
committerEric Wong <normalperson@yhbt.net>2009-01-18 15:38:28 -0800
commit1ef626b4b6c70fc13062faafdccb2f0da7578a29 (patch)
tree9d0b02e66fed8905d96ef136a6c50e4ea60bb465 /git-svn.perl
parente82f0d73f02e89a95d9477911774d314f70f1063 (diff)
downloadgit-1ef626b4b6c70fc13062faafdccb2f0da7578a29.tar.gz
git-svn: fix SVN 1.1.x compatibility
The get_log() function in the Perl SVN API introduced the limit parameter in 1.2.0. However, this got discarded in our SVN::Ra compatibility layer when used with SVN 1.1.x. We now emulate the limit functionality in older SVN versions by preventing the original callback from being called if the given limit has been reached. This emulation is less bandwidth efficient, but SVN 1.1.x is becoming rarer now. Additionally, the --limit parameter in svn(1) uses the aforementioned get_log() functionality change in SVN 1.2.x. t9129 no longer depends on --limit to work and instead uses Perl to parse out the commit message. Thanks to Tom G. Christensen for the bug report. Signed-off-by: Eric Wong <normalperson@yhbt.net>
Diffstat (limited to 'git-svn.perl')
-rwxr-xr-xgit-svn.perl15
1 files changed, 14 insertions, 1 deletions
diff --git a/git-svn.perl b/git-svn.perl
index e3e125b098..71b8ef4265 100755
--- a/git-svn.perl
+++ b/git-svn.perl
@@ -4130,10 +4130,23 @@ sub DESTROY {
# do not call the real DESTROY since we store ourselves in $RA
}
+# get_log(paths, start, end, limit,
+# discover_changed_paths, strict_node_history, receiver)
sub get_log {
my ($self, @args) = @_;
my $pool = SVN::Pool->new;
- splice(@args, 3, 1) if ($SVN::Core::VERSION le '1.2.0');
+
+ # the limit parameter was not supported in SVN 1.1.x, so we
+ # drop it. Therefore, the receiver callback passed to it
+ # is made aware of this limitation by being wrapped if
+ # the limit passed to is being wrapped.
+ if ($SVN::Core::VERSION le '1.2.0') {
+ my $limit = splice(@args, 3, 1);
+ if ($limit > 0) {
+ my $receiver = pop @args;
+ push(@args, sub { &$receiver(@_) if (--$limit >= 0) });
+ }
+ }
my $ret = $self->SUPER::get_log(@args, $pool);
$pool->clear;
$ret;