Author: danielsh
Date: Thu Aug 8 09:11:34 2013
New Revision: 1511636
URL: http://svn.apache.org/r1511636
Log:
nominate.pl: optionally revert STATUS when done.
* tools/dist/backport.pl
(check_local_mods_to_STATUS): New sub, factored out from..
(backport_main): .. here.
(nominate_main): Check for local mods.
Offer to revert STATUS if not committing.
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=1511636&r1=1511635&r2=1511636&view=diff
==============================================================================
--- subversion/trunk/tools/dist/backport.pl (original)
+++ subversion/trunk/tools/dist/backport.pl Thu Aug 8 09:11:34 2013
@@ -535,6 +535,17 @@ sub vote {
}
}
+sub check_local_mods_to_STATUS {
+ if (`$SVN status -q $STATUS`) {
+ die "Local mods to STATUS file $STATUS" if $YES;
+ warn "Local mods to STATUS file $STATUS";
+ system "$SVN diff -- $STATUS";
+ prompt "Press the 'any' key to continue...\n", dontprint => 1;
+ return 1;
+ }
+ return 0;
+}
+
sub revert {
copy $STATUS, "$STATUS.$$.tmp";
system "$SVN revert -q $STATUS";
@@ -779,12 +790,7 @@ sub backport_main {
system("$SVN info $STATUS >/dev/null") == 0
or die "$0: svn error; point \$SVN to an appropriate binary";
- if (`$SVN status -q $STATUS`) {
- die "Local mods to STATUS file $STATUS" if $YES;
- warn "Local mods to STATUS file $STATUS";
- system "$SVN diff -- $STATUS";
- prompt "Press the 'any' key to continue...\n", dontprint => 1;
- }
+ check_local_mods_to_STATUS;
# Skip most of the file
$/ = ""; # paragraph mode
@@ -830,9 +836,12 @@ sub backport_main {
}
sub nominate_main {
+ my $had_local_mods;
local $Text::Wrap::columns = 79;
+ $had_local_mods = check_local_mods_to_STATUS;
+
# Argument parsing.
nominate_usage, exit 0 if @ARGV != 2;
my (@revnums) = (+shift) =~ /(\d+)/g;
@@ -888,6 +897,11 @@ sub nominate_main {
system "$SVN commit -m 'Nominate r$revnums[0].' -- $STATUS";
exit $?;
}
+ elsif (!$had_local_mods or prompt "Revert STATUS (destroying local mods)? ")
{
+ # TODO: we could be smarter and just un-splice the lines we'd added.
+ system "$SVN revert -- $STATUS";
+ exit $?;
+ }
exit 0;
}