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

backport.pl += 'merge --accept=%s' arguments

From: Daniel Shahaf <d.s_at_daniel.shahaf.name>
Date: Sun, 9 Dec 2012 00:23:29 +0200

This is a patch to parse "Accept:" directives in STATUS, e.g.,

[[[
 * r42
   Some text.
   Accept: theirs-conflict
   Votes:
     +1: jrandom
]]]

It's not tested yet, hence sending it to dev@ and not commits@.
(Basically, putting it here while waiting for an STATUS entry to try the
code on.)

Thanks to Ben for making me finally put this one to code. :-)

Daniel

[[[
Teach backport.pl to pass --accept=%s to 'svn merge'.

* tools/dist/backport.pl
  (parse_entry): Parse "Accept: %s" headers.
  (handle_entry): Propagate them.
  (merge): Pass --accept=%s to 'svn merge'.
]]]

[[[
Index: tools/dist/backport.pl
===================================================================
--- tools/dist/backport.pl (revision 1418755)
+++ tools/dist/backport.pl (working copy)
@@ -76,15 +76,16 @@ sub merge {
 
   my $backupfile = "backport_pl.$$.tmp";
 
+ $mergeargs = $entry{accept} ? "--accept=$entry{accept} " : "";
   if ($entry{branch}) {
     # NOTE: This doesn't escape the branch into the pattern.
     $pattern = sprintf '\V\(%s branch(es)?\|branches\/%s\|Branch(es)?:\n *%s\)', $entry{branch}, $entry{branch}, $entry{branch};
- $mergeargs = "--reintegrate $BRANCHES/$entry{branch}";
+ $mergeargs .= "--reintegrate $BRANCHES/$entry{branch}";
     print $logmsg_fh "Reintegrate the $entry{header}:";
     print $logmsg_fh "";
   } elsif (@{$entry{revisions}}) {
     $pattern = '^ [*] \V' . 'r' . $entry{revisions}->[0];
- $mergeargs = join " ", (map { "-c$_" } @{$entry{revisions}}), '^/subversion/trunk';
+ $mergeargs .= join " ", (map { "-c$_" } @{$entry{revisions}}), '^/subversion/trunk';
     if (@{$entry{revisions}} > 1) {
       print $logmsg_fh "Merge the $entry{header} from trunk:";
       print $logmsg_fh "";
@@ -153,7 +154,7 @@ sub sanitize_branch {
 # TODO: may need to parse other headers too?
 sub parse_entry {
   my @lines = @_;
- my (@revisions, @logsummary, $branch, @votes);
+ my ($accept, @revisions, @logsummary, $branch, @votes);
   # @lines = @_;
 
   # strip first three spaces
@@ -176,6 +177,11 @@ sub parse_entry {
   unshift @votes, pop until $_[-1] =~ /^\s*Votes:/ or not defined $_[-1];
   pop;
 
+ # accept
+ ($accept) = map { /^Accept: ([\w-]+)/ and $1 } @_;
+ warn "Invalid 'Accept' value '$accept'"
+ if $accept and `svn --accept=$accept 2>&1 >/dev/null` =~ /\Q'$accept'/;
+
   # branch
   while (@_) {
     shift and next unless $_[0] =~ s/^\s*Branch(es)?:\s*//;
@@ -195,6 +201,7 @@ sub parse_entry {
     header => $header,
     votes => [@votes],
     entry => [@lines],
+ accept => $accept,
   );
 }
 
@@ -211,6 +218,7 @@ sub handle_entry {
     print "$BRANCHES/$entry{branch}" if $entry{branch};
     print "";
     print for @{$entry{logsummary}};
+ print "Accept: $accept" if $accept;
     print "";
     print for @{$entry{votes}};
     print "";
]]]
Received on 2012-12-08 23:24:07 CET

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.