It's all about the answers!

Ask a question

[closed] How can I extract the files from a changeset to the filesystem?


Andrew Trobec (49712139139) | asked Aug 26 '14, 9:26 a.m.
closed Sep 02 '14, 2:47 a.m.
Hello,

I am working with RTC 4.0.3.

Given a changeset I would like to be able to extract the files to the filesystem.  What I have tried doing from the Eclipse client is:
  1. Right click the component under the stream and select "Show > History"
  2. For the desired change set right click and select "Open in Change Explorer"
  3. For the file that I want to save right click and select "Load"
The first problem is that the folder structure is not maintained and secondly I can only do this one file at a time.

How can I copy all files in a changeset to the filesystem while maintaining the folder structure as well?

Thank you and best regards,

Andrew

The question has been closed for the following reason: "The question is answered, right answer was accepted" by spriteburn Sep 02 '14, 2:47 a.m.

Accepted answer


permanent link
Winston Enos (3316) | answered Aug 27 '14, 10:24 a.m.
Andrew Trobec,

I'm not familiar with a way to do this via Eclipse (I went through a couple flows in my RTC 5.0 Eclipse client and didn't see anything related to what you are looking for.)

However, you can do this via the CLI, so if you are comfortable with some scripting this can be your workflow (for some reason IBM doesn't have this CLI command advertised in the 5.x documentation, but it's still there.)
1. Script up something to run this command: http://pic.dhe.ibm.com/infocenter/clmhelp/v4r0m3/topic/com.ibm.team.scm.doc/topics/changeset_extract.html - This will extract the changeset's versionables to an output directory.

2. If you are in the Eclipse Component History, for example (Show -> History) and you want to extract a specific changeset, you can right-click the changeset and select 'Copy URL' then paste into Notepad or something, you should get something like 'https://myrtc.com/ccm/resource/itemOid/com.ibm.team.scm.ChangeSet/_zd9z0up6EeOX2fFKCpeFrQ?Workspace=_6GU9Edq5EeKrDorZ-x_CeQ' and you can grab the changeset UUID from there and feed it to the script (using the workspace UUID which is also at the end of the URL.)

Obviously it would be nice to just do some mouse clicks to do this from the Eclipse GUI, but this gives you something workable you can improve upon.
Andrew Trobec selected this answer as the correct answer

Comments
Andrew Trobec commented Aug 28 '14, 3:58 a.m.

Thank you Winston.

Do you have any experience with this command?  I am trying to get it to work but I am having trouble, especially with the <path-to-item> parameter.  I am trying to accomplish the task without having to create and load a workspace.
Since the repository contains a large amount of files and folders, the requirement is for a configuration manager to extract a given changeset's content without having to load an unnecessary barrage of files.
Regards,
Andrew


1
Winston Enos commented Aug 28 '14, 10:42 a.m.

Andrew Trobec,

After checking the 4.0.6 and 5.0 CLI documentation, IBM changed the 'changeset extract' command to 'get change', it doesn't look like you have this in 4.0.3, so you're stuck with the former, slower command (in my environment 15 seconds versus 4 seconds.)

The command doesn't work, I suspect, exactly as you'd like it to by default, meaning it will not simply extract all the changes in a changeset to the filesystem in one-shot (which would have been preferable here.)

What you have to do is list the changes in the changeset and extract one-by-one:
1. scm.exe --non-interactive --show-uuid y list changes -r MY_CREDS --workspace wkenos_dev_test_ws _hQ1mEQFlEeSoZb4hDFKBcw - This will list all the changes in the changeset and their item IDs.

2. scm.exe --non-interactive --show-uuid y get change --overwrite -r MY_CREDS --workspace wkenos_dev_test_ws _hQ1mEQFlEeSoZb4hDFKBcw /scripts/common.xml C:\TEMP\component\scripts\common.xml

Wash, rinse, repeat for each versionable file in the changeset.


1
Winston Enos commented Aug 28 '14, 10:45 a.m.

IBM has a Perl script posted that does essentially what you want and it should work for 4.0.3. Their script diffs 2 streams and then writes out the diff content to the filesystem:
http://www.ibm.com/developerworks/rational/library/rational-team-concert-command-line-reference/index.html?ca=drs (download is at the bottom, a zip file.)

I think the main problem for you, and you'll have to test, will be speed. The command on my end isn't that fast, and it could take minutes to extract a larger changeset of just a few dozen changes. It would be nice if IBM modified the command to optionally extract the full changeset's versionsables to an output directory with or without the component roots.


Andrew Trobec commented Sep 02 '14, 2:46 a.m.

@winstonenos


Thanks again Winston, I appreciate your input.  I have managed to develop a Windows batch script that uses the list changes command to write a change set to file, then after performing some batch commands to analyse and prepare the file, and recreate the directory structure, uses the changeset extract command to export the files.  You are right that it's a bit slow (around 15 seconds per file), but it's better than a kick in the balls!

Does the get change command in CLI 5.0 extract all changes in one swoop?

Regards,

Andrew


Winston Enos commented Sep 02 '14, 9:50 a.m.

Andrew Trobec,

'get change' in RTC 5.0 does not extract all changes in one swoop, but it extracts each file in seconds so it's quite a bit faster as well.

The RTC command-line source code is available in the RTC SDK (part of the jazz.net download products), if you're interested in trying to enhance it for your own ends, although I don't know how much work that is.

You might want to subscribe to this RTC work item: https://jazz.net/jazz/web/projects/Rational%20Team%20Concert#action=com.ibm.team.workitem.viewWorkItem&id=203315

This work item is in the IBM production database that requests this feature, unfortunately it's been on backlog for a while now. IBM uses a separate RFE process to prioritize things out of here, so you'd have to open one of those to get any sort of traction.