Login | Register
My pages Projects Community openCollabNet

Discussions > users [DISABLED] > Re: Return value of "svn info"

subversion
Discussion topic

Back to topic list

Re: Return value of "svn info"

Author stsp
Full name Stefan Sperling
Date 2009-10-23 01:09:45 PDT
Message 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(SV​N_ERR_UNSUPPORTED_FE​ATURE, 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(SV​N_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

« Previous message in topic | 9 of 14 | Next message in topic »

Messages

Show all messages in topic

Change the svnserve URL jborys <john_borys at comcast dot net> jborys <john_borys at comcast dot net> 2009-10-22 12:41:16 PDT
     Re: Change the svnserve URL ryandesign Ryan Schmidt 2009-10-22 13:43:35 PDT
         Return value of "svn info" Jake Stone <jake dot the dot stone at gmail dot com> Jake Stone <jake dot the dot stone at gmail dot com> 2009-10-22 15:14:02 PDT
             Re: Return value of "svn info" stsp Stefan Sperling 2009-10-22 15:31:43 PDT
                 Re: Return value of "svn info" hwright Hyrum K. Wright 2009-10-22 17:06:28 PDT
                     Re: Return value of "svn info" Jake Stone <jake dot the dot stone at gmail dot com> Jake Stone <jake dot the dot stone at gmail dot com> 2009-10-22 19:46:34 PDT
                         Re: Return value of "svn info" ryandesign Ryan Schmidt 2009-10-22 21:34:04 PDT
                             Re: Return value of "svn info" Jake Stone <jake dot the dot stone at gmail dot com> Jake Stone <jake dot the dot stone at gmail dot com> 2009-10-22 22:02:29 PDT
                         Re: Return value of "svn info" stsp Stefan Sperling 2009-10-23 01:09:45 PDT
         Re: Change the svnserve URL jborys <john_borys at comcast dot net> jborys <john_borys at comcast dot net> 2009-10-22 15:57:54 PDT
             Re: Change the svnserve URL ryandesign Ryan Schmidt 2009-10-22 16:11:20 PDT
                 Re: Change the svnserve URL jborys <john_borys at comcast dot net> jborys <john_borys at comcast dot net> 2009-10-22 16:23:52 PDT
                     Re: Change the svnserve URL ryandesign Ryan Schmidt 2009-10-22 16:37:27 PDT
                         Re: Change the svnserve URL jborys <john_borys at comcast dot net> jborys <john_borys at comcast dot net> 2009-10-22 17:30:42 PDT
Messages per page: