How to list changed files associated to a work item from the scm cli?
Accepted answer
I don't think that there is a SCM command to list the changes associated with a work item. I have got around this by using the REST API to get the list of changesets associated with a workitem and then use the lscm list changes command to get the list of files. Even with this approach, a lot of parsing is required.
I use CURL and LSCM from a BASH Script, so probably not much help for your VBA Script.
See https://jazz.net/wiki/bin/view/Main/ReportsRESTAPI for more on the REST API.
My code looks something like this
# Connect to the REST interface
curl -s -k -c ${COOKIES} "${HOST}/jts/authenticated/identity" > /dev/null
# Authenticate
curl -s -k -L -b ${COOKIES} -c ${COOKIES} -d j_username=${USER} -d j_password=${PASSWORD} "${HOST}/jts/authenticated/j_security_check"
# Get the WI data where workitem id is returned by ${WI}
curl -s -k -b ${COOKIES} "${HOST}/ccm/resource/itemName/com.ibm.team.workitem.WorkItem/${WI}?_mediaType=application/x-oslc-cm-changerequest%2Bjson"
# parse the output from above command to find the Changeset OID (sample output below)
[],"rtc_cm:com.ibm.team.filesystem.workitems.change_set.com.ibm.team.scm.ChangeSet":[{"rdf:resource":"https:\/\/v3-rtc-clm.stl.int:9443\/ccm\/resource\/itemOid\/com.ibm.team.scm.ChangeSet\/_AL_6YR-QEeO0aJGAYIWppA","oslc_cm:label":"Changes in LDRD - For CT1530 - author- Sep 17, 2013 1:55 PM"}],"rtc_cm:com.ibm.team.workitem.linktype.blocksworkitem.dependsOn":[],"rtc_cm:com.ibm.team.workitem.linktype.resolvesworkitem.resolvedBy":
# Then call SCM to return contents of changeset.
lscm list changes -r "https://hostname:9443/ccm" _AL_6YR-QEeO0aJGAYIWppA
You should be able to replace calls to CURL with an object that is able to provide HTTP communication.
Stephen
Comments
Shashikant Padur
JAZZ DEVELOPER Jan 13 '14, 10:24 p.m.In scm cli 4.0.6 (upcoming release) we have added a workitem option to the 'list changesets' command to list the change sets of a workitem. There is also an option to show child workitem change sets.