It's all about the answers!

Ask a question

Path (parent folder structure) of versionables in ChangeSets


Samit Mehta (31103) | asked Mar 15 '10, 12:08 p.m.
JAZZ DEVELOPER
How can one find out the parent folder path of versionables that are part of a Change Set in a Followup action (e.g. Work Item Save Process Participant) on the RTC Server.

Using the public (non Internal) APIs, I am able to trace from a work item -> change sets -> changes -> versionables, and getting the BEFORE/AFTER contents of the files. In addition to the BEFORE/AFTER contents of files, we would want to also capture the full path of the files / folders in the Change Set. The IVersionable#getParent() method returns the FolderHandle, but it doesn't have a stateid, and I also don't have the context of a Configuration needed to fetch the state of the parent folder. So, how can I get a Configuration to set context for the Versionables in that Change Set?

For a different scenario that used the client-side libraries, I had the context of a Workspace to use as a Configuration to go up the parent folder hierarchy and build the path. Is there a way to find a Workspace that has this ChangeSet using public APIs on the RTC server?

BTW, I am aware that the above processing is "long running" and should not be performed inside a Followup action. I have posted a separate topic in this forum to get guidance on that: (http://jazz.net/forums/viewtopic.php?t=9635).

Thanks,
Samit

2 answers



permanent link
John Camelon (1.7k14) | answered Mar 15 '10, 3:09 p.m.
JAZZ DEVELOPER
How can one find out the parent folder path of versionables that are part of a Change Set in a Followup action (e.g. Work Item Save Process Participant) on the RTC Server.

Using the public (non Internal) APIs, I am able to trace from a work item -> change sets -> changes -> versionables, and getting the BEFORE/AFTER contents of the files. In addition to the BEFORE/AFTER contents of files, we would want to also capture the full path of the files / folders in the Change Set. The IVersionable#getParent() method returns the FolderHandle, but it doesn't have a stateid, and I also don't have the context of a Configuration needed to fetch the state of the parent folder. So, how can I get a Configuration to set context for the Versionables in that Change Set?

For a different scenario that used the client-side libraries, I had the context of a Workspace to use as a Configuration to go up the parent folder hierarchy and build the path. Is there a way to find a Workspace that has this ChangeSet using public APIs on the RTC server?

BTW, I am aware that the above processing is "long running" and should not be performed inside a Followup action. I have posted a separate topic in this forum to get guidance on that: (http://jazz.net/forums/viewtopic.php?t=9635).

Thanks,
Samit


There is no single correct path of an versioned item (or state) in the repository. If you require a path for display purposes, you can provide a path that many users would recognize by interpreting the versionable against different configurations available in the repository. In the Eclipse client, the Change Explorer shows that degree of fuzzy logic : if you open a change set from the history view or from Pending Changes view, you will see (in most cases) complete path information, as we use the source history/configuration as a hint to calculate the paths. However, if you open up a change set out of the blue from a work item, you may not see the same degree of resolution, particularly if you are browsing components that you are not familiar with.

If you are running this as a follow up action on the server, you can call IScmService#configurationLocateAncestors() to figure out the paths for items in the configuration which is being affected. A more expensive call is IScmService#determineAncestorsInHistory() which will also try and determine the paths of items that have been deleted from the workspace.

In order to determine a good workspace to use for this : when we create the link between a work item and a change set, we encode a workspace hint. This "hint" gives us a place to start working with when it comes to interpretting the changes. This "hint" however is just that : a hint. The workspace can be deleted and no longer exist, in which case it is not that useful to you. If looking at the ILink you should find that the chang set IReference's extra info is a string of the form "Workspace=<UUID>", where the UUID is the item id to the hint workspace.

If the hint doesn't pan out, there are search APIs which can be used to find "is this change set in this workspace" or "is this change set in any of my flow targets", but we don't have a search API which answers "tell me where this is in the whole repository". see IScmQueryService#findWhereChangeSetsHaveFlowed().

Hope this helps,
John Camelon
SCM Server

permanent link
Geoffrey Clemm (30.0k23035) | answered Mar 15 '10, 3:27 p.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER
In general, there is no unique Configuration in a Work Item Save
context, so in general, you cannot compute "the right" parent folder
path. As I recall, if all you want is some parent folder path (not the
"right" one), then I think there sometimes is a workspace associated
with the work item, but we'd need someone from the RTC source control
team to verify that this information is sometimes available, and if so,
how to get at it.

Cheers,
Geoff

smehta wrote:
How can one find out the parent folder path of versionables that are
part of a Change Set in a Followup action (e.g. Work Item Save
Process Participant) on the RTC Server.

Using the public (non Internal) APIs, I am able to trace from a work
item -> change sets -> changes -> versionables, and getting
the BEFORE/AFTER contents of the files. In addition to the
BEFORE/AFTER contents of files, we would want to also capture the
full path of the files / folders in the Change Set. The
IVersionable#getParent() method returns the FolderHandle, but it
doesn't have a stateid, and I also don't have the context of a
Configuration needed to fetch the state of the parent folder. So,
how can I get a Configuration to set context for the Versionables in
that Change Set?

For a different scenario that used the client-side libraries, I had
the context of a Workspace to use as a Configuration to go up the
parent folder hierarchy and build the path. Is there a way to find a
Workspace that has this ChangeSet using public APIs on the RTC
server?

BTW, I am aware that the above processing is "long running"
and should not be performed inside a Followup action. I have posted
a separate topic in this forum to get guidance on that:
(http://jazz.net/forums/viewtopic.php?t=9635).

Thanks,
Samit

Your answer


Register or to post your answer.