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

Reply

Author sunny256
Full name Øyvind A. Holm
Date 2007-03-05 08:42:26 PST
Message User: sunny256
Date: 2007-03-05 08:42:26-0800
Log:
 r180 | sunny256 | 2007-03-04 12:07:26 +0000 (Sun, 04 Mar 2007) | 5 lines
 
 * /trunk/src/mergesvn
   (@Props loop): Optimised the logic of the master path variables and
     moved the scan for highest revision into its own subroutine.
   (highest_revision): …this one.

File Changes:

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

File [changed]: mergesvn
Url: http://svnutils.tigr​is.org/source/browse​/svnutils/trunk/src/​mergesvn?r1=1.7&​r2=1.8
Delta lines: +23 -16
---------------------
--- mergesvn 2007-03-05 08:41:46-0800 1.7
+++ mergesvn 2007-03-05 08:42:23-0800 1.8
@@ -1,7 +1,7 @@
 #!/usr/bin/perl -w
 
 #===================​====================​====================​============
-# $Id: mergesvn 179 2007-03-04 10:50:11Z sunny256 $
+# $Id: mergesvn 180 2007-03-04 12:07:26Z sunny256 $
 # Merges new changes into a file version controlled by Subversion.
 #
 # Character set: UTF-8
@@ -28,7 +28,7 @@
 our $progname = $0;
 $progname =~ s#^.*/(.*?)$#$1#;
 
-my $rcs_id = '$Id: mergesvn 179 2007-03-04 10:50:11Z sunny256 $';
+my $rcs_id = '$Id: mergesvn 180 2007-03-04 12:07:26Z sunny256 $';
 my $id_date = $rcs_id;
 $id_date =~ s/^.*?\d+ (\d\d\d\d-.*?\d​\d:\d\d:\d\d\S​+).*/$1/;
 
@@ -74,15 +74,12 @@
     D("Props = (\"" . join("\", \"", @Props) . "\")");
     for my $Curr (@Props) {
         if ($Curr =~ /^(\d+) (.+)$/) {
- my ($last_merge, $master_file) =
+ my ($last_merge, $orig_master) =
                ( $1, $2);
- $master_file =~ s/[\r\n]+$//;
- my $safe_master_file = escape_filename(
- length($Opt{'alias'}) ? $Opt{'alias'} : $master_file
- );
+ $orig_master =~ s/[\r\n]+$//;
+ my $master_file = length($Opt{'alias'}) ? $Opt{'alias'} : $orig_master;
             mysyst($CMD_SVN, "update", $File);
- my $curr_rev = `$CMD_SVN log -r$Opt{'to'}:1 --limit 1 --xml $safe_master_file`; # FIXME
- $curr_rev =~ s/^.*<logentry.+?​revision="(\d+)".*?​>.*/$1/s;
+ my $curr_rev = highest_revision($master_file, $Opt{'to'});
             if ($curr_rev !~ /^\d+$/) {
                 warn("$progname: $master_file: Unable to get newest revision\n");
                 next LOOP;
@@ -91,17 +88,15 @@
                 mysyst(
                     $CMD_SVN, "merge", "-r$last_merge:$curr_rev",
                     "--dry-run",
- length($Opt{'alias'}) ? $Opt{'alias'} : $master_file,
- $File
+ $master_file, $File
                 );
             } else {
                 mysyst(
                     $CMD_SVN, "merge", "-r$last_merge:$curr_rev",
- length($Opt{'alias'}) ? $Opt{'alias'} : $master_file,
- $File
+ $master_file, $File
                 );
             }
- push(@new_prop, "$curr_rev $master_file");
+ push(@new_prop, "$curr_rev $orig_master");
         } else {
             warn("$File: \"$Curr\": Invalid property line\n");
             next LOOP;
@@ -111,6 +106,18 @@
     # }}}
 }
 
+sub highest_revision {
+ # Return the newest revision of a versioned element inside a
+ # specified revision range
+ # {{{
+ my ($Path, $max_rev) = @_;
+ 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;
+ return($highest_rev);
+ # }}}
+} # highest_revision()
+
 sub mysyst {
     # {{{
     my @Args = @_;
@@ -212,7 +219,7 @@
 
 =head1 REVISION
 
-$Id: mergesvn 179 2007-03-04 10:50:11Z sunny256 $
+$Id: mergesvn 180 2007-03-04 12:07:26Z sunny256 $
 
 =head1 SYNOPSIS
 
@@ -303,4 +310,4 @@
 # }}}
 
 # vim: set fenc=UTF-8 ft=perl fdm=marker ts=4 sw=4 sts=4 et fo+=w :
-# End of file $Id: mergesvn 179 2007-03-04 10:50:11Z sunny256 $
+# End of file $Id: mergesvn 180 2007-03-04 12:07:26Z 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-03-05 08:42:26 PST
Messages per page: