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

Re: svnversion on a file

From: Daniel Rall <dlr_at_collab.net>
Date: 2006-08-05 03:22:10 CEST

On Fri, 04 Aug 2006, David Glasser wrote:

> svnversion gives a misleading error message when given a versioned
> file as an argument, and "svnversion -h" only sort of implies that you
> aren't supposed to do this. Do other folks think this is a bug? I
> don't necessarily think svnversion should be bloated to give useful
> information for this, but perhaps the error message should be more
> like "'beep' is not a directory", and all the references to "path" in
> the help text should be "directory". I'd be happy to make a patch to
> do this if folks thought this was the right thing to do.
...
> $ ls -l beep
> -rw-r--r-- 1 glasser wheel 0 Aug 3 17:03 beep
> $ svn st -v beep
> 2 2 glasser beep
> $ svnversion beep
> 'beep' not versioned, and not exported
...

It's clearly wrong for 'svnversion' to say that your versioned "beep"
file isn't versioned. A quick fix would be to check to see whether
'svnversion' was passed a file argument on the command-line for
WC_PATH, and use its parent instead for that case.

This could affect subsequent error handling, but it does seem less
broken than the current state of affairs.

- Dan

[[[
Fix 'svnversion' from claiming that versioned files are not versioned.

* subversion/svnversion/main.c
  (main): Use parent dir if a file argument is passed on the
   command-line for WC_PATH.

Found by: David Glasser <glasser@mit.edu>
]]]

Index: subversion/svnversion/main.c
===================================================================
--- subversion/svnversion/main.c (revision 20984)
+++ subversion/svnversion/main.c (working copy)
@@ -111,6 +111,7 @@
   const char *wc_path, *trail_url;
   apr_allocator_t *allocator;
   apr_pool_t *pool;
+ svn_node_kind_t kind;
   int wc_format;
   svn_wc_revision_status_t *res;
   svn_boolean_t no_newline = FALSE, committed = FALSE;
@@ -219,10 +220,15 @@
   else
     trail_url = NULL;
 
+ /* As we only operate on directories, if we were passed a file on
+ the command-line, use its parent directory instead. */
+ SVN_INT_ERR(svn_io_check_path(wc_path, &kind, pool));
+ if (kind == svn_node_file)
+ wc_path = svn_path_dirname(wc_path, pool);
+
   SVN_INT_ERR(svn_wc_check_wc(wc_path, &wc_format, pool));
   if (! wc_format)
     {
- svn_node_kind_t kind;
       SVN_INT_ERR(svn_io_check_path(wc_path, &kind, pool));
       if (kind == svn_node_dir)
         {

  • application/pgp-signature attachment: stored
Received on Sat Aug 5 03:22:25 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.