Problem in checkin unresolved file in Changeset.
vikas v (15●4●19)
| asked Mar 09 '16, 3:40 a.m.
edited Mar 11 '16, 3:30 a.m. by Ralph Schoon (63.3k●3●36●46)
Hello,
Want to checkin new or Updated file(present in Unresolved) into changeset using plain java api. i have wrote the following code for checkin file but it is now working for me. IFileItem fileItem = null; if(localChange.getTargetParent() != null) { fileItem = (IFileItem) IFileItem.ITEM_TYPE.createItem(); fileItem.setParent(localChange.getTargetParent()); } else { fileItem = (IFileItem) workspaceConnection.configuration(changeSet.getComponent()) .fetchPartialItem(localChange.getTarget(), null, null); fileItem = (IFileItem)fileItem.getWorkingCopy(); } File testFile= new File(localChange.getPath().toString() ); fileItem.setName(testFile.getName()); FileLineDelimiter delimiter = FileLineDelimiter.LINE_DELIMITER_NONE; IFileContentManager contentManager = FileSystemCore.getContentManager(teamRepository); byte[] byteArray = new byte[(int) testFile.length()]; IFileContent storedContent = contentManager.storeContent( IFileContent.ENCODING_US_ASCII, delimiter, new VersionedContentManagerByteArrayInputStreamPovider(byteArray),null, null); fileItem.setContentType(IFileItem.CONTENT_TYPE_TEXT); fileItem.setContent(storedContent); fileItem.setFileTimestamp(new Date()); // commit the change to workspace workspaceConnection.commit(changeSet , Collections.singletonList(workspaceConnection.configurationOpFactory() .save(fileItem)), null); } when i am running the following code, Unresolved file is added into change set but content remain same as old one. Please let me know whether i am going in right way? or some alternate step i have to take Thanks in advance!! Regards, Vikas |
2 answers
Not sure, if refreshing the change-set after checking-in would help?
Comments
vikas v
commented Mar 09 '16, 5:21 a.m.
After refreshing also, its not working.
|
Ralph Schoon (63.3k●3●36●46)
| answered Mar 09 '16, 5:38 a.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER
My working code can be found here: https://rsjazz.wordpress.com/2013/10/15/extracting-an-archive-into-jazz-scm-using-the-plain-java-client-libraries/
Comments
vikas v
commented Mar 11 '16, 2:08 a.m.
Hello,
Your description indicates that you use the API while being within the RTC Eclipse client or while the workspace is loaded otherwise. Please note, that a repository workspace is only supposed to be loaded and modified by one user. A repository workspace is not supposed to be modified by multiple users and loaded into different locations.
vikas v
commented Mar 14 '16, 4:46 a.m.
Thanks for your suggestion.
Yes, the way you use the workspace causes these issues. First of all, whatever Eclipse shows (e.g. as unresolved) will be incorrect if you use the plain java API against the workspace loaded in Eclipse. Secondly, having it used from two sources (Eclipse/Plain Java) causes it to go out of sync.
|
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.