You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@subversion.apache.org by hw...@apache.org on 2012/03/14 17:48:20 UTC

svn commit: r1300633 - /subversion/trunk/subversion/tests/cmdline/svntest/actions.py

Author: hwright
Date: Wed Mar 14 16:48:20 2012
New Revision: 1300633

URL: http://svn.apache.org/viewvc?rev=1300633&view=rev
Log:
Log several fatal errors as such using the logging module.

* subversion/tests/cmdline/svntest/actions.py
  (setup_pristine_greek_repository, guarantee_empty_repository,
   guarantee_greek_repository): Replace print statements with logger.error()
    calls.

Modified:
    subversion/trunk/subversion/tests/cmdline/svntest/actions.py

Modified: subversion/trunk/subversion/tests/cmdline/svntest/actions.py
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/tests/cmdline/svntest/actions.py?rev=1300633&r1=1300632&r2=1300633&view=diff
==============================================================================
--- subversion/trunk/subversion/tests/cmdline/svntest/actions.py (original)
+++ subversion/trunk/subversion/tests/cmdline/svntest/actions.py Wed Mar 14 16:48:20 2012
@@ -24,14 +24,22 @@
 ######################################################################
 
 import os, shutil, re, sys, errno
-import difflib, pprint
+import difflib, pprint, logging
 import xml.parsers.expat
 from xml.dom.minidom import parseString
+if sys.version_info[0] >= 3:
+  # Python >=3.0
+  from io import StringIO
+else:
+  # Python <3.0
+  from cStringIO import StringIO
 
 import svntest
 from svntest import main, verify, tree, wc
 from svntest import Failure
 
+logger = logging.getLogger()
+
 def no_sleep_for_timestamps():
   os.environ['SVN_I_LOVE_CORRUPTED_WORKING_COPIES_SO_DISABLE_SLEEP_FOR_TIMESTAMPS'] = 'yes'
 
@@ -84,9 +92,9 @@ def setup_pristine_greek_repository():
     lastline = output.pop().strip()
     match = re.search("(Committed|Imported) revision [0-9]+.", lastline)
     if not match:
-      print("ERROR:  import did not succeed, while creating greek repos.")
-      print("The final line from 'svn import' was:")
-      print(lastline)
+      logger.error("import did not succeed, while creating greek repos.")
+      logger.error("The final line from 'svn import' was:")
+      logger.error(lastline)
       sys.exit(1)
     output_tree = wc.State.from_commit(output)
 
@@ -117,7 +125,7 @@ def guarantee_empty_repository(path):
   nothing."""
 
   if path == main.pristine_greek_repos_dir:
-    print("ERROR:  attempt to overwrite the pristine repos!  Aborting.")
+    logger.error("attempt to overwrite the pristine repos!  Aborting.")
     sys.exit(1)
 
   # create an empty repository at PATH.
@@ -134,13 +142,13 @@ def guarantee_greek_repository(path, min
   nothing but the greek-tree at revision 1."""
 
   if path == main.pristine_greek_repos_dir:
-    print("ERROR:  attempt to overwrite the pristine repos!  Aborting.")
+    logger.error("attempt to overwrite the pristine repos!  Aborting.")
     sys.exit(1)
 
   # copy the pristine repository to PATH.
   main.safe_rmtree(path)
   if main.copy_repos(main.pristine_greek_repos_dir, path, 1, 1, minor_version):
-    print("ERROR:  copying repository failed.")
+    logger.error("copying repository failed.")
     sys.exit(1)
 
   # make the repos world-writeable, for mod_dav_svn's sake.