[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 09:15:30 CET

It didn't seem like Joseph was awake, so I figured that this was an even
tinier piece I could try. Blow me out of the water if it's not right. I
just touched things up by including error and using the code for a bad
filename.

* status.c (svn_cl__print_status_list): Throw an error when the user
attempts to
   call 'svn status' on a non-existant (as opposed to merely non-VC'd) file.

Index: ./status.c
===================================================================
--- ./status.c
+++ ./status.c Thu Jan 10 02:02:20 2002
@@ -26,6 +26,7 @@
 #include "svn_sorts.h"
 #include "svn_wc.h"
 #include "svn_string.h"
+#include "svn_error.h"
 #include "cl.h"
 
 
@@ -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);
+
+ 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

cmpilato@collab.net wrote:

>Joseph Dane <jdane@studio3511.com> writes:
>
>>this is my first subversion patch submission. I appreciate any and
>>all comments, suggestions, flames, etc.
>>
>
>You betcha.
>
>>Index: ./status.c
>>===================================================================
>>--- ./status.c
>>+++ ./status.c Wed Jan 9 14:33:55 2002
>>@@ -216,10 +216,15 @@
>> if ((skip_unrecognized) && (! status->entry))
>> continue;
>>
>>- if (detailed)
>>- print_long_format (path, status);
>>- else
>>- print_short_format (path, status);
>>+ if (status->text_status == svn_wc_status_none)
>>+ printf("file does not exist: %s\n", path);
>>
>
>Just a couple of comments here.
>
>First, a minor coding style nit. This file uses spaces between
>function calls and '('. That is, it should be 'printf ("file...' just
>as you've got it for the rest of your patch.
>
>Secondly, we generally don't print error-ish conditions to the
>terminal. Perhaps we should either print nothing for files that don't
>exist, or return an appropriate "no such path" svn_error_t.
>
>Whatcha think?
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
>For additional commands, e-mail: dev-help@subversion.tigris.org
>
>
Owen

Index: ./status.c
===================================================================
--- ./status.c
+++ ./status.c Thu Jan 10 02:02:20 2002
@@ -26,6 +26,7 @@
 #include "svn_sorts.h"
 #include "svn_wc.h"
 #include "svn_string.h"
+#include "svn_error.h"
 #include "cl.h"
 
 
@@ -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);
+
+ 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

---------------------------------------------------------------------
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.