Identifying before and after path for IChange in ChangeHistory
List<IVersionableHandle> fileHandles = new ArrayList<IVersionableHandle>(); for (Object changeSetO : cs.changes()) { IChange changeSet = (IChange) changeSetO; IItemHandle itemHandle = changeSet.item(); fileHandles.add((IVersionableHandle) itemHandle);
}
IConfiguration configuration = wc.configuration(cs.getComponent());
List<IAncestorReport> list = configuration.determineAncestorsInHistory(fileHandles, MONITOR);
Accepted answer
then you would look at the merge type I think if both before and after are not null.
but one fo the SCM team folks should be along shortly to add/correct
Modifier and Type | Method and Description |
---|---|
IVersionableHandle
|
afterState()
Returns the "after" state of the versionable item, or
null
if the change is the deletion of a versionable item from the configuration.
|
IVersionableHandle
|
beforeState()
Returns the "before" state of the versionable item, or
null
if the change is the addition of a versionable item to the configuration.
|
int
|
getMergeKind(IVersionableHandle mergeState)
Returns the change kind which describes the type of change between the supplied merge state and the after state.
|
Comments
Thanks for the info. I've edited my question to match. My remaining question is about file moves and how to get the path from before the move as well as the path after the move.
sorry, I do not know the answer to that.
but looking at IConfiguration again
java.util.List locateAncestors(java.util.List versionableHandles, org.eclipse.core.runtime.IProgressMonitor monitor) throws TeamRepositoryExceptionFor each specified item, retrieves the sequence of name-item pairs that leads to that item in the configuration starting at a root folder. It is assumed that the reference versions can be found in the component that scopes this configuration.
This information could be turned into a path by combining the names from each folder entry in sequence. The operation fails by throwing
TeamRepositoryException
if the client is not logged in to the repository.
There can be at most one path to any particular versionable item in a configuration. A folder namespace is a strict tree with a single root for each component; there is no equivalent of Unix-style hard links.
so it sounds like you can get the data to construct the current path.I found what I needed for the file move part here:
thanks for the feedback.