[svn.haxx.se] · SVN Dev · SVN Users · SVN Org · TSVN Dev · TSVN Users · Subclipse Dev · Subclipse Users · this month's index

[PATCH] part of issue #897: errors could be better.

From: Erik Huelsmann <e.huelsmann_at_gmx.net>
Date: 2003-11-09 21:30:09 CET

Ok. As promised, here is the patch which only selectively prints the general
error message. Some tests had to be adapted because they depend on the
general error being in the reported output.

bye,

Erik.
PS: The patch is also available at:
http://encorps.dnsalias.com/patches/897-no-general-on-specific-error.patch

Log:
[[[
Change reported errors (cf issue #897) to show only the specific
message if one is supplied, in favor of printing both - almost
equal - general and specific messages.

* subversion/libsvn_subr/error.c
  (svn_handle_error): Print either the specific or the general
  message

* subversion/tests/clients/cmdline/commit_tests.py
* subversion/tests/clients/cmdline/diff_tests.py
* subversion/tests/clients/cmdline/switch_tests.py
* subversion/tests/clients/cmdline/update_tests.py
  Change checks which depend on the general error message
  to check for the specific one.

]]]

Index: subversion/libsvn_subr/error.c
===================================================================
--- subversion/libsvn_subr/error.c (revision 7680)
+++ subversion/libsvn_subr/error.c (working copy)
@@ -245,7 +245,10 @@
 #endif /* SVN_DEBUG */
   
   /* Only print the same APR error string once. */
- if (print_strerror)
+ if (err->message)
+ fprintf (stream, "svn: %s\n",
+ convert_string_for_output (err->message, err->pool));
+ else if (print_strerror)
     {
       /* Is this a Subversion-specific error code? */
       if ((err->apr_err > APR_OS_START_USEERR)
@@ -258,9 +261,6 @@
 
       fprintf (stream, "svn: %s\n", err_string);
     }
- if (err->message)
- fprintf (stream, "svn: %s\n",
- convert_string_for_output (err->message, err->pool));
 }
 
 void
Index: subversion/tests/clients/cmdline/diff_tests.py
===================================================================
--- subversion/tests/clients/cmdline/diff_tests.py (revision 7680)
+++ subversion/tests/clients/cmdline/diff_tests.py (working copy)
@@ -526,8 +526,11 @@
   # error message. The appropriate response is a few lines of errors. I
wish
   # there was a way to figure out if svn crashed, but all run_svn gives us
is
   # the output, so here we are...
- if len(err_output) <= 1: raise svntest.Failure
-
+ for line in err_output:
+ if re.search("foo' is not a versioned resource$", line):
+ break
+ else:
+ raise svntest.Failure
   
 # test 9
 def diff_pure_repository_update_a_file(sbox):
@@ -777,8 +780,9 @@
   diff_output, err_output = svntest.main.run_svn(1, 'diff',
                                                  '--old', non_extant_url,
                                                  '--new', extant_url)
+
   for line in err_output:
- if re.match('svn: Filesystem has no item$', line):
+ if re.search('was not found in the repository at revision', line):
       break
   else:
     raise svntest.Failure
@@ -787,7 +791,7 @@
                                                  '--old', extant_url,
                                                  '--new', non_extant_url)
   for line in err_output:
- if re.match('svn: Filesystem has no item$', line):
+ if re.search('was not found in the repository at revision', line):
       break
   else:
     raise svntest.Failure
Index: subversion/tests/clients/cmdline/update_tests.py
===================================================================
--- subversion/tests/clients/cmdline/update_tests.py (revision 7680)
+++ subversion/tests/clients/cmdline/update_tests.py (working copy)
@@ -686,7 +686,7 @@
     "Updating failed", None, SVNAnyOutput, 'up', wc_dir)
 
   for line in errput:
- if re.match(".*Obstructed update.*", line):
+ if re.match("svn: failed to delete file 'alpha'", line):
       return
 
   # Else never matched the expected error output, so the test failed.
@@ -942,7 +942,7 @@
   for n in range(2):
     out, err = svntest.main.run_svn(1, 'up', wc_dir)
     for line in err:
- if line.find("Obstructed update") != -1:
+ if line.find("object of the same name already exists") != -1:
         break
     else:
       raise svntest.Failure
Index: subversion/tests/clients/cmdline/commit_tests.py
===================================================================
--- subversion/tests/clients/cmdline/commit_tests.py (revision 7680)
+++ subversion/tests/clients/cmdline/commit_tests.py (working copy)
@@ -484,7 +484,7 @@
   svntest.actions.run_and_verify_commit (wc_dir,
                                          None,
                                          None,
- "Can't find an entry",
+ r'.* is not a versioned
resource$',
                                          None, None,
                                          None, None,
                                          os.path.join(wc_dir,'blorg'))
@@ -1356,7 +1356,7 @@
   svntest.actions.run_and_verify_commit(wc_dir,
                                         None,
                                         None,
- 'already-locked',
+ 'svn: working copy locked: ',
                                         None, None,
                                         None, None,
                                         wc_dir)
Index: subversion/tests/clients/cmdline/switch_tests.py
===================================================================
--- subversion/tests/clients/cmdline/switch_tests.py (revision 7680)
+++ subversion/tests/clients/cmdline/switch_tests.py (working copy)
@@ -178,10 +178,11 @@
   # Try to commit. We expect this to fail because, if all the
   # switching went as expected, A/B/pi and A/D/G/pi point to the
   # same URL. We don't allow this.
- svntest.actions.run_and_verify_commit(wc_dir, None, None,
- "commit to a URL more than once",
- None, None, None, None,
- wc_dir)
+ svntest.actions.run_and_verify_commit(
+ wc_dir, None, None,
+ "svn: Cannot commit both .* as they refer to the same URL.$",
+ None, None, None, None,
+ wc_dir)
 
   # Okay, that all taken care of, let's revert the A/D/G/pi path and
   # move along. Afterward, we should be okay to commit. (Sorry,

-- 
NEU FÜR ALLE - GMX MediaCenter - für Fotos, Musik, Dateien...
Fotoalbum, File Sharing, MMS, Multimedia-Gruß, GMX FotoService
Jetzt kostenlos anmelden unter http://www.gmx.net
+++ GMX - die erste Adresse für Mail, Message, More! +++
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Received on Sun Nov 9 21:30:54 2003

This is an archived mail posted to the Subversion Dev mailing list.