You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@subversion.apache.org by da...@apache.org on 2013/07/09 02:18:11 UTC

svn commit: r1501029 - /subversion/trunk/tools/dist/backport.pl

Author: danielsh
Date: Tue Jul  9 00:18:10 2013
New Revision: 1501029

URL: http://svn.apache.org/r1501029
Log:
backport.pl: Grow a 'Depends:' syntax so that the conflicts bot doesn't stay
red when a nomination depends on another nomination.

* tools/dist/backport.pl
  (parse_entry): Recognize a 'Depends:' header.  For now, don't parse the
    value (we may parse the value in the future).
  (handle_entry): Adjust stdout/stderr output in conflict-finding mode to take
    account of ->{depends} information.
    While here, also have the summary display the list of conflicted files, in
    anticipation of Greg writing something that consumes these summaries.

Modified:
    subversion/trunk/tools/dist/backport.pl

Modified: subversion/trunk/tools/dist/backport.pl
URL: http://svn.apache.org/viewvc/subversion/trunk/tools/dist/backport.pl?rev=1501029&r1=1501028&r2=1501029&view=diff
==============================================================================
--- subversion/trunk/tools/dist/backport.pl (original)
+++ subversion/trunk/tools/dist/backport.pl Tue Jul  9 00:18:10 2013
@@ -267,6 +267,7 @@ sub sanitize_branch {
 sub parse_entry {
   my $raw = shift;
   my @lines = @_;
+  my $depends;
   my (@revisions, @logsummary, $branch, @votes);
   # @lines = @_;
 
@@ -295,6 +296,10 @@ sub parse_entry {
   unshift @votes, pop until $_[-1] =~ /^\s*Votes:/ or not defined $_[-1];
   pop;
 
+  # depends
+  # TODO: parse the value of this.
+  $depends = grep /^Depends:/, @_;
+
   # branch
   while (@_) {
     shift and next unless $_[0] =~ s/^\s*Branch(es)?:\s*//;
@@ -309,11 +314,13 @@ sub parse_entry {
   $id = $branch                    if $branch;
   warn "No header for [@lines]" unless $header;
 
+  warn "$id: depends=$depends\n";
   return (
     revisions => [@revisions],
     logsummary => [@logsummary],
     branch => $branch,
     header => $header,
+    depends => $depends,
     id => $id,
     votes => [@votes],
     entry => [@lines],
@@ -512,12 +519,19 @@ sub handle_entry {
         # Scan-for-conflicts mode
         merge %entry;
 
-        my $output;
-        if (($output = `$SVN status`) =~ /^(C|.C|...C)/m) {
-          $ERRORS{$entry{id}} //= "Conflicts merging the $entry{header}!";
+        my $output = `$SVN status`;
+        my (@conflicts) = ($output =~ m#^(?:C|.C|...C).*/(.*)#mg);
+        if (@conflicts and !$entry{depends}) {
+          $ERRORS{$entry{id}} //= "Conflicts merging the $entry{header}: "
+                                  . (join ', ', @conflicts);
           say STDERR "Conflicts merging the $entry{header}!";
           say STDERR "";
           say STDERR $output;
+        } elsif (!@conflicts and $entry{depends}) {
+          warn "No conflicts merging the $entry{header}, but conflicts were "
+              ."expected ('Depends:' header set)\n";
+        } elsif (@conflicts) {
+          say "Conflicts found merging $entry{id}, as expected.";
         }
         revert;
       }