...
> --- 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)
> +
We don't really need to relocate the definition of this function
within the source file.
...
> @@ -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
There's no reason to prepend NAME if we're using error(), since that
function handles the prepending for us.
> + 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)
Is a control-c really an error? I'd certainly rather see this output
on stdout than stderr.
--
Daniel Rall
- application/pgp-signature attachment: stored
Received on Fri Mar 31 20:27:38 2006