How to get conflict report API
Hello,
I need some help to get information about workspace conflict:
1) List of files with conflict
2) Creators (2) of the conflict
3) the related Work-items of the conflict change-sets
My code (client side):
//get conflicts report
Collection<IItemConflictReport> ConflictReport2 = myNewWKSP.conflictReport().conflicts();
for( IItemConflictReport SingleConflict : ConflictReport2){
System.out.println(SingleConflict.getMergeDetails().toArray().toString());
}
Thanks.
Accepted answer
The conflicts() call returns the items that are conflicted. If you want the names of the files, you'll have to resolve them. You can use myNewWKSP.configuration(IComponentHandle) to get a configuration where you can determine the path of the file.
To find the users, I guess you want to find the owners of the change sets that are in conflict. You'll have to use the states that you get from the IItemConflictReport to find the change sets that have those states and retrieve the change set owner.
For the links, you'll need the ILinkService to fetch the links on the change set. You can go through the links and see which ones are work items then get whatever info you need from them. You could also try using the ChangeSetLinks utility class if you can access it. You'll need a provider factory for it, which you can get like this:
To find the users, I guess you want to find the owners of the change sets that are in conflict. You'll have to use the states that you get from the IItemConflictReport to find the change sets that have those states and retrieve the change set owner.
For the links, you'll need the ILinkService to fetch the links on the change set. You can go through the links and see which ones are work items then get whatever info you need from them. You could also try using the ChangeSetLinks utility class if you can access it. You'll need a provider factory for it, which you can get like this:
ProviderFactory providerFactory = (ProviderFactory) myNewWKSP.teamRepository().getClientLibrary(ProviderFactory.class);
Comments
Yehiel Glass
Jul 15 '13, 11:09 a.m.Hi,
How can I get a list of conflict files ?
Thanks.