use of com.intellij.testFramework.vcs.MockChangelistBuilder in project intellij-community by JetBrains.
the class GitChangeProviderTest method getChanges.
/**
* Marks the given files dirty in myDirtyScope, gets changes from myChangeProvider and groups the changes in the map.
* Assumes that only one change for a file has happened.
*/
protected Map<FilePath, Change> getChanges(VirtualFile... changedFiles) throws VcsException {
final List<FilePath> changedPaths = ObjectsConvertor.vf2fp(Arrays.asList(changedFiles));
// get changes
MockChangelistBuilder builder = new MockChangelistBuilder();
myChangeProvider.getChanges(myDirtyScope, builder, new EmptyProgressIndicator(), new MockChangeListManagerGate(ChangeListManager.getInstance(myProject)));
List<Change> changes = builder.getChanges();
// get changes for files
final Map<FilePath, Change> result = new HashMap<>();
for (Change change : changes) {
VirtualFile file = change.getVirtualFile();
FilePath filePath = null;
if (file == null) {
// if a file was deleted, just find the reference in the original list of files and use it.
String path = change.getBeforeRevision().getFile().getPath();
for (FilePath fp : changedPaths) {
if (FileUtil.pathsEqual(fp.getPath(), path)) {
filePath = fp;
break;
}
}
} else {
filePath = VcsUtil.getFilePath(file);
}
result.put(filePath, change);
}
return result;
}
use of com.intellij.testFramework.vcs.MockChangelistBuilder in project intellij-community by JetBrains.
the class SvnTestCase method getChangesInScope.
protected List<Change> getChangesInScope(final VcsDirtyScope dirtyScope) throws VcsException {
ChangeProvider changeProvider = SvnVcs.getInstance(myProject).getChangeProvider();
MockChangelistBuilder builder = new MockChangelistBuilder();
changeProvider.getChanges(dirtyScope, builder, new EmptyProgressIndicator(), myGate);
return builder.getChanges();
}
Aggregations