summaryrefslogtreecommitdiff
path: root/perl/Git/SVN
diff options
context:
space:
mode:
authorMichael G. Schwern <schwern@pobox.com>2012-07-28 09:38:27 (GMT)
committerEric Wong <normalperson@yhbt.net>2012-08-02 21:43:10 (GMT)
commit82009f304826fcaf3188fb422769a7974ae78afa (patch)
tree46d3a8523edd47920f7cb5685f02fb53b1447590 /perl/Git/SVN
parent91e6e0c56cc83e5f53d93e90726380a2d392f5f1 (diff)
downloadgit-82009f304826fcaf3188fb422769a7974ae78afa.zip
git-82009f304826fcaf3188fb422769a7974ae78afa.tar.gz
git-82009f304826fcaf3188fb422769a7974ae78afa.tar.bz2
git-svn: use SVN 1.7 to canonicalize when possible
No change on SVN 1.6. The tests all pass with SVN 1.6 if canonicalize_url() does nothing, so tests passing doesn't have much meaning. The tests are so messed up right now with SVN 1.7 it isn't really useful to check. They will be useful later. [ew: commit title] Signed-off-by: Eric Wong <normalperson@yhbt.net>
Diffstat (limited to 'perl/Git/SVN')
-rw-r--r--perl/Git/SVN/Utils.pm16
1 files changed, 16 insertions, 0 deletions
diff --git a/perl/Git/SVN/Utils.pm b/perl/Git/SVN/Utils.pm
index ad5351e..246d1aa 100644
--- a/perl/Git/SVN/Utils.pm
+++ b/perl/Git/SVN/Utils.pm
@@ -3,6 +3,8 @@ package Git::SVN::Utils;
use strict;
use warnings;
+use SVN::Core;
+
use base qw(Exporter);
our @EXPORT_OK = qw(
@@ -100,6 +102,20 @@ API as a URL.
=cut
sub canonicalize_url {
+ my $url = shift;
+
+ # The 1.7 way to do it
+ if ( defined &SVN::_Core::svn_uri_canonicalize ) {
+ return SVN::_Core::svn_uri_canonicalize($url);
+ }
+ # There wasn't a 1.6 way to do it, so we do it ourself.
+ else {
+ return _canonicalize_url_ourselves($url);
+ }
+}
+
+
+sub _canonicalize_url_ourselves {
my ($url) = @_;
$url =~ s#^([^:]+://[^/]*/)(.*)$#$1 . canonicalize_path($2)#e;
return $url;