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

Re: Incomplete xml output when using --xml to non-existent server

From: Naga Saketh Jaligama <saketh.vy1266_at_gmail.com>
Date: Thu, 3 Mar 2016 15:35:31 -0600

Hi All,

----------------

In my company, developers may use tortoise svn or eclipse svn or any svn
client, so no matter what they use i want to enforce them to give some
commit messages and jira id in it. so, i used the below pre-commit shell
script in the svn server in hooks folder and tested with tortoise, it
doesn't work. Can someone help me?

REPOS="$1"
TXN="$2"
SVNLOOK=/usr/bin/svnlook
CURL=/usr/bin/curl
JIRAURL=http://our.jira.url:8080/rest/api/latest/issue
# Make sure that the log message contains some text.
LOGMSG=$($SVNLOOK log -t "$TXN" "$REPOS")
echo ${LOGMSG} | grep "[a-zA-Z0-9]" > /dev/null || exit 1
check that log message starts with a JIRA ticket
should have format 'FOO-123: my commit message' or 'FOO-123 my commit
    message'
JIRAID=$(expr "${LOGMSG}" : '^\([A-Z]*-[0-9]*\)[: ].*')
 if [[ "$JIRAID" == "" ]]
then
echo "No JIRA id found in log message \"${LOGMSG}\"" >&2
echo "Please use log message of the form \"JIRA-ID: My message\"" >&2
exit 1
fi
JIRAISSUE=$(${CURL} ${JIRAURL}/${JIRAID})
if [[ "${JIRAISSUE}" =~ "Issue Does Not Exist" ]]
then
echo "The JIRA id ${JIRAID} was not found" >&2
echo "Please use log message of the form \"JIRA-ID: My message\"" >&2
exit 1
fi

----------------

On Thu, Mar 3, 2016 at 8:42 AM, Johan Corveleyn <jcorvel_at_gmail.com> wrote:

> On Thu, Mar 3, 2016 at 3:11 PM, Vincent Lefevre <vincent-svn_at_vinc17.net>
> wrote:
> > On 2016-03-03 10:31:52 +0100, Johan Corveleyn wrote:
> >> No, of course not :-). I just gave an example where the output was
> >> broken (host not found), as opposed to another error condition (server
> >> reponds "URL 'X' non-existent in revision Y") where the xml response
> >> is still valid. Ignoring implementation (which I always do when I'm
> >> arguing about behavior), this seems quite weird to me.
> >
> > No, this is different. In the former case, this is a server or
> > communication problem: it is not possible to output the info
> > because it is not possible to know what it is. In the latter case,
> > the communication is successful, so that it is possible to output
> > the info.
>
> Agreed, it's different. But it's still weird / inconsistent IMO.
>
> As I said, I don't know anything about the implementation of --xml,
> but it seems to me that svn could easily complete the output by
> closing the root element with "</info>". Apparently *something* goes
> wrong executing the info request ... let's just cleanup nicely.
>
> Another example, no server communication needed:
>
> [[[
> C:\>svn info --xml .
> <?xml version="1.0" encoding="UTF-8"?>
> <info>
> svn: E155007: 'C:\' is not a working copy
>
> ]]]
>
>
> But, go inside a working copy, and use a non-existing path:
>
> [[[
> C:\WorkingCopy>svn info --xml blah
> <?xml version="1.0" encoding="UTF-8"?>
> <info>
> svn: warning: W155010: The node 'C:\WorkingCopy\blah' was not found.
>
> </info>
> svn: E200009: Could not display info for all targets because some
> targets don't exist
>
> ]]]
>
>
> Why </info> in one case and not in the other? As a user, I see no
> reason for that.
>
> --
> Johan
>
Received on 2016-03-03 22:35:39 CET

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.