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

Re: svn info not setting exit status.

From: Henrik Sundberg <storangen_at_gmail.com>
Date: Tue, 20 May 2008 21:06:15 +0200

2008/5/20 Karl Fogel <kfogel_at_red-bean.com>:
> [I'm cross-posting this to dev@, because the behavior might be a bug.]
>
> "Mark E. Hamilton" <mhamilt_at_sandia.gov> writes:
>> I'm trying to check to see if a path exists in my repository or
>> not. However, when I use 'svn info' on an invalid URL it does not set
>> the exit status to a non-zero value as I expected.

Having the same need, and using pysvn I get:
        try:
            inf = client.info2("%s/%s" % (url, sf), recurse=False)
        except:
            client.mkdir("%s/%s" % (url, sf), "Setting up a root for %s" % sf)
            client.mkdir("%s/%s/branches" % (url, sf), "Adding branches")
            client.mkdir("%s/%s/tags" % (url, sf), "Adding tags")
            client.mkdir("%s/%s/trunk" % (url, sf), "Adding trunk")

I though that was ugly, I wanted to say:
        if not client.is_url("%s/%s" % (url, sf)):
            client.mkdir("%s/%s" % (url, sf), "Setting up a root for %s" % sf)
            ...
But that doesn't work, since is_url returns True if the first part of
url matches a repository.

In the shell you'll have to settle for return codes.
Would it be better to have a special command, instead of using a side
effect of the info-command?

> In order to make the multi-target behavior work, we decided that a
> non-existent target shouldn't cause svn to bail out, but should instead
> print a warning and then continue to the next target.
<snip>

> We definitely should continue the loop even in case of error, so we try
> every target. But when we do exit, should it be a non-zero exit code if
> any target received an error? Currently, we exit with zero.

In the case of the OP there is only need to check one url a time.
This ought to be a common need.
If only one url is given and that one doesn't exist, then it ought to
be ok with an error. Wouldn't it?

This could be extended to: Fail if all targets are missing.

/$

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe_at_subversion.tigris.org
For additional commands, e-mail: dev-help_at_subversion.tigris.org
Received on 2008-05-20 21:57:19 CEST

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.