@matheusbsbs / matheus-bagliano / commits / 4802426ddb
Fork 0

svnimport: Convert executable flag

Convert the svn:executable property to file mode 755 when converting an SVN repository to GIT. Signed-off-by: Karl Hasselström <kha@treskal.com> Signed-off-by: Junio C Hamano <junkio@cox.net>

Karl Hasselström committed Feb 26, 2006 at 06:11 UTC 4802426ddbf518f30f53cc572d619495ab52e4f7
1 file changed +13 -7
git-svnimport.perl
+13 -7
@@ -112,16 +112,22 @@ sub file {
112 DIR => File::Spec->tmpdir(), UNLINK => 1);
113
114 print "... $rev $path ...\n" if $opt_v;
115 - my $pool = SVN::Pool->new();
116 - eval { $self->{'svn'}->get_file($path,$rev,$fh,$pool); };
117 - $pool->clear;
115 + my (undef, $properties);
116 + eval { (undef, $properties)
117 + = $self->{'svn'}->get_file($path,$rev,$fh); };
118 if($@) {
119 return undef if $@ =~ /Attempted to get checksum/;
120 die $@;
121 }
122 + my $mode;
123 + if (exists $properties->{'svn:executable'}) {
124 + $mode = '0755';
125 + } else {
126 + $mode = '0644';
127 + }
128 close ($fh);
129
124 - return $name;
130 + return ($name, $mode);
131 }
132
133 package main;
@@ -296,7 +302,7 @@ sub get_file($$$) {
302 my $svnpath = revert_split_path($branch,$path);
303
304 # now get it
299 - my $name;
305 + my ($name,$mode);
306 if($opt_d) {
307 my($req,$res);
308
@@ -316,8 +322,9 @@ sub get_file($$$) {
322 return undef if $res->code == 301; # directory?
323 die $res->status_line." at $url\n";
324 }
325 + $mode = '0644'; # can't obtain mode via direct http request?
326 } else {
320 - $name = $svn->file("$svnpath",$rev);
327 + ($name,$mode) = $svn->file("$svnpath",$rev);
328 return undef unless defined $name;
329 }
330
@@ -331,7 +338,6 @@ sub get_file($$$) {
338 chomp $sha;
339 close $F;
340 unlink $name;
334 - my $mode = "0644"; # SV does not seem to store any file modes
341 return [$mode, $sha, $path];
342 }
343