Jazz Forum Welcome to the Jazz Community Forum Connect and collaborate with IBM Engineering experts and users

Problem in checkin unresolved file in Changeset.

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

0 votes



2 answers

Permanent link
Not sure, if refreshing the change-set after checking-in would help?

0 votes

Comments

After refreshing also, its not working.
Actually when i am adding file into changeset, file got added but content remain same as old(means changes not reflection into changeset)


Permanent link
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/

0 votes

Comments

Hello,
  Thanks for info
  I done changes  according to your code, still files are visible in Unresolved state.

 In changeset file got added and also changes  but still it is visible in Unresolved state and even component goes "OUT OF SYNC".
 
Please let me know do you have any idea why it is happing..

Thanks and Regards,
Vikas
 

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.

Thanks for your suggestion.

Actually i am developing plain java application.
I have created one workspace with the help of eclipse client an load the project.
and then from my plain java application i have create the workspace connection of the loaded workspace with the help of Api client(which is running in some other workspace)  and trying to do following operation like Adding file in Change Set etc,

what i got to know with your comment like creating connection with the workspace help of Api client which was previously used by eclipse client for loading project,
Out of sync issue is due to this, am i right?

Please let me know if you have any work around for my use-case.

Thanks In advance!!

 

 

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.

I am not sure what you try to achieve, but https://rsjazz.wordpress.com/2013/10/15/extracting-an-archive-into-jazz-scm-using-the-plain-java-client-libraries/ shows a legal use case, in which case the data is actually stored in a zip file and not uncompressed on disk. It would be possible to uncompress on disk first and that would be pretty much your case. It would also possible to use the SCM commandline for this and avoid the whole plain java API.   

Your answer

Register or log in 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.

Search context
Follow this question

By Email: 

Once you sign in you will be able to subscribe for any updates here.

By RSS:

Answers
Answers and Comments
Question details

Question asked: Mar 09 '16, 3:40 a.m.

Question was seen: 2,584 times

Last updated: Mar 14 '16, 5:37 a.m.

Confirmation Cancel Confirm