It's all about the answers!

Ask a question

Most recent state id of file on stream/workspace through CLI


Mark Richardson (2868) | asked May 02 '14, 11:03 a.m.
 Given a item UUID and a stream/workspace, how can I get the stateID (UUID) of the most recent version of the item? I need both UUIDs for the scm get file command. The best I can come up with is scm -u y show history and iterating over the change sets until the file is found (assuming that the change sets are in descending order) and pulling the stateID from it.

Help for: scm get file

Purpose:
  Extracts the content of a specific version of a file from the repository to a
  location on disk.

Aliases: get fi

Usage: scm get file [-r/--repository-uri <arg>] [-u/--username <arg>
                    -P/--password <arg> | --certificate <arg> -P/--password
                    <arg> | --smartCard -u/--username <arg>] [-o/--overwrite]
                    <item> <state> <path-on-disk>

  item         - The item id of the item to be extracted.  Supports UUID format
                 only.
  state        - The state id of the item to be extracted.  Supports UUID
                 format only.
  path-on-disk - The path where the extracted content must be loaded. The path
                 can be a absolute path or a relative path from the current
                 working directory.

Example:
Stream S has file F that belongs to three changesets: C1, C2, and C3. C1 and C2 have been delivered to the stream. C3 is in some private workspace. From the streams point of view, the file F's most recent stateId is that which is in C2. Hence, how would I get the stateId of F in S (which the most recent F in S came from C2)?

Accepted answer


permanent link
Shashikant Padur (4.3k27) | answered May 04 '14, 11:40 p.m.
JAZZ DEVELOPER
edited May 04 '14, 11:41 p.m.
I don't think there is a way to find the stated id by having the stream/workspace and an item id. But you can get it if you know the path to the file in the component.
lscm -u y list remotefiles -w &lt;stream&gt; &lt;component&gt; /folder1/nestedfolder2/filename.ext
Mark Richardson selected this answer as the correct answer

Comments
Mark Richardson commented May 05 '14, 8:24 a.m.

Yes thank you this will work for what I am trying to do. In fact it saves me a step. I can now use this:


scm compare -r <repo> -f o -I f stream <child> stream <parent>

Then per each file:
scm -u y list remotefiles -r <repo> -w <child/parent> <component> <path>

Then with each UUID + StateID
scm get file -r <repo> <UUID> <StateID> <Temp storage>

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.