How to identify a Discarded Changeset programatically using Java API.
Hello All,
I have a scenario where i need to identify whether a given Changeset is discarded or not.
I have a Changeset Object as below.
IChangeSet changeSet = (IChangeSet) currentWIRepo.itemManager().fetchCompleteItem(changeSetHandle,
IItemManager.DEFAULT, null);
IItemManager.DEFAULT, null);
Are there any APIs to find the state of the CS, whether it is discarded or any other state.
Request you to assist on this.
Thank you.
2 answers
Are there any APIs to find the state of the CS, whether it is discarded or any other state.
As far as I know, there isn't a public API for that, but you could use API com.ibm.team.scm.client.IWorkspaceManager#findWorkspacesContainingChangeset and test returning list if it is empty to determinate if that change-set is discarded.
Cheers.
Change sets on their own have no concept or property/state of being 'discarded'. You can ask the question as to whether or not a change set is 'in' (i.e. is in the change set history of a component) of a particular repository workspace or stream however.
If you need client-side API to determine this, look at:
IWorkspaceManager#findWorkspacesContainingChangeset
or if you know the workspaces or streams you care about, you might want to call:
IWorksapceManager#locateChangeSets
IWorksapceManager#locateChangeSets