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

Re: svn stat on new files

From: Matt Kraai <kraai_at_alumni.cmu.edu>
Date: 2002-12-06 20:38:26 CET

On Fri, Dec 06, 2002 at 02:03:03PM +0000, Philip Martin wrote:
> Ben Collins-Sussman <sussman@collab.net> writes:
>
> > Martin Pool <mbp@sngrel5.hp.com> writes:
> >
> > > People might call 'svn stat' on a file that doesn't exist yet. For
> > > example, vc-svn (as currently designed) does this when you open a new
> > > file in a directory that is controlled by Subversion. At the moment,
> > > svn stat prints gives a blank status, as if the file was up to date,
> > > which is misleading. It seems to me that it would be better for it to
> > > either print '?', or at least give an error.
> >
> > I agree, 'svn stat nonexistent-file' should give an error. It's a bug
> > that it prints the filename instead... it makes no sense. We should
> > file an issue on that.
>
> I prefer Martin's suggestion that it print '?'. If the file does not
> exist, and does not have a .svn entry, then it is not under revision
> control and '?' is the right status. (If it does have a .svn entry
> then '!' will be dispayed.) I also suspect it will make 'svn status'
> easier to use if it doesn't generate an error in this case.

Here is a patch which does so. OK to commit?

Matt

* subversion/libsvn_wc/status.c
  (assemble_status): Set the text_status to svn_wc_status_unversioned
  for a non-extant file.

Index: subversion/libsvn_wc/status.c
===================================================================
--- subversion/libsvn_wc/status.c (revision 4008)
+++ subversion/libsvn_wc/status.c (working copy)
@@ -133,7 +133,7 @@
       /* return a blank structure. */
       stat = apr_pcalloc (pool, sizeof(*stat));
       stat->entry = NULL;
- stat->text_status = svn_wc_status_none;
+ stat->text_status = svn_wc_status_unversioned;
       stat->prop_status = svn_wc_status_none;
       stat->repos_text_status = svn_wc_status_none;
       stat->repos_prop_status = svn_wc_status_none;
@@ -141,18 +141,10 @@
       stat->copied = FALSE;
       stat->switched = FALSE;
 
- /* If this path has no entry, but IS present on disk, it's
- unversioned. If this file is being explicitly ignored (due
- to matching an ignore-pattern), the text_status is set to
- svn_wc_status_none. Otherwise the text_status is set to
- svn_wc_status_unversioned. */
- if (path_kind != svn_node_none)
- {
- if (is_ignored)
- stat->text_status = svn_wc_status_none;
- else
- stat->text_status = svn_wc_status_unversioned;
- }
+ /* If this file is being explicitly ignored (due to matching an
+ ignore-pattern), the text_status is set to svn_wc_status_none. */
+ if (is_ignored)
+ stat->text_status = svn_wc_status_none;
 
       *status = stat;
       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 Fri Dec 6 20:34:59 2002

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.