Search notes:

Script: svnlu.pl

svnlu.pl regexp
basically issues an svn list and finds the files that match regexp
Each file can then be selected for update by pressing «y» or «j».
A «q» prematurly exits the script. Every other key skips the file.
#
#   svnlu.pl  regexp
#
#   The script basically issues an «svn list» and finds the
#   files that match «regexp».
#   Each file can be selected for update by pressing
#  «y» or «j». A «q» prematurly exits the script. Every
#   other key skips the file.
#

use warnings; use strict;

use Term::ReadKey;

my $file_regexp = shift;

$file_regexp = '\w' unless $file_regexp;

print "\nfile_regexp: $file_regexp\n";

open (my $svn_command, '-|', "svn list");
my @file_list = <$svn_command>;
close $svn_command;

chomp(@file_list);

my @file_list_matched = grep { /$file_regexp/ }  @file_list;
my @file_list_to_update;

print "\nThere are " . @file_list_matched . " file(s) that have matched\n\n";
print "Note: you can press q to exit the script\n\n";

ReadMode(4);
for my $file (@file_list_matched) {
  print "update $file? ";
  my $key_pressed = ReadKey(0);

  print "$key_pressed";

  if    ($key_pressed eq 'y' or $key_pressed eq 'j') {
      push @file_list_to_update, $file;
  }
  elsif ($key_pressed eq 'q') {
      @file_list_to_update = ();
      last;
  }

  print "\n";
}

ReadMode(0);

system "svn up " . (join " ", @file_list_to_update) if @file_list_to_update;
Github repository scripts-and-utilities, path: /svnlu.pl

See also

Scripts

Index

Fatal error: Uncaught PDOException: SQLSTATE[HY000]: General error: 8 attempt to write a readonly database in /home/httpd/vhosts/renenyffenegger.ch/php/web-request-database.php:78 Stack trace: #0 /home/httpd/vhosts/renenyffenegger.ch/php/web-request-database.php(78): PDOStatement->execute(Array) #1 /home/httpd/vhosts/renenyffenegger.ch/php/web-request-database.php(30): insert_webrequest_('/notes/developm...', 1759390904, '216.73.216.42', 'Mozilla/5.0 App...', NULL) #2 /home/httpd/vhosts/renenyffenegger.ch/httpsdocs/notes/development/tools/scripts/personal/svnlu_pl(100): insert_webrequest() #3 {main} thrown in /home/httpd/vhosts/renenyffenegger.ch/php/web-request-database.php on line 78