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

Re: new bite-sized task, issue #598

From: Owen Landgren <olandgren_at_Macalester.edu>
Date: 2002-01-10 22:06:15 CET

Sorry about that... Here's an updated patch which compiles cleanly --
However, the error message isn't being thrown, which I'm a little
confused about. Suggestions/flames/quit sending me this crap?

* cl.h (svn_cl__print_status_list) Change the type of the function to
return an svn_error_t *

Index: ./cl.h
===================================================================
--- ./cl.h
+++ ./cl.h Thu Jan 10 14:43:42 2002
@@ -212,7 +212,8 @@
 
    If SKIP_UNRECOGNIZED is TRUE, this function will not print out
    unversioned items found in the working copy. */
-void svn_cl__print_status_list (apr_hash_t *statushash,
+svn_error_t *
+svn_cl__print_status_list (apr_hash_t *statushash,
                                 svn_revnum_t youngest,
                                 svn_boolean_t detailed,
                                 svn_boolean_t skip_unrecognized,

* status.c (svn_cl__print_status_list): Throw a SVN_ERR_BAD_FILENAME
when calling 'status' on a non-existant (as opposed to simply
non-VC'd) file.

Index: ./status.c
===================================================================
--- ./status.c
+++ ./status.c Thu Jan 10 14:42:16 2002
@@ -26,6 +26,7 @@
 #include "svn_sorts.h"
 #include "svn_wc.h"
 #include "svn_string.h"
+#include "svn_error.h"
 #include "cl.h"
 
 
@@ -187,7 +188,7 @@
 
 
 /* Called by status-cmd.c */
-void
+svn_error_t *
 svn_cl__print_status_list (apr_hash_t *statushash,
                            svn_revnum_t youngest,
                            svn_boolean_t detailed,
@@ -216,16 +217,32 @@
       if ((skip_unrecognized) && (! status->entry))
         continue;
 
- if (detailed)
- print_long_format (path, status);
+ if (status->text_status == svn_wc_status_none)
+ {
+ char message[35] = "svn status: file does not exist:";
+ char *response = apr_psprintf (pool, "%s %s\n", message, path);
+
+ return svn_error_create (SVN_ERR_BAD_FILENAME,
+ 0,
+ NULL,
+ pool,
+ response);
+ }
       else
- print_short_format (path, status);
+ {
+ if (detailed)
+ print_long_format (path, status);
+ else
+ print_short_format (path, status);
+ }
     }
 
   /* If printing in detailed format, we might have a head revision to
      print as well. */
   if (detailed && (youngest != SVN_INVALID_REVNUM))
     printf ("Head revision: %6ld\n", youngest);
+
+ return SVN_NO_ERROR;
 }
 
 

cmpilato@collab.net wrote:

>Owen Landgren <olandgren@Macalester.edu> writes:
>
>>@@ -216,10 +217,25 @@
>> if ((skip_unrecognized) && (! status->entry))
>> continue;
>>
>>- if (detailed)
>>- print_long_format (path, status);
>>+ if (status->text_status == svn_wc_status_none)
>>+ {
>>+ char *message = "svn status: file does not exist:";
>>+ char *response = NULL;
>>+ sprintf (response, "%s %s\n", message, path);
>>
>
>Ouch. Not a good idea to go printing characters into unallocated
>memory! sprintf is generally bad for Subversion's purposes. Use
>apr_psprintf so we can allocate as necessary from the pool.
>
>

Index: ./cl.h
===================================================================
--- ./cl.h
+++ ./cl.h Thu Jan 10 14:43:42 2002
@@ -212,7 +212,8 @@
 
    If SKIP_UNRECOGNIZED is TRUE, this function will not print out
    unversioned items found in the working copy. */
-void svn_cl__print_status_list (apr_hash_t *statushash,
+svn_error_t *
+svn_cl__print_status_list (apr_hash_t *statushash,
                                 svn_revnum_t youngest,
                                 svn_boolean_t detailed,
                                 svn_boolean_t skip_unrecognized,
Index: ./status.c
===================================================================
--- ./status.c
+++ ./status.c Thu Jan 10 14:42:16 2002
@@ -26,6 +26,7 @@
 #include "svn_sorts.h"
 #include "svn_wc.h"
 #include "svn_string.h"
+#include "svn_error.h"
 #include "cl.h"
 
 
@@ -187,7 +188,7 @@
 
 
 /* Called by status-cmd.c */
-void
+svn_error_t *
 svn_cl__print_status_list (apr_hash_t *statushash,
                            svn_revnum_t youngest,
                            svn_boolean_t detailed,
@@ -216,16 +217,32 @@
       if ((skip_unrecognized) && (! status->entry))
         continue;
 
- if (detailed)
- print_long_format (path, status);
+ if (status->text_status == svn_wc_status_none)
+ {
+ char message[35] = "svn status: file does not exist:";
+ char *response = apr_psprintf (pool, "%s %s\n", message, path);
+
+ return svn_error_create (SVN_ERR_BAD_FILENAME,
+ 0,
+ NULL,
+ pool,
+ response);
+ }
       else
- print_short_format (path, status);
+ {
+ if (detailed)
+ print_long_format (path, status);
+ else
+ print_short_format (path, status);
+ }
     }
 
   /* If printing in detailed format, we might have a head revision to
      print as well. */
   if (detailed && (youngest != SVN_INVALID_REVNUM))
     printf ("Head revision: %6ld\n", youngest);
+
+ return SVN_NO_ERROR;
 }
 
 

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Received on Sat Oct 21 14:36:55 2006

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

This site is subject to the Apache Privacy Policy and the Apache Public Forum Archive Policy.