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

[PATCH] Make svn_load_dirs.pl use --targets

From: Vladimir Prus <ghost_at_cs.msu.su>
Date: 2003-03-21 14:14:28 CET

Vladimir Prus wrote:

> The problem is that "..." part in command line is about 230000 characters
> long, and that's too much even for Linux. Is it possible to use "--target"
> command line option to pass the list of targets? I'd be happy to make the
> change myself, but unfortunately cannot read Perl :-(

OK, I've did my best. This allowed me to import the big project which was failing
previously.

Log message:
Make svn_load_dir.pl use --target option, to avoid overrunning command
line length limitations.

* tools/client-side/svn_load_dirs.pl.in
  (make_targets_list_file): New function.
   Use the above function when adding files/directories.

Patch:
Index: svn_load_dirs.pl.in
===================================================================
--- svn_load_dirs.pl.in (revision 5418)
+++ svn_load_dirs.pl.in (working copy)
@@ -14,7 +14,7 @@
 use File::Copy 2.03;
 use File::Find;
 use File::Path 1.0404;
-use File::Temp 0.12 qw(tempdir);
+use File::Temp 0.12 qw(tempdir tempfile);
 use Getopt::Long 2.25;
 use Text::Wrap;
 use URI 1.17;
@@ -413,7 +413,9 @@
         }
       $message = wrap('', ' ', $message);
 
- read_from_process($svn, 'add', '-N', @dirs_to_create);
+ my $list = make_targets_list_file(@dirs_to_create);
+ read_from_process($svn, 'add', '-N', '--targets', $list);
+ unlink($list);
       read_from_process($svn, 'commit', @svn_commit_options, '-m', $message);
     }
   else
@@ -1007,7 +1009,9 @@
       {
         my @add_files = sort {length($a) <=> length($b) || $a cmp $b}
                         keys %add_files;
- read_from_process($svn, 'add', '-N', @add_files);
+ my $list = make_targets_list_file(@add_files);
+ read_from_process($svn, 'add', '-N', '--targets', $list);
+ unlink($list);
 
         # Add properties on the added files.
         foreach my $add_file (@add_files)
@@ -1709,6 +1713,20 @@
   @words;
 }
 
+# Creates a temporary file and stores the argument
+# in it. Returns the file name.
+sub make_targets_list_file
+{
+ my ($fh, $filename) = tempfile("svn_load_dirsXXXXX");
+ foreach my $dir (@_)
+ {
+ print $fh $dir."\n";
+ }
+ close($fh);
+ return $filename;
+}
+
+
 # This package exists just to delete the temporary directory.
 package Temp::Delete;
 

- Volodya

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Received on Fri Mar 21 14:15:17 2003

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

This site is subject to the Apache Privacy Policy and the Apache Public Forum Archive Policy.