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

[PATCH] svn_load_dirs update

From: Peter Gervai <grin_at_tolna.net>
Date: 2004-01-15 15:05:00 CET

** please do not ignore. thanks. **

diff against http://216.127.237.133/repos/svn/trunk/contrib/client-side rev 8294

* new option -g: draw lines in selection
* Yes is default selection
* All option in selection listing apart from Y/N
* possibility to relist at the end of the selection
* selection is sorted by filename

Please apply!

(by the way selection code is a crap; if there's more than 40-50
differences it's impossible. should be rewritten using ncurses...)

Index: svn_load_dirs.pl.in
===================================================================
--- svn_load_dirs.pl.in (revision 8299)
+++ svn_load_dirs.pl.in (working copy)
@@ -59,6 +59,9 @@
 # Path to already checked-out working copy.
 my $opt_existing_wc_dir;
 
+# Draw ASCII guide at selection
+my $opt_guide;
+
 # This is the character used to separate regular expressions occuring
 # in the tag directory path from the path itself.
 my $REGEX_SEP_CHAR = '@';
@@ -68,12 +71,16 @@
 # matching files.
 my $property_config_filename;
 
+# Handle 'a' in yes/no prompts: yes to all.
+my $yes_to_all = 0;
+
 GetOptions('no_user_input' => \$opt_no_user_input,
            'property_cfg_filename=s' => \$property_config_filename,
            'svn_password=s' => \$opt_svn_password,
            'svn_username=s' => \$opt_svn_username,
            'tag_location=s' => \$opt_import_tag_location,
            'verbose+' => \$opt_verbose,
+ 'guide' => \$opt_guide,
            'wc=s' => \$opt_existing_wc_dir)
   or &usage;
 &usage("$0: too few arguments") if @ARGV < 2;
@@ -219,7 +226,7 @@
       }
 
     exit 0 unless &get_yes_or_no("Please examine identified tags. Are they " .
- "acceptable? (Y/N) ");
+ "acceptable? (Y/n) ");
     print "\n";
   }
 
@@ -422,7 +429,7 @@
           print " $dir\n";
         }
       exit 0 unless &get_yes_or_no("You must add them now to load the " .
- "directories. Continue (Y/N)? ");
+ "directories. Continue (Y/n)? ");
 
       my $message = "Create directories to load project into.\n\n";
 
@@ -673,7 +680,18 @@
                       "which you type into this script to have a rename\n",
                       "performed.\n";
                   }
-
+
+
+ # sort them by filenames
+ @add_files = map { $_->[0] } sort { $a->[1] cmp $b->[1] } map { [$_, m#([^/]+)$#] } @add_files;
+ @del_files = map { $_->[0] } sort { $a->[1] cmp $b->[1] } map { [$_, m#([^/]+)$#] } @del_files;
+
+ my $guide_char = " ";
+ $guide_char = "_" if $opt_guide;
+
+ RELIST:
+
+ $yes_to_all = 0;
                 for (my $i=0; $i<$max; ++$i)
                   {
                     my $add_filename = '';
@@ -699,7 +717,7 @@
                       {
                         print
                           "\n",
- " " x $line_number_width,
+ $guide_char x $line_number_width,
                           " ",
                           "Deleted", " " x ($filename_width-length("Deleted")),
                           " ",
@@ -708,12 +726,12 @@
 
                     printf $printf_format, $i;
                     print " ", $del_filename,
- " " x ($filename_width - length($del_filename)),
+ $guide_char x ($filename_width - length($del_filename)),
                            " ", $add_filename, "\n";
 
                     if (($i+1) % 22 == 0)
                       {
- unless (&get_yes_or_no("Continue printing (Y/N)? "))
+ unless (&get_yes_or_no("Continue printing (Y/n/a)? "))
                           {
                             last;
                           }
@@ -728,10 +746,14 @@
                 my $del_index;
                 my $got_line = 0;
                 do {
- print "Enter two indexes for each column to rename or F ",
+ print "Enter two indexes for each column to rename, R to relist or F ",
                         "when you are finished: ";
                   $line = <STDIN>;
                   $line = '' unless defined $line;
+ if( $line =~ /^r$/i ) {
+ goto RELIST;
+ }
+
                   if ($line =~ /^F$/i)
                     {
                       $got_line = 1;
@@ -1234,7 +1256,8 @@
       " -t tag_dir create a tag copy in tag_dir, relative to svn_url\n",
       " -v increase program verbosity, multiple -v's allowed\n",
       " -wc path use the already checked-out working copy at path\n",
- " instead of checkout out a fresh working copy\n";
+ " instead of checkout out a fresh working copy\n",
+ " -g use ascii line (___) as guide for selection\n";
 }
 
 # Get the next directory to load, either from the command line or from
@@ -1647,13 +1670,16 @@
 # lowercase y or n.
 sub get_yes_or_no
 {
+
+ return 1 if $yes_to_all;
+
   unless (@_ == 1)
     {
       croak "$0: get_yes_or_no $INCORRECT_NUMBER_OF_ARGS";
     }
 
   my $message = shift;
-
+
   # Assume a positive answer if no user input is being accepted.
   return 1 if $opt_no_user_input;
 
@@ -1663,8 +1689,13 @@
       print $message;
       $line = <STDIN>;
       $line = '' unless defined $line;
- } until $line =~ /[yn]/i;
- $line =~ /y/i;
+ } until $line =~ /[yna]?/i;
+
+ if( $line =~ /a/i ) {
+ $yes_to_all=1;
+ return 1;
+ }
+ $line !~ /n/i;
 }
 
 # Determine the native end of line on this system by writing a \n in

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Received on Thu Jan 15 15:05:37 2004

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.