use of org.tmatesoft.svn.core.wc.ISVNStatusFileProvider in project intellij-community by JetBrains.
the class SvnChangeProvider method createFileProvider.
@NotNull
private static ISVNStatusFileProvider createFileProvider(@NotNull Map<String, SvnScopeZipper.MyDirNonRecursive> nonRecursiveMap) {
final Map<String, Map<String, File>> result = ContainerUtil.newHashMap();
for (SvnScopeZipper.MyDirNonRecursive item : nonRecursiveMap.values()) {
File file = item.getDir().getIOFile();
Map<String, File> fileMap = ContainerUtil.getOrCreate(result, file.getAbsolutePath(), NAME_TO_FILE_MAP_FACTORY);
for (FilePath path : item.getChildrenList()) {
fileMap.put(path.getName(), path.getIOFile());
}
// see http://issues.tmatesoft.com/issue/SVNKIT-567 for details
if (file.getParentFile() != null) {
Map<String, File> parentMap = ContainerUtil.getOrCreate(result, file.getParentFile().getAbsolutePath(), NAME_TO_FILE_MAP_FACTORY);
parentMap.put(file.getName(), file);
}
}
return parent -> result.get(parent.getAbsolutePath());
}
use of org.tmatesoft.svn.core.wc.ISVNStatusFileProvider in project intellij-community by JetBrains.
the class SvnChangeProvider method getChanges.
public void getChanges(@NotNull VcsDirtyScope dirtyScope, @NotNull ChangelistBuilder builder, @NotNull ProgressIndicator progress, @NotNull ChangeListManagerGate addGate) throws VcsException {
final SvnScopeZipper zipper = new SvnScopeZipper(dirtyScope);
zipper.run();
final Map<String, SvnScopeZipper.MyDirNonRecursive> nonRecursiveMap = zipper.getNonRecursiveDirs();
final ISVNStatusFileProvider fileProvider = createFileProvider(nonRecursiveMap);
try {
final SvnChangeProviderContext context = new SvnChangeProviderContext(myVcs, builder, progress);
final NestedCopiesBuilder nestedCopiesBuilder = new NestedCopiesBuilder(myVcs, mySvnFileUrlMapping);
final EventDispatcher<StatusReceiver> statusReceiver = EventDispatcher.create(StatusReceiver.class);
statusReceiver.addListener(context);
statusReceiver.addListener(nestedCopiesBuilder);
final SvnRecursiveStatusWalker walker = new SvnRecursiveStatusWalker(myVcs, statusReceiver.getMulticaster(), progress);
for (FilePath path : zipper.getRecursiveDirs()) {
walker.go(path, Depth.INFINITY);
}
walker.setFileProvider(fileProvider);
for (SvnScopeZipper.MyDirNonRecursive item : nonRecursiveMap.values()) {
walker.go(item.getDir(), Depth.IMMEDIATES);
}
statusReceiver.getMulticaster().finish();
processCopiedAndDeleted(context, dirtyScope);
processUnsaved(dirtyScope, addGate, context);
final Set<NestedCopyInfo> nestedCopies = nestedCopiesBuilder.getCopies();
mySvnFileUrlMapping.acceptNestedData(nestedCopies);
putAdministrative17UnderVfsListener(nestedCopies);
} catch (SvnExceptionWrapper e) {
LOG.info(e);
throw new VcsException(e.getCause());
} catch (SVNException e) {
if (e.getCause() != null) {
throw new VcsException(e.getMessage() + " " + e.getCause().getMessage(), e);
}
throw new VcsException(e);
}
}
Aggregations