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

Re: svn_wc_status suggestion

From: Yoshiki Hayashi <yoshiki_at_xemacs.org>
Date: 2001-10-19 06:32:50 CEST

Ben Collins-Sussman <sussman@collab.net> writes:

> What do you mean by "file not under version control"?
> Do you mean
>
> * running svn_wc_status() on a file that is not mentioned in any
> entries file?
>
> * running svn_wc_status() on a file that is only scheduled for
> addition?
>
> Looking at the code for svn_wc_status(), it appears that in the first
> case the function (indeed) returns an error.

The former. Strangely, it does not return an error.
Instead, it returns svn_status_t with status->entry == NULL.
Sorry for not being clear. I wrongly assumed that everyone
read the comment below in svn_status_t recently. I guess I
need --verbose flag. :-)

svn_wc_entry_t *entry; /* Can be NULL if not under vc. */

> > I'd like to have svn_status_t with NULL entry instead of
> > error because that's what I get with non version controlled
> > file. Even if returning error is preferred, I think
> > different error should be used because
> > SVN_WC_OBSTRUCTED_UPDATE is returned by svn_wc_entry and
> > it does not describe what's happened.
>
> True, it's a bad error value to return. I suppose that we could make
> svn_wc_status return NULL (instead of an error) if the path is not
> under version control. Then the caller could create an error if it
> wishes. (I know the command-line client would want to do that.)

I got up today, gave more thought about this, and changed my
mind. Instead of not returning an error, I suggest creating
a new error, say SVN_WC_NOT_VERSIONED, and return it if a
given file or directory is not under version control.

Current behavior is (in pseudo code):

touch new-file
svn_wc_status(&status, new-file)
-> Returns SVN_NO_ERROR
   status points to a valid svn_status_t with status->entry == NULL

mkdir new-dir
svn_wc_status(&status, new-dir)
-> Returns SVN_WC_OBSTRUCTED_UPDATE
   status is unchanged

New behavior:

Both returns SVN_WC_NOT_VERSIONED with status unchanged.

If it is OK, I'll write a patch. Then I'll experiment more
and see what I can do to solve issue #491.

> I'm confused, because it sounds like you're planning to make your GUI
> client run svn_wc_status() on every single file it can find.
> Shouldn't you be running svn_wc_statuses() on a single path (with the
> verbose flag) and get back a list of all things under version control?

Yes, I first used svn_wc_status (and/or svn_client_status).
Then I found that locally added (not svn add'ed) files and
directories do not show up if I used those functions. So I
temprarily switched to do svn_wc_status on every file in a
directory and found this behavior. (Of course it doesn't
show svn_wc_status_absent or svn_wc_status_delete entries so
I should use different method.)

-- 
Yoshiki Hayashi
---------------------------------------------------------------------
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:45 2006

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