[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: Ben Collins-Sussman <sussman_at_collab.net>
Date: 2002-12-06 14:40:54 CET

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.

> 'svn stat -u' on a file that has been added but not committed gives an
> error:
>
> % svn stat added
> A added
> % svn stat -u added
> svn: Filesystem has no item
> svn: file not found: transaction `d', path `/trunk'

Ah, this is a bug as well. The -u flag is doing a dry-run of "svn
update added" under the hood. And as expected, the server says that
the item is not found in the repository. I suspect that 'svn status'
should specifically trap this error and ignore it... i.e. just not add
any additional out-of-date info. 'svn stat added' and 'svn -u added'
would print just "A" in this case.

> I can see how from a certain point of view this is accurate, since the
> file doesn't exist on the server. However, I can't see how this is
> useful to a human or script trying to use 'svn stat -u'. In
> particular, it doesn't tell you about the case where a file has been
> added and committed in another revision.

Huh? I'm not following your last sentence. The -u flag means, "add
out-of-date information." If somebody else has already added a file
by the same name, then the filesystem will see it, and status will
show:

% svn stat added
A * 0 newfile

The asterisk means that your file, even though it's only scheduled for
addition, is already out-of-date. Somebody beat you to the punch.

> It is somewhat confusing that 'svn stat -u' doesn't give a "superset"
> of the information from 'svn stat', but rather different information.
> As far as I can see, this means that something like vc-svn needs to
> run both 'svn stat' and 'svn stat -u' to properly handle the case of
> files being added and also to discover out-of-date files.

Again, I'm not understanding the problem. 'svn st' has exactly three
output formats. It took no less than two months of list discussion to
design this. :-)

1. 'svn st' only shows local items that are interesting. It uses the
   "short" format: the standard 5 columns (MMLS+) and a pathname.

2. 'svn st -u' shows local items that are interesting, and adds
   out-of-date information. It uses the "medium" format: the
   standard 5 columns, an out-of-date (*) column, a working-rev
   column, and a pathname.

3. 'svn st -v' shows every single item, interesting or not. It uses
   the "long" format: standard 5 columns, out-of-date column (if -u
   was given), working-rev, last-changed-rev, last-author, pathname.

This is all documented in 'svn help status'.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Received on Fri Dec 6 14:44:43 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.