Login | Register
My pages Projects Community openCollabNet

Discussions > cvs > CVS update: /svnutils/trunk/src/convkeyw

svnutils
Discussion topic

Back to topic list

CVS update: /svnutils/trunk/src/convkeyw

Reply

Author sunny256
Full name Øyvind A. Holm
Date 2007-03-21 09:59:41 PDT
Message User: sunny256
Date: 2007-03-21 09:59:41-0700
Log:
 r193 | sunny256 | 2007-03-21 16:58:26 +0000 (Wed, 21 Mar 2007) | 3 lines
 
 * /trunk/src/convkeyw
   Added the -S option.

File Changes:

Directory: /svnutils/trunk/src/
===============================

File [changed]: convkeyw
Url: http://svnutils.tigr​is.org/source/browse​/svnutils/trunk/src/​convkeyw?r1=1.10​&r2=1.11
Delta lines: +20 -8
--------------------
--- convkeyw 2004-12-11 21:29:37-0700 1.10
+++ convkeyw 2007-03-21 09:59:39-0700 1.11
@@ -1,7 +1,7 @@
 #!/usr/bin/perl -w
 
 #===================​====================​====================​============
-# $Id: convkeyw 91 2004-12-12 04:27:29Z sunny256 $
+# $Id: convkeyw 193 2007-03-21 16:58:26Z sunny256 $
 # Converts Subversion/RCS/CVS keywords in text files in various ways.
 # Optimised for use with Subversion at the moment, but also works with
 # CVS and RCS.
@@ -15,11 +15,11 @@
 use strict;
 use Getopt::Std;
 
-our ($opt_c, $opt_D, $opt_h, $opt_s, $opt_V) =
- ( 0, 0, 0, 0, 0);
-getopts('cDhsV') || die("Option error, use -h for help");
+our ($opt_c, $opt_D, $opt_h, $opt_S, $opt_s, $opt_V) =
+ ( 0, 0, 0, 0, 0, 0);
+getopts('cDhSsV') || die("Option error, use -h for help");
 
-my $rcs_id = '$Id: convkeyw 91 2004-12-12 04:27:29Z sunny256 $';
+my $rcs_id = '$Id: convkeyw 193 2007-03-21 16:58:26Z sunny256 $';
 my $stripped_rcs_id = $rcs_id;
 $stripped_rcs_id =~ s/^\$(.*)\s+\S+\s+\$$/$1/;
 
@@ -43,6 +43,8 @@
 
 $opt_h && usage(0);
 
+$opt_s && $opt_S && die("convkeyw: Cannot mix the -s and -S option.\n");
+
 if ($opt_V) {
     print("$stripped_rcs_id\n");
     exit(0);
@@ -87,10 +89,15 @@
     }
 
     if ($opt_s) {
- # Strip keywords — remove dollars. This action is destructive
- # and has to be last.
+ # Strip keywords — remove dollars, keyword and colon. This
+ # action is destructive and has to be last.
         $Retval =~ s/\$($Keyw): (.*?) \$/$2/g;
         $Retval =~ s/\$($Keyw)\$/$1/g;
+ } elsif ($opt_S) {
+ # Strip keywords — remove dollars only. This action is
+ # destructive and has to be last.
+ $Retval =~ s/\$($Keyw): (.*?) \$/$1: $2/g;
+ $Retval =~ s/\$($Keyw)\$/$1/g;
     }
 
     return($Retval);
@@ -127,6 +134,11 @@
         WARNING: After using this option, further processing of keywords
         in the file is impossible. Meant for use in tarballs and
         releases.
+ -S Strip dollars from keywords like -s, but leave the keyword
+ itself and the colon intact. I.e.:
+ \$Id: file.txt 123 2004-01-21 17:12:16Z fjodor \$
+ is changed to
+ Id: file.txt 123 2004-01-21 17:12:16Z fjodor
     -V Print version of the script:
           $stripped_rcs_id
 
@@ -138,4 +150,4 @@
 __END__
 
 # vim: set et ts=4 sw=4 sts=4 fo+=w fo+=c fo-=t tw=72 :
-# End of file $Id: convkeyw 91 2004-12-12 04:27:29Z sunny256 $
+# End of file $Id: convkeyw 193 2007-03-21 16:58:26Z sunny256 $

« Previous message in topic | 1 of 1 | Next message in topic »

Messages

Show all messages in topic

CVS update: /svnutils/trunk/src/convkeyw sunny256 Øyvind A. Holm 2007-03-21 09:59:41 PDT
Messages per page: