*
* @param changePackage the changePackage to keep track of
* @return the changeList acting that is in sync with the changePackage
*/
@NotNull ChangeList trackMksChangePackage(@NotNull MksChangePackage changePackage) {
ChangeListManager changeListManager = ChangeListManager.getInstance(mksVcs.getProject());
if (changeListNameByChangePackageId.containsKey(changePackage.getId())) {
changePackageById.put(changePackage.getId(), changePackage);
LocalChangeList list =
changeListManager.findChangeList(changeListNameByChangePackageId.get(changePackage.getId()));
if (list != null) {
return list;
}
}
LocalChangeList changeList = changeListManager.findChangeList(createChangeListName(changePackage));
if (changeList == null) {
changeList = changeListManager.addChangeList(createChangeListName(changePackage), "");
}
changeListNameByChangePackageId.put(changePackage.getId(), changeList.getName());
changePackageIdByChangeListName.put(changeList.getName(), changePackage.getId());
changePackageById.put(changePackage.getId(), changePackage);
return changeList;