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 2014/06/28 15:42:32 UTC
svn commit: r1606352 - /subversion/trunk/tools/dist/backport.pl
Author: danielsh
Date: Sat Jun 28 13:42:32 2014
New Revision: 1606352
URL: http://svn.apache.org/r1606352
Log:
backport.pl: Improve documentation and handling of modes.
* tools/dist/backport.pl
(Mode::AutoCommitApproveds, Mode::Conflicts, Mode::Interactive):
New enumerators.
($MODE): New enum-valued global variable.
(backport_usage): Document "YES=0 MAY_COMMIT=1" interactive RM mode.
(handle_entry): Record a todo related to a workflow recommended by the new
usage message.
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=1606352&r1=1606351&r2=1606352&view=diff
==============================================================================
--- subversion/trunk/tools/dist/backport.pl (original)
+++ subversion/trunk/tools/dist/backport.pl Sat Jun 28 13:42:32 2014
@@ -43,11 +43,17 @@ my $EDITOR = $ENV{SVN_EDITOR} // $ENV{VI
my $PAGER = $ENV{PAGER} // 'less' // 'cat';
# Mode flags.
-# svn-role: YES=1 MAY_COMMIT=1 (plus '--renormalize')
-# conflicts-bot: YES=1 MAY_COMMIT=0
-# interactive: YES=0 MAY_COMMIT=0 (default)
+package Mode {
+ use constant {
+ AutoCommitApproveds => 1, # used by nightly commits (svn-role)
+ Conflicts => 2, # used by the hourly conflicts-detection buildbot
+ Interactive => 3,
+ };
+};
my $YES = ($ENV{YES} // "0") =~ /^(1|yes|true)$/i; # batch mode: eliminate prompts, add sleeps
my $MAY_COMMIT = ($ENV{MAY_COMMIT} // "false") =~ /^(1|yes|true)$/i;
+my $MODE = ($YES ? ($MAY_COMMIT ? Mode::AutoCommitApproveds : Mode::Conflicts )
+ : Mode::Interactive );
# Other knobs.
my $VERBOSE = 0;
@@ -152,6 +158,11 @@ y: Open a shell.
d: View a diff.
N: Move to the next entry.
+To commit a merge, you have two options: either answer 'y' to the second prompt
+to open a shell, and manually run 'svn commit' therein; or set \$MAY_COMMIT=1
+in the environment before running the script, in which case answering 'y'
+to the first prompt will not only run the merge but also commit it.
+
There is also a batch mode (normally used only by cron jobs and buildbot tasks,
rather than interactively): when \$YES and \$MAY_COMMIT are defined to '1' in
the environment, this script will iterate the "Approved:" section, and merge
@@ -852,6 +863,8 @@ sub handle_entry {
while (1) {
given (prompt "Shall I open a subshell? [ydN] ", verbose => 1) {
when (/^y/i) {
+ # TODO: if $MAY_COMMIT, save the log message to a file (say,
+ # backport.logmsg in the wcroot).
system($SHELL) == 0
or warn "Creating an interactive subshell failed ($?): $!"
}