Svn log --xml invalid xml

I use the answer svn log --xmlto see the changes for a specific version. But in the case of an invalid revision or path, I just want to get an empty but valid xml response. Is it possible to do this?

So instead:

<?xml version="1.0"?>
<log>
svn: Unable to find repository location for 'http://subversion.ny.jpmorgan.com /svn/repos/IM_RPS_CORE/rps_deploy_tools_content_test/branches/rol-201106-content-test' in revision 1556

I could get:

<?xml version="1.0"?>
<log>
</log>

Thank!

+5
source share
2 answers

No.

However, if you check the exit status code of your team svn log, you can solve the problem yourself. For example, in a Bash script shell:

if ! svn log --xml $url > $xmlOutput 2> /dev/null
then
     cat > $xmlOutput <<EOF
<?xml version="1.0"?>
<log>
</log>
EOF
fi
+1
source

Check the command error code and do not try to parse its output or generate empty XML instead. Something like that:

#!/bin/bash

FILE=svn_log.xml
svn log --xml > "${FILE}" 2>/dev/null
RET=$?

if [ $RET -ne 0 ]; then
(cat <<EOF
<?xml version="1.0"?>
<log>
</log>
EOF
) > "${FILE}"

fi

cat "${FILE}"
+1
source

All Articles