Login | Register
My pages Projects Community openCollabNet

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

svnutils
Discussion topic

Back to topic list

CVS update: /svnutils/trunk/

Author sunny
Full name Øyvind A. Holm
Date 2004-05-28 23:08:30 PDT
Message User: sunny
Date: 04/05/28 23:08:30

Added:
 /svnutils/trunk/
  strip_id

Log:
 r28 | sunny | 2004-05-29 08:07:12 +0200 (Sat, 29 May 2004) | 4 lines
 Changed paths:
    A /trunk/strip_id
 
 This is "strip_id 819 2004-05-16 00:00:27Z sunny" from my "bin" repository.
 It strips things like "$Id: ", " $", "$Date: " etc from the text in the
 files to avoid them being mangled by other imports into CVS or Subversion.

File Changes:

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

File [added]: strip_id
Url: http://svnutils.tigr​is.org/source/browse​/svnutils/trunk/stri​p_id?rev=1.1&con​tent-type=text/vnd.v​iewcvs-markup
Added lines: 50
---------------
#!/usr/bin/perl -w

#===================​====================​====================​=================
# $Id: strip_id 819 2004-05-16 00:00:27Z sunny $
# Lager «-kv»-feeling på Id og Date. Subversion gjør visst ikke sånt enda. Og
# jeg er mildt sagt irritert over det nye formatet på $Date , så det engelske
# kjøret i parentesen strippes bort.
#
# Character set: UTF-8
# License: GNU General Public License
# ©opyleft 2004 Øyvind A. Holm <sunny at sunbase dot org>
#===================​====================​====================​=================

use strict;

$| = 1;

my $rand_ext = "$$." . substr(rand, 2, 8);
while (defined($ARGV[0])) {
    my $Curr = shift;
    my $Dest = "$Curr.$rand_ext.tmp";
    if (open(FromFP, $Curr)) {
        (-e $Dest) && die("$Dest: What??? File already exists!");
        if (open(ToFP, ">$Dest")) {
            while (<FromFP>) {
                $_ = process_line($_);
                print(ToFP $_);
            }
            close(FromFP);
            close(ToFP);
            rename($Dest, $Curr) || warn("rename($Dest, $Curr): $!");
        } else {
            warn("$Dest: Unable to create file: $!");
        }
    } else {
        warn("$Curr: Unable to open file for read: $!");
    }
}

sub process_line {
    my $Retval = shift;
    $Retval =~ s/(\$Date: .*?)\(..., \d+ ... \d\d\d\d\) (\$)/$1$2/g;
    $Retval =~ s/\$(Id|Date): (.*?) \$/$2/g;
    return($Retval);
}

__END__

# vim: set fileencoding=UTF-8 filetype=perl foldmethod=marker foldlevel=0 :
# End of file $Id: strip_id 819 2004-05-16 00:00:27Z sunny $




--------------------​--------------------​--------------------​---------
To unsubscribe, e-mail: cvs-unsubscribe@svnu​tils.tigris.org
For additional commands, e-mail: cvs-help at svnutils dot tigris dot org

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

Messages

Show all messages in topic

CVS update: /svnutils/trunk/ sunny Øyvind A. Holm 2004-05-28 23:08:30 PDT
Messages per page: