--- svncopy.modified.pl.in	2012-06-05 11:47:56.000000000 +-0200
+++ svncopy.pl.in	2012-03-05 13:19:46.000000000 +-0200
@@ -89,13 +89,13 @@
 GetOptions( "pin-externals|tag|t" => \$pin_externals,
             "update-externals|branch|b" => \$update_externals,
             "message|m=s" => \$message,
             "revision|r=s" => \$revision,
             "verbose!" => \$verbose,
             "quiet|q" => sub { $verbose = 0; push( @svn_options, "--quiet" ) },
-            "file|F=s" => sub { open FILE, $_[1]; my @content = <FILE>; $message = join("\n", @content, "\n"); close FILE; },
+            "file|F=s" => sub { push( @svn_options, "--file", $_[1] ) },
             "username=s" => sub { push( @svn_options, "--username", $_[1] ) },
             "password=s" => sub { push( @svn_options, "--password", $_[1] ) },
             "no_auth_cache" => sub { push( @svn_options, "--no-auth-cache" ) },
             "force-log" => sub { push( @svn_options, "--force-log" ) },
             "encoding=s" => sub { push( @svn_options, "--encoding", $_[1] ) },
             "config-dir=s" => sub { push( @svn_options, "--config-dir", $_[1] ) },
@@ -397,15 +397,12 @@
   my ( $sourceref, $destination, $work_dir, $msgref ) = @_;
   my @commandline = ();
   my $msg;
   my @dirfiles;
   my %extlist;
 
-  # Changes to the working directory in order to avoid errors trying to retrieve the last
-  # revision from a relative URL. This directory change does not affect to absolute URLs.
-  chdir( $work_dir );
   # Check the externals on this directory and subdirectories
   info( "Checking '$work_dir'\n" );
   %extlist = GetRecursiveExternals( $work_dir );
     
   # And do the update
   while ( my ( $subdir, $exts ) = each ( %extlist ) )
@@ -445,37 +442,14 @@
   my %changed;
     
   # Do any updating required
   foreach my $external ( @externals )
     {
       chomp( $external );
-      # -rREV EXTERNAL
-      $rev_pattern = '(?:-r\s*(\d+)\s+)?((?:\w+:|\^|\.{2})?/[/\-\.\w]+)';
-      # EXTERNAL@REV
-      $peg_pattern = '((?:\w+:|\^|\.{2})?/[/\-\.\w]+)(?:@(\d+))?';
-      my ( $ext_dir, $spacing, $ext_rev, $ext_val );
-
-      # New format: -rREV EXTERNAL DIR
-      if ( $external =~ m"^$rev_pattern(\s+)(.*)" ) 
-        {
-          ( $ext_dir, $spacing, $ext_rev, $ext_val ) = ( $4, $3, $1, $2 );
-        } 
-      # New format: EXTERNAL@REV DIR
-      elsif ( $external =~ m"^$peg_pattern(\s+)(.*)" ) 
-        {
-          ( $ext_dir, $spacing, $ext_rev, $ext_val ) = ( $4, $3, $2, $1 );
-        }
-      # Old externals format
-      elsif ( $external =~ m"^(\S+)(\s+)(?:-r\s*(\d+)\s+)?(.*)" ) 
-        {
-          ( $ext_dir, $spacing, $ext_rev, $ext_val ) = ( $1, $2, $3, $4 );
-        }
-      else
-        {
-          next;
-        }
+      next unless ( $external =~ m"^(\S+)(\s+)(?:-r\s*(\d+)\s+)?(.*)" );
+      my ( $ext_dir, $spacing, $ext_rev, $ext_val ) = ( $1, $2, $3, $4 );
             
       info( " - Found $ext_dir => '$ext_val'" );
       info( " ($ext_rev)" ) if $ext_rev;
       info( "\n" );
         
       $externals_hash{ "$ext_val" } = $ext_rev;
@@ -489,25 +463,25 @@
               foreach my $source ( @sources )
                 {
                   my $dest_dir = DestinationSubdir( $source, $destination );
                   #info( "Checking against '$source'\n" );
                   if ( $ext_val =~ s|^$source|$dest_dir| )
                     {
-                      $external = "$ext_val$spacing$ext_dir";
+                      $external = "$ext_dir$spacing$ext_val";
                       info( " - updated '$old_external' to '$external'\n" );
                       $changed{$old_external} = $external;
                     }
                 }
             }
           elsif ( $pin_externals )
             {
               # Find the last revision of the destination and pin to that.
               my $old_external = $external;
-              my $rev = LatestRevision( '"'.$ext_val.'"', $revision );
+              my $rev = LatestRevision( $ext_val, $revision );
               #info( "Pinning '$ext_val' to '$rev'\n" );
-              $external = "$ext_val\@$rev$spacing$ext_dir";
+              $external = "$ext_dir -r $rev$spacing$ext_val";
               info( " - updated '$old_external' to '$external'\n" );
               $changed{$old_external} = $external;
             }
         }
       push( @new_externals, $external );
     }
