Skip to contentSkip to conversation

git-svn: use SVN::Ra::get_dir2 when possible

PATCH In review Eric Wong 2 participants 5 messages Jun 15, 2016

lore
Share & tools
lore

Eric Wong

author
#0 lore raw

PATCH 1/1 git-svn: use SVN::Ra::get_dir2 when possible

This avoids the following failure with normal "get_dir" on newer versions of SVN (tested with SVN 1.8.8-1ubuntu3.1):

Incorrect parameters given: Could not convert '%ld' into a number

get_dir2 also has the potential to be more efficient by requesting less data.

ref: <[email protected]>
ref: <[email protected]>

Cc Hin-Tak Leung <[email protected]>

---
This should fix the vbox clone problem. SVN Perl binding breakage (again :<). I shall revert the int() changes.

Quoted 10 lines

I added those two lines to my git and there is no improvement. It still won't svn fetch the next revision. I think it may be important/interesting to find out when or how it becomes non-int, so I have tar'gz'ed my wont-fetch virtual box .git and in the middle of uploading here:

http://sourceforge.net/projects/outmodedbonsai/files/R/

I am also uploading my old R clone also - maybe you'd like to see why its .git/svn/.caches is so big compared to a recent one,

Jakob's changes causes different access patterns, so it's expected the sizes vary. I also changed the cherry pick cache and removed the _rev_list caching entirely, so it should be much smaller now.

Quoted 2 lines

as well as how and why there were an extra merge and two missing merges compared to a recent clone?

The different merges are fine, I think, as stated in

    http://mid.gmane.org/[email protected]
 perl/Git/SVN/Ra.pm | 12 +++++++++++-
 1 file changed, 11 insertions(+), 1 deletion(-)
perl/Git/SVN/Ra.pm +11 -1
index 82d6108..1e52709 100644
@@ -177,7 +177,17 @@ sub get_dir {
 		}
 	}
 	my $pool = SVN::Pool->new;
-	my ($d, undef, $props) = $self->SUPER::get_dir($dir, $r, $pool);
+	my ($d, undef, $props);
+
+	if (defined &SVN::Ra::get_dir2) { # appeared in SVN 1.4
+		# n.b. in addition to being potentially more efficient,
+		# this works around what appears to be a bug in some
+		# SVN 1.8 versions
+		my $kind = 1; # SVN_DIRENT_KIND
+		($d, undef, $props) = $self->get_dir2($dir, $r, $kind, $pool);
+	} else {
+		($d, undef, $props) = $self->get_dir($dir, $r, $pool);
+	}
 	my %dirents = map { $_ => { kind => $d->{$_}->kind } } keys %$d;
 	$pool->clear;
 	if ($r != $cache->{r}) {
Signature · 1 line
EW
#1 lore raw

Hmm, I see you are filing the problem against subversion. FWIW,
I am currently using subversion-perl-1.8.10-1.fc20.x86_64 package on fedora 20. I'll possibly think about filing one under redhat's bugzilla and let them take it upward too.

--------------------------------------------
On Fri, 31/10/14, Eric Wong <[email protected]> wrote:

This avoids the following failure
with normal "get_dir" on newer
versions of SVN (tested with SVN 1.8.8-1ubuntu3.1):

  Incorrect parameters given: Could not convert '%ld' into a number

get_dir2 also has the potential to be more efficient by requesting
less data.

ref: <[email protected]>
ref: <[email protected]>

Cc Hin-Tak Leung <[email protected]>

---
  This should fix the vbox clone problem.  SVN
Perl binding
  breakage (again :<).  I shall revert the
int() changes.

  > I added those two lines to my git and there is no improvement. It
  > still won't svn fetch the next revision. I think it may be
  > important/interesting to find out when or how it becomes non-int, so
  > I have tar'gz'ed my wont-fetch virtual box .git and in the middle of
  > uploading here:
  >
  > http://sourceforge.net/projects/outmodedbonsai/files/R/

  > I am also uploading my old R clone also - maybe you'd like to see
  > why its .git/svn/.caches is so big compared to a recent one,

  Jakob's changes causes different access patterns, so it's expected the
  sizes vary.  I also changed the cherry pick cache and removed the
  _rev_list caching entirely, so it should be much smaller now.

  > as well as how and why there were an extra merge and two missing
  > merges compared to a recent clone?

  The different merges are fine, I think, as stated in
    http://mid.gmane.org/[email protected]

  perl/Git/SVN/Ra.pm | 12 +++++++++++-
  1 file changed, 11 insertions(+), 1 deletion(-)

diff --git a/perl/Git/SVN/Ra.pm b/perl/Git/SVN/Ra.pm index 82d6108..1e52709 100644
--- a/perl/Git/SVN/Ra.pm
+++ b/perl/Git/SVN/Ra.pm
@@ -177,7 +177,17 @@ sub get_dir {
        }
    }
    my $pool = SVN::Pool->new;
-    my ($d, undef, $props) = $self->SUPER::get_dir($dir, $r, $pool);
+    my ($d, undef, $props);
+
+    if (defined &SVN::Ra::get_dir2) { # appeared in SVN 1.4
+        # n.b. in addition to
being potentially more efficient,
+        # this works around
what appears to be a bug in some
+        # SVN 1.8 versions
+        my $kind = 1; #
SVN_DIRENT_KIND
+        ($d, undef, $props) = $self->get_dir2($dir, $r, $kind, $pool);
+    } else {
+        ($d, undef, $props) = $self->get_dir($dir, $r, $pool);
+    }
    my %dirents = map { $_ => { kind
=> $d->{$_}->kind } } keys %$d;
    $pool->clear;
    if ($r != $cache->{r}) {
--
EW

author
#3 lore raw

PATCH v2 1/1 git-svn: use SVN::Ra::get_dir2 when possible

In reply to Eric Wong

This avoids the following failure with normal "get_dir" on newer versions of SVN (tested with SVN 1.8.8-1ubuntu3.1):

Incorrect parameters given: Could not convert '%ld' into a number

get_dir2 also has the potential to be more efficient by requesting less data.

ref: <[email protected]>
ref: <[email protected]>

Cc Hin-Tak Leung <[email protected]>

---
Sorry, waaay past my bed time. This version doesn't infinite loop on autoload or older SVN(*) (at least I hope it doesn't)

 perl/Git/SVN/Ra.pm | 12 +++++++++++-
 1 file changed, 11 insertions(+), 1 deletion(-)
perl/Git/SVN/Ra.pm +11 -1
index 82d6108..496f430 100644
@@ -177,7 +177,17 @@ sub get_dir {
 		}
 	}
 	my $pool = SVN::Pool->new;
-	my ($d, undef, $props) = $self->SUPER::get_dir($dir, $r, $pool);
+	my ($d, undef, $props);
+
+	if (::compare_svn_version('1.4.0') >= 0) {
+		# n.b. in addition to being potentially more efficient,
+		# this works around what appears to be a bug in some
+		# SVN 1.8 versions
+		my $kind = 1; # SVN_DIRENT_KIND
+		($d, undef, $props) = $self->get_dir2($dir, $r, $kind, $pool);
+	} else {
+		($d, undef, $props) = $self->SUPER::get_dir($dir, $r, $pool);
+	}
 	my %dirents = map { $_ => { kind => $d->{$_}->kind } } keys %$d;
 	$pool->clear;
 	if ($r != $cache->{r}) {
Signature · 1 line
EW
author
#4 lore raw
Quoted 4 lines · Eric Wong

This avoids the following failure with normal "get_dir" on newer versions of SVN (tested with SVN 1.8.8-1ubuntu3.1):

Incorrect parameters given: Could not convert '%ld' into a number

Filed a bug in Debian since I hit it in sid, too:
http://bugs.debian.org/767530

Thanks all.