Login | Register
My pages Projects Community openCollabNet

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

svnutils
Discussion topic

Back to topic list

CVS update: /svnutils/trunk/src/mergesvn

Author sunny256
Full name Øyvind A. Holm
Date 2007-04-07 06:08:50 PDT
Message User: sunny256
Date: 2007-04-07 06:08:50-0700
Log:
 r194 | sunny256 | 2007-04-02 22:42:41 +0000 (Mon, 02 Apr 2007) | 6 lines
 
 * /trunk/src/mergesvn
   (legal_revision): New subroutine for checking if a string is a legal
     revision number.
   (highest_revision): Added it here.
   (Main loop): Replaced a standard regexp with it.

File Changes:

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

File [changed]: mergesvn
Url: http://svnutils.tigr​is.org/source/browse​/svnutils/trunk/src/​mergesvn?r1=1.15​&r2=1.16
Delta lines: +16 -5
--------------------
--- mergesvn 2007-03-12 01:18:11-0700 1.15
+++ mergesvn 2007-04-07 06:08:48-0700 1.16
@@ -1,7 +1,7 @@
 #!/usr/bin/perl -w
 
 #===================​====================​====================​============
-# $Id: mergesvn 191 2007-03-11 14:24:54Z sunny $
+# $Id: mergesvn 194 2007-04-02 22:42:41Z sunny256 $
 # Merges new changes into a file version controlled by Subversion.
 #
 # Character set: UTF-8
@@ -32,7 +32,7 @@
 our $progname = $0;
 $progname =~ s#^.*/(.*?)$#$1#;
 
-my $rcs_id = '$Id: mergesvn 191 2007-03-11 14:24:54Z sunny $';
+my $rcs_id = '$Id: mergesvn 194 2007-04-02 22:42:41Z sunny256 $';
 my $id_date = $rcs_id;
 $id_date =~ s/^.*?\d+ (\d\d\d\d-.*?\d​\d:\d\d:\d\d\S​+).*/$1/;
 
@@ -87,7 +87,7 @@
                                 ? $Opt{'alias'}
                                 : $orig_master;
             my $curr_rev = highest_revision($master_file, $Opt{'to'});
- if ($curr_rev !~ /^\d+$/) {
+ if (!legal_revision($curr_rev)) {
                 warn("$progname: $master_file: " .
                      "Unable to get newest revision\n");
                 next LOOP;
@@ -133,6 +133,16 @@
     # }}}
 }
 
+sub legal_revision {
+ my $Rev = shift;
+ my $Retval = 1;
+
+ if ($Rev =~ /[^\d]/ || !length($Rev)) {
+ $Retval = 0;
+ }
+ return($Retval);
+}
+
 sub find_conflict {
     # Scan a specific revision range for the first merge conflict and
     # return the revision number
@@ -244,6 +254,7 @@
     my $safe_path = escape_filename($Path);
     my $highest_rev = `$CMD_SVN log -r$max_rev:1 --limit 1 --xml $safe_path`; # FIXME
     $highest_rev =~ s/^.*?<logentry.+​?revision="(\d+)".*​?>.*/$1/s;
+ legal_revision($highest_rev) || ($highest_rev = "");
     return($highest_rev);
     # }}}
 } # highest_revision()
@@ -368,7 +379,7 @@
 
 =head1 REVISION
 
-$Id: mergesvn 191 2007-03-11 14:24:54Z sunny $
+$Id: mergesvn 194 2007-04-02 22:42:41Z sunny256 $
 
 =head1 SYNOPSIS
 
@@ -484,4 +495,4 @@
 # }}}
 
 # vim: set fenc=UTF-8 ft=perl fdm=marker ts=4 sw=4 sts=4 et fo+=w :
-# End of file $Id: mergesvn 191 2007-03-11 14:24:54Z sunny $
+# End of file $Id: mergesvn 194 2007-04-02 22:42:41Z sunny256 $

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

Messages

Show all messages in topic

CVS update: /svnutils/trunk/src/mergesvn sunny256 Øyvind A. Holm 2007-04-07 06:08:50 PDT
Messages per page: