It's all about the answers!

Ask a question

Equivalent method to fetchCompleteState


Wojciech Sielski (1156) | asked May 06 '13, 11:18 a.m.
edited May 06 '13, 11:22 a.m.
 Is there any equivalent method for fetchCompleteState on versionableManager to fetch data of historic files? I'm having troubles with retrieving file name of file added in previous changelists. Here is example:

Changelist 1:     
add file: src/newFile.java

Changelist 2:     
modify file: src/newFile.java

Changelist 3:     
rename file: src/newFile.java -> src/newFile_rename.java

And now when I'm trying to get file name or file path of file in changelist 1 using following code:

// change is IChange, versionableManager is IVersionableManager     
// method getFilePath retrieve file path using ancestors     
file = versionableManager.fetchCompleteState(change.afterState(), monitor);     
if (file instanceof IFolder) {         
    IFolder folder = (IFolder) file;         
    relativePath = getFilePath(file, workspaceConnection.configuration(changeSet.getComponent()), monitor);
    fileName = folder.getName();     
} else {
    relativePath = getFilePath(file, workspaceConnection.configuration(changeSet.getComponent()), monitor);    
    fileName = ((FileItem) file).getName();     
}

I'm getting name and path of renamed file. How to get it's old name and path?

One answer



permanent link
Wojciech Sielski (1156) | answered May 07 '13, 4:30 a.m.
 Ok found the solution:
IFileItemHandle fileItemHandle = (IFileItemHandle) IFileItem.ITEM_TYPE.createItemHandle(change.afterState().getItemId(), change.afterState().getStateId());
file = versionableManager.fetchCompleteState(fileItemHandle, monitor);

if (file instanceof IFolder) {         
    IFolder folder = (IFolder) file;         
    relativePath = getFilePath(file, workspaceConnection.configuration(changeSet.getComponent()), monitor);
    fileName = folder.getName();      
} else {
    relativePath = getFilePath(file, workspaceConnection.configuration(changeSet.getComponent()), monitor);    
    fileName = ((FileItem) file).getName();     
}

But still having isses with resolving file path. Anyways this is a big step.

Your answer


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