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

Re: Return value of "svn info"

From: Stefan Sperling <stsp_at_elego.de>
Date: Fri, 23 Oct 2009 10:09:34 +0200

On Thu, Oct 22, 2009 at 09:46:48PM -0500, Jake Stone wrote:
> > On Oct 22, 2009, at 5:31 PM, Stefan Sperling wrote:
> >> $ svn info foo
> >> svn: The node '/home/stsp/svn/svn-trunk/foo' was not found.
> >> $ echo $?
> >> 1
> >>
> That example shows it returning 1 on a NON-working-copy, which is what I
> want.

Ah, OK.
I misread your question. I thought you said you wanted to know
whether you were inside a working copy directory and then have your
script do <something>, and if svn info could under any conditions
return a non-zero exit code when doing <something> inside this directory.
So yeah, if you're fine with it exiting 1 on unversioned items within
a working copy directory, then my example does not apply to you.

> My question was more of will it return 1 (or any non-zero value) when
> the target IS a working copy, but some other error occurs.

It's definitely possible. There are many error conditions the code
is checking for, and it raises fatal errors in some conditions which
would cause the client to exit 1.

For example (from libsvn_client/info.c):

          /* Otherwise, we really are stuck. Better tell the user
             what's going on. */
          return svn_error_createf(SVN_ERR_UNSUPPORTED_FEATURE, NULL,
                                   _("Server does not support retrieving "
                                     "information about the repository root"));
        }

      SVN_ERR(svn_ra_check_path(ra_session, "", rev, &url_kind, pool));
      if (url_kind == svn_node_none)
        return svn_error_createf(SVN_ERR_RA_ILLEGAL_URL, NULL,
                                 _("URL '%s' non-existent in revision %ld"),
                                 url, rev);

Any such call to svn_error_create* in the code path of svn info can
potentially trigger an exit 1. That's the best answer I can give you.
To get a better answer, e.g. a list of conditions under which it will
exit 1, someone would have to read the code and make such a list.
And keep it in sync it with future changes we make.

Stefan

------------------------------------------------------
http://subversion.tigris.org/ds/viewMessage.do?dsForumId=1065&dsMessageId=2410556

To unsubscribe from this discussion, e-mail: [users-unsubscribe_at_subversion.tigris.org].
Received on 2009-10-23 10:10:43 CEST

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

This site is subject to the Apache Privacy Policy and the Apache Public Forum Archive Policy.