Index: contrib/client-side/svnmerge.py =================================================================== --- contrib/client-side/svnmerge.py (revision 19109) +++ contrib/client-side/svnmerge.py (working copy) @@ -56,10 +56,14 @@ import sys, os, getopt, re, types, popen2, tempfile from bisect import bisect +def error(s): + """Subroutine to output an error and bail.""" + print >> sys.stderr, "%s: %s" % (NAME, s) + sys.exit(1) + NAME = "svnmerge" if not hasattr(sys, "version_info") or sys.version_info < (2, 0): - print "%s requires Python 2.0 or newer" % NAME - sys.exit(1) + error('requires Python 2.0 or newer') # Set up the separator used to separate individual log messages from # each revision merged into the target location. Also, create a @@ -177,11 +181,6 @@ # sensible default return 80 -def error(s): - """Subroutine to output an error and bail.""" - print >> sys.stderr, "%s: %s" % (NAME, s) - sys.exit(1) - def report(s): """Subroutine to output progress message, unless in quiet mode.""" if opts["verbose"]: @@ -757,13 +756,12 @@ changed = True if changed: - print "%s: old property values detected; an upgrade is required." % NAME - print - print 'Please execute and commit these changes to upgrade:' - print - print 'svn propset "%s" "%s" "%s"' % \ - (opts["prop"], format_merge_props(fixed), branch_dir) - sys.exit(1) + err_str = 'old property values detected; ' + err_str += 'an upgrade is required.\n\n' + err_str += 'Please execute and commit these changes to upgrade:\n\n' + err_str += 'svn propset "%s" "%s" "%s"' % \ + (opts["prop"], format_merge_props(fixed), branch_dir) + error(err_str) def analyze_revs(target_dir, url, begin=1, end=None, find_reflected=False): @@ -1629,11 +1627,12 @@ try: main(sys.argv[1:]) except LaunchError, (ret, cmd, out): - print "%s: command execution failed (exit code: %d)" % (NAME, ret) - print cmd - print "".join(out) - sys.exit(1) + err_str = '%s: command execution failed ' % NAME + err_str += '(exit code: %d)\n' % ret + err_str += cmd + '\n' + err_str += "".join(out) + error(err_str) except KeyboardInterrupt: # Avoid traceback on CTRL+C - print "aborted by user" - sys.exit(1) + err_str = "aborted by user" + error(err_str)