How to get before and after state from a IChange?
3 answers
Hi, Tim
If some one rename the source file eg rename file1 to file2, there will be one "rename" change and shows file2 (moved from file1)
I want to get the file1 and file2 name to do some pre-condition, so I used the following code, but seems both change.beforeState() and change.afterState() return file2. Can you help to figure out?
IVersionableHandle versionableHandle = change.beforeState();
if (change.kind() == IChange.RENAME) {
versionableHandle = change.afterState();
}
ServiceConfigurationProvider configProvider = ServiceConfigurationProvider.FACTORY.create(
data.getDestWorkspace(), changeSet.getComponent());
IVersionable item = (IVersionable) scmService.fetchState(versionableHandle, null, null);
IAncestorReport reports[] = scmService.configurationLocateAncestors(
configProvider, new IVersionableHandle[] {versionableHandle}, null, null);
String filename=toFullPath(item, reports[0].getNameItemPairs());
Comments
1 vote
Comments
Jia Jia Li
Nov 13 '12, 9:20 a.m.Tim Mok
JAZZ DEVELOPER Nov 13 '12, 9:25 a.m.