mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
Merge remote-tracking branch 'origin/master'
This commit is contained in:
@@ -608,6 +608,9 @@ public class GitUtil {
|
||||
}
|
||||
|
||||
public static boolean justOneGitRepository(Project project) {
|
||||
if (project.isDisposed()) {
|
||||
return true;
|
||||
}
|
||||
GitRepositoryManager manager = getRepositoryManager(project);
|
||||
if (manager == null) {
|
||||
return true;
|
||||
|
||||
@@ -236,7 +236,9 @@ class GitCheckoutOperation extends GitBranchOperation {
|
||||
// See http://youtrack.jetbrains.com/issue/IDEA-80573
|
||||
sleepABit();
|
||||
refreshRoot(repository);
|
||||
// repository state will be auto-updated with this VFS refresh => no need to call GitRepository#update().
|
||||
// repository state will be auto-updated with this VFS refresh => in general there is no need to call GitRepository#update()
|
||||
// but to avoid problems of the asynchronous refresh, let's force update the repository info.
|
||||
repository.update(GitRepository.TrackedTopic.CURRENT_BRANCH, GitRepository.TrackedTopic.CURRENT_REVISION);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -476,9 +476,11 @@ public class GitCheckinEnvironment implements CheckinEnvironment {
|
||||
handler.addParameters(paths);
|
||||
handler.run();
|
||||
}
|
||||
GitRepositoryManager manager = GitUtil.getRepositoryManager(project);
|
||||
if (manager != null) {
|
||||
manager.updateRepository(root, GitRepository.TrackedTopic.CURRENT_REVISION, GitRepository.TrackedTopic.STATE);
|
||||
if (!project.isDisposed()) {
|
||||
GitRepositoryManager manager = GitUtil.getRepositoryManager(project);
|
||||
if (manager != null) {
|
||||
manager.updateRepository(root, GitRepository.TrackedTopic.CURRENT_REVISION, GitRepository.TrackedTopic.STATE);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -79,7 +79,7 @@ public final class GitCompoundResult {
|
||||
GitCommandResult result = entry.getValue();
|
||||
if (!result.success()) {
|
||||
sb.append("<p>");
|
||||
if (!onlyOneRepositoryInTheProject()) {
|
||||
if (!GitUtil.justOneGitRepository(myProject)) {
|
||||
sb.append("<code>" + repository.getPresentableUrl() + "</code>:<br/>");
|
||||
}
|
||||
sb.append(result.getErrorOutputAsHtmlString());
|
||||
@@ -88,8 +88,4 @@ public final class GitCompoundResult {
|
||||
}
|
||||
return sb.toString();
|
||||
}
|
||||
|
||||
private boolean onlyOneRepositoryInTheProject() {
|
||||
return !GitUtil.getRepositoryManager(myProject).moreThanOneRoot();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -50,6 +50,9 @@ public class GitFileSeparatorConverter {
|
||||
final GitVcsSettings settings,
|
||||
Map<VirtualFile, Collection<Change>> sortedChanges,
|
||||
final List<VcsException> exceptions) {
|
||||
if (project.isDisposed()) {
|
||||
return true;
|
||||
}
|
||||
final GitVcsSettings.ConversionPolicy conversionPolicy = settings.getLineSeparatorsConversion();
|
||||
if (conversionPolicy != GitVcsSettings.ConversionPolicy.NONE) {
|
||||
LocalFileSystem lfs = LocalFileSystem.getInstance();
|
||||
@@ -77,10 +80,10 @@ public class GitFileSeparatorConverter {
|
||||
}
|
||||
}
|
||||
// check crlf for real
|
||||
for (Iterator<Map.Entry<VirtualFile, Set<VirtualFile>>> i = files.entrySet().iterator(); i.hasNext();) {
|
||||
for (Iterator<Map.Entry<VirtualFile, Set<VirtualFile>>> i = files.entrySet().iterator(); i.hasNext(); ) {
|
||||
Map.Entry<VirtualFile, Set<VirtualFile>> e = i.next();
|
||||
Set<VirtualFile> fs = e.getValue();
|
||||
for (Iterator<VirtualFile> j = fs.iterator(); j.hasNext();) {
|
||||
for (Iterator<VirtualFile> j = fs.iterator(); j.hasNext(); ) {
|
||||
VirtualFile f = j.next();
|
||||
String detectedLineSeparator = LoadTextUtil.detectLineSeparator(f, true);
|
||||
if (detectedLineSeparator == null || nl.equals(detectedLineSeparator)) {
|
||||
@@ -105,15 +108,18 @@ public class GitFileSeparatorConverter {
|
||||
settings.setLineSeparatorsConversion(GitVcsSettings.ConversionPolicy.CONVERT);
|
||||
}
|
||||
selectedFiles = d.getSelectedFiles();
|
||||
} else if (d.getExitCode() == GitConvertFilesDialog.DO_NOT_CONVERT) {
|
||||
}
|
||||
else if (d.getExitCode() == GitConvertFilesDialog.DO_NOT_CONVERT) {
|
||||
if (d.isDontShowAgainChosen()) {
|
||||
settings.setLineSeparatorsConversion(GitVcsSettings.ConversionPolicy.NONE);
|
||||
}
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
//noinspection ThrowableInstanceNeverThrown
|
||||
exceptions.add(new VcsException("Commit was cancelled in file conversion dialog"));
|
||||
}
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
ArrayList<VirtualFile> fileList = new ArrayList<VirtualFile>();
|
||||
for (Set<VirtualFile> fileSet : files.values()) {
|
||||
fileList.addAll(fileSet);
|
||||
@@ -127,7 +133,8 @@ public class GitFileSeparatorConverter {
|
||||
}
|
||||
try {
|
||||
LoadTextUtil.changeLineSeparator(project, GitConvertFilesDialog.class.getName(), f, nl);
|
||||
} catch (IOException e) {
|
||||
}
|
||||
catch (IOException e) {
|
||||
//noinspection ThrowableInstanceNeverThrown
|
||||
exceptions.add(new VcsException("Failed to change line separators for the file: " + f.getPresentableUrl(), e));
|
||||
}
|
||||
|
||||
@@ -16,6 +16,7 @@
|
||||
package git4idea.repo;
|
||||
|
||||
import com.intellij.openapi.Disposable;
|
||||
import com.intellij.openapi.project.Project;
|
||||
import com.intellij.openapi.vfs.LocalFileSystem;
|
||||
import com.intellij.openapi.vfs.VfsUtil;
|
||||
import com.intellij.openapi.vfs.VirtualFile;
|
||||
@@ -54,9 +55,15 @@ final class GitRepositoryUpdater implements Disposable, BulkFileListener {
|
||||
myHeadsDir = VcsUtil.getVirtualFile(myRepositoryFiles.getRefsHeadsPath());
|
||||
myRemotesDir = VcsUtil.getVirtualFile(myRepositoryFiles.getRefsRemotesPath());
|
||||
|
||||
myUpdateQueue = new QueueProcessor<GitRepository.TrackedTopic>(new Updater(repository), repository.getProject().getDisposed());
|
||||
myMessageBusConnection = repository.getProject().getMessageBus().connect();
|
||||
myMessageBusConnection.subscribe(VirtualFileManager.VFS_CHANGES, this);
|
||||
Project project = repository.getProject();
|
||||
myUpdateQueue = new QueueProcessor<GitRepository.TrackedTopic>(new Updater(repository), project.getDisposed());
|
||||
if (!project.isDisposed()) {
|
||||
myMessageBusConnection = project.getMessageBus().connect();
|
||||
myMessageBusConnection.subscribe(VirtualFileManager.VFS_CHANGES, this);
|
||||
}
|
||||
else {
|
||||
myMessageBusConnection = null;
|
||||
}
|
||||
}
|
||||
|
||||
private static void visitGitDirVfs(@NotNull VirtualFile gitDir) {
|
||||
@@ -85,7 +92,9 @@ final class GitRepositoryUpdater implements Disposable, BulkFileListener {
|
||||
if (myWatchRequest != null) {
|
||||
LocalFileSystem.getInstance().removeWatchedRoot(myWatchRequest);
|
||||
}
|
||||
myMessageBusConnection.disconnect();
|
||||
if (myMessageBusConnection != null) {
|
||||
myMessageBusConnection.disconnect();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -104,8 +104,10 @@ public class GitUntrackedFilesHolder implements Disposable, BulkFileListener {
|
||||
}
|
||||
|
||||
void setupVfsListener(@NotNull Project project) {
|
||||
MessageBusConnection connection = project.getMessageBus().connect(this);
|
||||
connection.subscribe(VirtualFileManager.VFS_CHANGES, this);
|
||||
if (!project.isDisposed()) {
|
||||
MessageBusConnection connection = project.getMessageBus().connect(this);
|
||||
connection.subscribe(VirtualFileManager.VFS_CHANGES, this);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -189,22 +189,31 @@ public final class HgCommandExecutor {
|
||||
final String cmdString = String.format("%s %s %s", executable, operation, arguments == null ? "" : StringUtils.join(arguments, " "));
|
||||
|
||||
// log command
|
||||
LOG.info(cmdString);
|
||||
if (!myIsSilent) {
|
||||
LOG.info(cmdString);
|
||||
myVcs.showMessageInConsole(cmdString, ConsoleViewContentType.NORMAL_OUTPUT.getAttributes());
|
||||
}
|
||||
else {
|
||||
LOG.debug(cmdString);
|
||||
}
|
||||
|
||||
// log output if needed
|
||||
if (!myIsSilent && myShowOutput) {
|
||||
LOG.info(result.getRawOutput());
|
||||
myVcs.showMessageInConsole(result.getRawOutput(), ConsoleViewContentType.SYSTEM_OUTPUT.getAttributes());
|
||||
}
|
||||
else {
|
||||
LOG.debug(result.getRawOutput());
|
||||
}
|
||||
|
||||
// log error
|
||||
if (!myIsSilent) {
|
||||
LOG.info(result.getRawError());
|
||||
myVcs.showMessageInConsole(result.getRawError(), ConsoleViewContentType.ERROR_OUTPUT.getAttributes());
|
||||
}
|
||||
else {
|
||||
LOG.debug(result.getRawError());
|
||||
}
|
||||
}
|
||||
|
||||
private void showError(Exception e) {
|
||||
|
||||
Reference in New Issue
Block a user