use of com.intellij.openapi.vcs.FilePath in project intellij-community by JetBrains.
the class HgUpdateEnvironment method updateDirectories.
@NotNull
public UpdateSession updateDirectories(@NotNull FilePath[] contentRoots, UpdatedFiles updatedFiles, ProgressIndicator indicator, @NotNull Ref<SequentialUpdatesContext> context) {
List<VcsException> exceptions = new LinkedList<>();
boolean result = true;
for (FilePath contentRoot : contentRoots) {
if (indicator != null) {
indicator.checkCanceled();
indicator.startNonCancelableSection();
}
VirtualFile repository = ProjectLevelVcsManager.getInstance(project).getVcsRootFor(contentRoot);
if (repository == null) {
continue;
}
try {
HgUpdater updater = new HgRegularUpdater(project, repository, updateConfiguration);
result &= updater.update(updatedFiles, indicator, exceptions);
} catch (VcsException e) {
//TODO include module name where exception occurred
exceptions.add(e);
}
if (indicator != null) {
indicator.finishNonCancelableSection();
}
}
return new UpdateSessionAdapter(exceptions, !result);
}
use of com.intellij.openapi.vcs.FilePath in project intellij-community by JetBrains.
the class HgUtil method removeFilesFromVcs.
/**
* Calls 'hg remove' to remove given files from the VCS.
* @param project
* @param files files to be removed from the VCS.
*/
public static void removeFilesFromVcs(Project project, List<FilePath> files) {
final HgRemoveCommand command = new HgRemoveCommand(project);
for (FilePath filePath : files) {
final VirtualFile vcsRoot = VcsUtil.getVcsRootFor(project, filePath);
if (vcsRoot == null) {
continue;
}
command.executeInCurrentThread(new HgFile(vcsRoot, filePath));
}
}
use of com.intellij.openapi.vcs.FilePath in project intellij-community by JetBrains.
the class HgHistoryTest method testUncommittedRenamedFileHistory.
public void testUncommittedRenamedFileHistory() throws HgCommandException {
cd(myRepository);
VirtualFile subDir = myRepository.findFileByRelativePath(subDirName);
assert subDir != null;
cd(subDir);
int namesSize = names.length;
String beforeName = names[namesSize - 1];
VirtualFile before = VfsUtil.findFileByIoFile(new File(subDir.getPath(), beforeName), true);
assert before != null;
FilePath filePath = VcsUtil.getFilePath(VfsUtilCore.virtualToIoFile(before));
final String renamed = "renamed";
hg("mv " + beforeName + " " + renamed);
myRepository.refresh(false, true);
List<HgFileRevision> revisions = HgHistoryProvider.getHistory((filePath), myRepository, myProject);
assertEquals(3, revisions.size());
}
use of com.intellij.openapi.vcs.FilePath in project intellij-community by JetBrains.
the class SvnCheckinHandlerFactory method createVcsHandler.
@NotNull
@Override
protected CheckinHandler createVcsHandler(final CheckinProjectPanel panel) {
final Project project = panel.getProject();
final Collection<VirtualFile> commitRoots = panel.getRoots();
return new CheckinHandler() {
private Collection<Change> myChanges = panel.getSelectedChanges();
@Override
public RefreshableOnComponent getBeforeCheckinConfigurationPanel() {
return null;
}
@Override
public ReturnResult beforeCheckin(@Nullable CommitExecutor executor, PairConsumer<Object, Object> additionalDataConsumer) {
if (executor instanceof LocalCommitExecutor)
return ReturnResult.COMMIT;
final SvnVcs vcs = SvnVcs.getInstance(project);
final MultiMap<String, WorkingCopyFormat> copiesInfo = splitIntoCopies(vcs, myChanges);
final List<String> repoUrls = new ArrayList<>();
for (Map.Entry<String, Collection<WorkingCopyFormat>> entry : copiesInfo.entrySet()) {
if (entry.getValue().size() > 1) {
repoUrls.add(entry.getKey());
}
}
if (!repoUrls.isEmpty()) {
final String join = StringUtil.join(repoUrls, ",\n");
final int isOk = Messages.showOkCancelDialog(project, SvnBundle.message("checkin.different.formats.involved", repoUrls.size() > 1 ? 1 : 0, join), "Subversion: Commit Will Split", Messages.getWarningIcon());
return Messages.OK == isOk ? ReturnResult.COMMIT : ReturnResult.CANCEL;
}
return ReturnResult.COMMIT;
}
@Override
public void includedChangesChanged() {
myChanges = panel.getSelectedChanges();
}
@Override
public void checkinSuccessful() {
if (SvnConfiguration.getInstance(project).isAutoUpdateAfterCommit()) {
final VirtualFile[] roots = ProjectLevelVcsManager.getInstance(project).getRootsUnderVcs(SvnVcs.getInstance(project));
final List<FilePath> paths = new ArrayList<>();
for (VirtualFile root : roots) {
boolean take = false;
for (VirtualFile commitRoot : commitRoots) {
if (VfsUtilCore.isAncestor(root, commitRoot, false)) {
take = true;
break;
}
}
if (take) {
paths.add(VcsUtil.getFilePath(root));
}
}
if (paths.isEmpty())
return;
ApplicationManager.getApplication().invokeLater(() -> AutoSvnUpdater.run(new AutoSvnUpdater(project, paths.toArray(new FilePath[paths.size()])), ActionInfo.UPDATE.getActionName()), ModalityState.NON_MODAL);
}
}
};
}
use of com.intellij.openapi.vcs.FilePath in project intellij-community by JetBrains.
the class AutoSvnUpdater method actionPerformed.
@Override
protected void actionPerformed(@NotNull VcsContext context) {
final SvnConfiguration configuration17 = SvnConfiguration.getInstance(myProject);
configuration17.setForceUpdate(false);
configuration17.setUpdateLockOnDemand(false);
configuration17.setUpdateDepth(Depth.INFINITY);
final SvnVcs vcs = SvnVcs.getInstance(myProject);
for (FilePath root : myRoots) {
configureUpdateRootInfo(root, configuration17.getUpdateRootInfo(root.getIOFile(), vcs));
}
super.actionPerformed(context);
}
Aggregations