It's all about the answers!

Ask a question

How to get list of files within a changeset using lscm CLI?


Ved Kpl (135) | asked Mar 08 '21, 5:06 a.m.

 How can I get the list of files within a changeset using lscm commandline utility?

I couldn't find anything under "lscm list ..." or "lscm get ...."

One answer



permanent link
Shashikant Padur (4.2k27) | answered Mar 08 '21, 5:12 a.m.
JAZZ DEVELOPER

lscm list changes <changeset>


Comments
Ved Kpl commented Mar 08 '21, 5:19 a.m.

Thanks, I have tried that. But it gives a lot of extra information. I am only interested in the files. I am looking for something that's equivalent to "git show  --pretty="" --name-only  <commitid>"  


Shashikant Padur commented Mar 08 '21, 5:26 a.m.
JAZZ DEVELOPER
Current we do not have the capability to filter out certain information.
Are you using it to parse information? If so, it is easier to use the json output (-j/--json option).

Ved Kpl commented Mar 08 '21, 5:29 a.m.

Thanks, will look into that. That should help. Also, can I get the previous version of a file from a given changeset?


Shashikant Padur commented Mar 08 '21, 5:43 a.m. | edited Mar 08 '21, 5:43 a.m.
JAZZ DEVELOPER
No, you cannot get to the previous version of a file from a given change set. What is the usecase you are trying to solve by getting the previous version of a file? Do you want to get the content of the previous version?

Ved Kpl commented Mar 08 '21, 5:54 a.m.

 Yes, Right now I run  "lscm show history .. " on a file to get all the changsets that this file was a part of, pick the second top most (i.e the last) one from the output and then run "lscm get change ..." to checkout the file in a separate path. 


So I was wondering, if there's a better and a quicker way to do this.


Shashikant Padur commented Mar 08 '21, 6:17 a.m. | edited Mar 08 '21, 6:18 a.m.
JAZZ DEVELOPER

If you want to get the content of a particular version of a file then you can use "lscm get file <file_itemId> <stateId_or_versionId> <path>". Note: There was an issue found with this with respect to symbolic links and was fixed in a later release.


Ved Kpl commented Mar 08 '21, 6:27 a.m.

I basically need last version (i.e last changeset) of a file which is a part of a current (latest changeset)

Also, where can I read about file item id, state id, version id ? I couldn't find any info on these terms.


Shashikant Padur commented Mar 08 '21, 6:41 a.m.
JAZZ DEVELOPER
To get the last version of a file what you did is the right way to go (lscm show history). Make sure you set the -m/--maximum (change sets to fetch) to 1.

itemId is an unique identifier to represent an item which could be a file, workspace, stream, component, baseline, snapshot, change set etc.
stateId is a unique identifier to represent a change in state of an item. In the file case, a new file version will have a new state id.
versionId was introduced in 5.0 and is similar to stateId but represented as numbers in increasing order for newer versions of files.
showing 5 of 8 show 3 more comments

Your answer


Register or to post your answer.


Dashboards and work items are no longer publicly available, so some links may be invalid. We now provide similar information through other means. Learn more here.