[svn.haxx.se] · SVN Dev · SVN Users · SVN Org · TSVN Dev · TSVN Users · Subclipse Dev · Subclipse Users · this month's index

[PATCH] handle symlinks in svn_load_dirs

From: Peter Samuelson <peter_at_p12n.org>
Date: 2005-12-12 07:52:04 CET

We received a patch to the svn_load_dirs contrib script via the Debian
bug tracker (http://bugs.debian.org/311440), to make it recognise and
support symlinks. I've tweaked it somewhat, and tested it on Debian.

[[[
Educate svn_load_dirs to support symlinks.

Patch by: Tilman Koschnick <til@subnetz.org>
          Peter Samuelson <peter@p12n.org>

* contrib/client-side/svn_load_dirs.pl.in:
  Handle symlinks ($source_type 'l').
]]]

Index: contrib/client-side/svn_load_dirs.pl.in
===================================================================
--- contrib/client-side/svn_load_dirs.pl.in (revisione 17719)
+++ contrib/client-side/svn_load_dirs.pl.in (copia locale)
@@ -574,7 +574,8 @@
                         "type for '$source_path'.\n";
                   }
 
- if ($source_type ne 'f' and $source_type ne 'd')
+ if ($source_type ne 'f' and $source_type ne 'd' and
+ $source_type ne 'l')
                   {
                     warn "$0: skipping loading file '$source_path' of type ",
                          "'$source_type'.\n";
@@ -898,7 +899,8 @@
         my ($source_type, $source_is_exe) = &file_info($source_path);
         my ($dest_type) = &file_info($dest_path);
 
- return if ($source_type ne 'd' and $source_type ne 'f');
+ return if ($source_type ne 'd' and $source_type ne 'f' and
+ $source_type ne 'l');
 
         # Fail if the destination type exists but is of a different
         # type of file than the source type.
@@ -1010,6 +1012,21 @@
               }
           }
         elsif
+ ($source_type eq 'l') {
+ my $link_target = readlink($source_path)
+ or die "$0: readlink '$source_path': $!\n";
+ if ($dest_type eq 'l')
+ {
+ my $old_target = readlink($dest_path)
+ or die "$0: readlink '$dest_path': $!\n";
+ return if ($old_target eq $link_target);
+ unlink($dest_path)
+ or die "$0: rm '$dest_path': $!\n";
+ }
+ symlink($link_target, $dest_path)
+ or die "$0: symlink '$dest_path' -> '$link_target': $!\n";
+ }
+ elsif
           ($source_type eq 'f') {
             # Only copy the file if the digests do not match.
             if ($add_files{$source_path} or $upd_files{$source_path})

Received on Mon Dec 12 07:52:51 2005

This is an archived mail posted to the Subversion Dev mailing list.