Reputation: 329
Given the following xml output from svn (via svn log --xml):
<?xml version="1.0"?>
<log>
<logentry revision="111802">
<author>author1</author>
<date>2014-09-24T17:48:11.447209Z</date>
<paths>
<path kind="file" action="A">/project/trunk/subdir/TransactionInfo.java</path>
<path kind="file" action="A">/project/trunk/subdir/Validation.java</path>
</paths>
<msg>added the start to the new Validation tool </msg>
</logentry>
<logentry revision="111801">
<author>author2</author>
<date>2014-09-24T17:32:51.129605Z</date>
<paths>
<path kind="file" action="A">/project/dispatcher/branches/EUROPA/docs/somefile.txt</path>
<path kind="file" action="A">/project/dispatcher/branches/EUROPA/docs/plans.txt</path>
</paths>
<msg>add plan steps doc and jobs spreadsheet</msg>
</logentry>
</log>
I am trying to produce output something like this. Notice the correct 2 files are listed under the correct revision.
111802 | author1 | 2014-09-24T17:48:11.447209Z | added the start to the new Validation tool
/project/trunk/subdir/TransactionInfo.java
/project/trunk/subdir/Validation.java
111801 | author2 | 2014-09-24T17:32:51.129605Z | add plan steps doc and jobs spreadsheet
/project/dispatcher/branches/EUROPA/docs/somefile.txt
/project/dispatcher/branches/EUROPA/docs/plans.txt
I use the following command, but instead I am getting all files from BOTH revisions. I believe my mistake is in the second -m parameter?
xmlstarlet sel -T -t -m /log/logentry -v "concat(@revision,' | ',author,' | ',date,' | ',msg)" -n -m /log/logentry/paths -v "path" -n svnoutput.xml
111802 | author1 | 2014-09-24T17:48:11.447209Z | added the start to the new Validation tool
/project/trunk/subdir/TransactionInfo.java
/project/trunk/subdir/Validation.java
/project/dispatcher/branches/EUROPA/docs/somefile.txt
/project/dispatcher/branches/EUROPA/docs/plans.txt
111801 | author2 | 2014-09-24T17:32:51.129605Z | add plan steps doc and jobs spreadsheet
/project/trunk/subdir/TransactionInfo.java
/project/trunk/subdir/Validation.java
/project/dispatcher/branches/EUROPA/docs/somefile.txt
/project/dispatcher/branches/EUROPA/docs/plans.txt
As a side note thought I would share, this produces a new summary I have found very useful:
xmlstarlet sel -T -t -m /log/logentry -v "concat(@revision,' | ',author,' | ',date,' | ',msg)" -n svnoutput.xml
111802 | author1 | 2014-09-24T17:48:11.447209Z | added the start to the new Validation tool
111801 | author2 | 2014-09-24T17:32:51.129605Z | add plan steps doc and jobs spreadsheet
Upvotes: 1
Views: 187
Reputation: 23757
Just get rid of the extra -m
and change your second value to paths/path
:
xmlstarlet sel -T -t -m /log/logentry
-v "concat(@revision,' | ',author,' | ',date,' | ',msg)"
-n
-v "paths/path"
-n svnoutput.xml
Upvotes: 1