[svn.haxx.se] · SVN Dev · SVN Users · SVN Org · TSVN Dev · TSVN Users · Subclipse Dev · Subclipse Users · this month's index

Re: Tonight's svn-role merges - bug analysis

From: Daniel Shahaf <d.s_at_daniel.shahaf.name>
Date: Thu, 17 Apr 2014 11:25:52 +0000

Daniel Shahaf wrote on Thu, Apr 17, 2014 at 11:12:15 +0000:
> The fix would be to change the $parno accounting as follows: before
> $entry{parno} is used, subtract from it the number of entries already
> merged in this run.

Untested patch:

[[[
Index: tools/dist/backport.pl
===================================================================
--- tools/dist/backport.pl (revision 1588205)
+++ tools/dist/backport.pl (working copy)
@@ -80,6 +80,8 @@ $ENV{LC_ALL} = "C"; # since we parse 'svn info' o
 
 # Globals.
 my %ERRORS = ();
+# TODO: can $MERGED_SOMETHING be removed and references to it replaced by scalar(@MERGES_TODAY) ?
+my @MERGES_TODAY;
 my $MERGED_SOMETHING = 0;
 my $SVNq;
 
@@ -255,6 +257,7 @@ sub my_tempfile {
 
 sub merge {
   my %entry = @_;
+ my $parno = $entry{parno} - scalar grep { $_ < $entry{parno} } @MERGES_TODAY;
 
   my ($logmsg_fh, $logmsg_filename) = my_tempfile();
   my (@mergeargs);
@@ -312,7 +315,7 @@ if $sh[$MAY_COMMIT]; then
   # Remove the approved entry. The sentinel guarantees the right number of blank
   # lines is removed, which prevents spurious '--renormalize' commits tomorrow.
   echo "sentinel" >> $STATUS
- $VIM -e -s -n -N -i NONE -u NONE -c ':0normal! $entry{parno}\x{7d}kdap' -c wq $STATUS
+ $VIM -e -s -n -N -i NONE -u NONE -c ':0normal! $parno\x{7d}kdap' -c wq $STATUS
   $VIM -e -s -n -N -i NONE -u NONE -c '\$d' -c wq $STATUS
   $SVNq commit -F $logmsg_filename
 elif ! $sh[$YES]; then
@@ -325,6 +328,11 @@ elif ! $sh[$YES]; then
 fi
 EOF
 
+ if ($MAY_COMMIT) {
+ # STATUS has been edited and the change has been committed
+ push @MERGES_TODAY, $entry{parno} if $MAY_COMMIT;
+ }
+
   $script .= <<"EOF" if $entry{branch};
 reinteg_rev=\`$SVN info $STATUS | sed -ne 's/Last Changed Rev: //p'\`
 if $sh[$MAY_COMMIT]; then
@@ -354,6 +362,8 @@ EOF
   $MERGED_SOMETHING++;
   open SHELL, '|-', qw#/bin/sh# or die "$! (in '$entry{header}')";
   print SHELL $script;
+ # TODO: s/warn/die/ in the $MAY_COMMIT case? (since we don't know
+ # whether to update @MERGES_TODAY)
   close SHELL or warn "$0: sh($?): $! (in '$entry{header}')";
   $ERRORS{$entry{id}} = [\%entry, "sh($?): $!"] if $?;
 
]]]

> Daniel
>
> P.S. It would be a good idea to have some sort of test suite for
> backport.pl...
Received on 2014-04-17 13:26:30 CEST

This is an archived mail posted to the Subversion Dev mailing list.

This site is subject to the Apache Privacy Policy and the Apache Public Forum Archive Policy.