Java API Extending - problem committing new change set, exception 'Parent ... has multiple children with name ...'.
Hi,
I have code based on Snippet2.java which delivers files to the stream successfully, but generates a TeamRepositoryException 'Parent folder-name has multiple children with name file-name' when trying to add a set of files in a new change set to a previously created folder.
I check for the existence of a previously created project folder, and if found, create a new change set comment. I assume I need to obtain the handle to the folder where I need to deliver the new change set to. In this scenario I do not execute a workspaceconnection.commit() after the setComment():
if (map.containsKey("RT_CO_CRNR_CHRG") == true) {
IVersionableHandle prjFldr = (IVersionableHandle) map.get("RT_CO_CRNR_CHRG");
IVersionable item = wkspccnctn.configuration(cmpnthndl).fetchCompleteItem(prjFldr, monitor);
IFolder tmp = (IFolder) item;
projectFolder = tmp;
SCMPlatform.getWorkspaceManager(repo).setComment(cs1, "RT_CO_CRNR_CHRG 20130922", null);
}
For each file in the projectFolder, I add to a byte[] object and call contentManager.storeContent(), exactly as I did when the files are first added. The TeamRepositoryException is thrown on the first file being processed (e.g. Parent '/RT_CO_CRNR_CHRG' has multiple children with the name '.project'.) from the following line of code:
wkspccnctn.commit(cs1, Collections.singletonList(wkspccnctn.configurationOpFactory().save(file)), monitor);
We are migrating to RTC from our old source repository, and need to copy a few revisions of each of our Eclipse projects over to RTC. What do I need to do in order to add each revision (as a new change set) to RTC using the API without generating this exception?
Peter
One answer
Peter,
I have been looking into the SCM API recently. Please have a look at http://thescmlounge.blogspot.de/2013/08/getting-your-stuff-using-rtc-sdk-to-zip.html as well.
The problem you are having is, I believe, you are creating folders and files again and again that already exist. This causes the message. The way I solved this (I am working on uncompressing directly into SCM) was, to try to find the IFolder and IFileItems in the SCM system. If I could find one, I reused it, if not, I created the object. This way I am able to also update files.
I have been looking into the SCM API recently. Please have a look at http://thescmlounge.blogspot.de/2013/08/getting-your-stuff-using-rtc-sdk-to-zip.html as well.
The problem you are having is, I believe, you are creating folders and files again and again that already exist. This causes the message. The way I solved this (I am working on uncompressing directly into SCM) was, to try to find the IFolder and IFileItems in the SCM system. If I could find one, I reused it, if not, I created the object. This way I am able to also update files.
Comments
showing 5 of 8
show 3 more comments