diff --git a/platform/platform-impl/src/com/intellij/openapi/vfs/impl/local/FileWatcher.java b/platform/platform-impl/src/com/intellij/openapi/vfs/impl/local/FileWatcher.java index 9c0460a085b7..ea4349f159c3 100644 --- a/platform/platform-impl/src/com/intellij/openapi/vfs/impl/local/FileWatcher.java +++ b/platform/platform-impl/src/com/intellij/openapi/vfs/impl/local/FileWatcher.java @@ -444,11 +444,13 @@ public class FileWatcher { } private void writeLine(String line) throws IOException { + if (LOG.isDebugEnabled()) { + LOG.debug("to fsnotifier: " + line); + } + + final Process process = notifierProcess; + final BufferedWriter writer = notifierWriter; try { - if (LOG.isDebugEnabled()) { - LOG.debug("to fsnotifier: " + line); - } - final BufferedWriter writer = notifierWriter; if (writer != null) { writer.write(line); writer.newLine(); @@ -457,7 +459,6 @@ public class FileWatcher { } catch (IOException e) { try { - final Process process = notifierProcess; if (process != null) { process.exitValue(); } diff --git a/platform/vcs-api/src/com/intellij/openapi/vcs/checkin/CheckinEnvironment.java b/platform/vcs-api/src/com/intellij/openapi/vcs/checkin/CheckinEnvironment.java index 8e0be5533b9a..46abfb4b7885 100644 --- a/platform/vcs-api/src/com/intellij/openapi/vcs/checkin/CheckinEnvironment.java +++ b/platform/vcs-api/src/com/intellij/openapi/vcs/checkin/CheckinEnvironment.java @@ -67,4 +67,10 @@ public interface CheckinEnvironment extends VcsProviderMarker { List scheduleUnversionedFilesForAddition(List files); boolean keepChangeListAfterCommit(ChangeList changeList); + + /** + * @return true if VFS refresh has to be performed after commit, because files might have changed during commit + * (for example, due to keyword substitution in SVN or read-only status in Perforce). + */ + boolean isRefreshAfterCommitNeeded(); } diff --git a/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/ui/CommitHelper.java b/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/ui/CommitHelper.java index 5d7190756324..8c6817faa73d 100644 --- a/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/ui/CommitHelper.java +++ b/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/ui/CommitHelper.java @@ -378,11 +378,26 @@ public class CommitHelper { } public void customRefresh() { + final List toRefresh = new ArrayList(); + ChangesUtil.processChangesByVcs(myProject, myIncludedChanges, new ChangesUtil.PerVcsProcessor() { + @Override + public void process(AbstractVcs vcs, List items) { + CheckinEnvironment ce = vcs.getCheckinEnvironment(); + if (ce != null && ce.isRefreshAfterCommitNeeded()) { + toRefresh.addAll(items); + } + } + }); + + if (toRefresh.isEmpty()) { + return; + } + final ProgressIndicator indicator = ProgressManager.getInstance().getProgressIndicator(); if (indicator != null) { indicator.setText(VcsBundle.message("commit.dialog.refresh.files")); } - RefreshVFsSynchronously.updateChanges(myIncludedChanges); + RefreshVFsSynchronously.updateChanges(toRefresh); } public Runnable postRefresh() { diff --git a/plugins/cvs/cvs-plugin/src/com/intellij/cvsSupport2/checkinProject/CvsCheckinEnvironment.java b/plugins/cvs/cvs-plugin/src/com/intellij/cvsSupport2/checkinProject/CvsCheckinEnvironment.java index 3cd7729d195c..53fb94bf29df 100644 --- a/plugins/cvs/cvs-plugin/src/com/intellij/cvsSupport2/checkinProject/CvsCheckinEnvironment.java +++ b/plugins/cvs/cvs-plugin/src/com/intellij/cvsSupport2/checkinProject/CvsCheckinEnvironment.java @@ -138,4 +138,9 @@ public class CvsCheckinEnvironment implements CheckinEnvironment { public boolean keepChangeListAfterCommit(ChangeList changeList) { return false; } + + @Override + public boolean isRefreshAfterCommitNeeded() { + return true; + } } diff --git a/plugins/git4idea/src/git4idea/checkin/GitCheckinEnvironment.java b/plugins/git4idea/src/git4idea/checkin/GitCheckinEnvironment.java index c0aa31027c1d..3010687ee3c0 100644 --- a/plugins/git4idea/src/git4idea/checkin/GitCheckinEnvironment.java +++ b/plugins/git4idea/src/git4idea/checkin/GitCheckinEnvironment.java @@ -88,6 +88,11 @@ public class GitCheckinEnvironment implements CheckinEnvironment { return false; } + @Override + public boolean isRefreshAfterCommitNeeded() { + return false; + } + @Nullable public RefreshableOnComponent createAdditionalOptionsPanel(CheckinProjectPanel panel, PairConsumer additionalDataConsumer) { diff --git a/plugins/git4idea/src/git4idea/commands/GitHandler.java b/plugins/git4idea/src/git4idea/commands/GitHandler.java index a5ed7bb705a5..79e0779f14d8 100644 --- a/plugins/git4idea/src/git4idea/commands/GitHandler.java +++ b/plugins/git4idea/src/git4idea/commands/GitHandler.java @@ -109,12 +109,6 @@ public abstract class GitHandler { myAppSettings = GitVcsApplicationSettings.getInstance(); myProjectSettings = GitVcsSettings.getInstance(myProject); myEnv = new HashMap(System.getenv()); - if (!myEnv.containsKey("HOME")) { - String home = System.getProperty("user.home"); - if (home != null) { - myEnv.put("HOME", home); - } - } myVcs = GitVcs.getInstance(project); myWorkingDirectory = directory; myCommandLine = new GeneralCommandLine(); diff --git a/plugins/hg4idea/src/org/zmlx/hg4idea/provider/commit/HgCheckinEnvironment.java b/plugins/hg4idea/src/org/zmlx/hg4idea/provider/commit/HgCheckinEnvironment.java index 4575e17aa35c..25824a7004e4 100644 --- a/plugins/hg4idea/src/org/zmlx/hg4idea/provider/commit/HgCheckinEnvironment.java +++ b/plugins/hg4idea/src/org/zmlx/hg4idea/provider/commit/HgCheckinEnvironment.java @@ -197,6 +197,11 @@ public class HgCheckinEnvironment implements CheckinEnvironment { return false; } + @Override + public boolean isRefreshAfterCommitNeeded() { + return false; + } + private Map> getFilesByRepository(List changes) { Map> result = new HashMap>(); for (Change change : changes) { diff --git a/plugins/svn4idea/src/org/jetbrains/idea/svn17/checkin/SvnCheckinEnvironment17.java b/plugins/svn4idea/src/org/jetbrains/idea/svn17/checkin/SvnCheckinEnvironment17.java index ad86478f601f..94d4c93f9fe0 100644 --- a/plugins/svn4idea/src/org/jetbrains/idea/svn17/checkin/SvnCheckinEnvironment17.java +++ b/plugins/svn4idea/src/org/jetbrains/idea/svn17/checkin/SvnCheckinEnvironment17.java @@ -365,6 +365,11 @@ public class SvnCheckinEnvironment17 implements CheckinEnvironment { return false; } + @Override + public boolean isRefreshAfterCommitNeeded() { + return true; + } + private class KeepLocksComponent implements RefreshableOnComponent { private final JCheckBox myKeepLocksBox; private boolean myIsKeepLocks; diff --git a/plugins/svn4ideaOld/src/org/jetbrains/idea/svn/checkin/SvnCheckinEnvironment.java b/plugins/svn4ideaOld/src/org/jetbrains/idea/svn/checkin/SvnCheckinEnvironment.java index 24dd9af7d295..db6fc79c6f33 100644 --- a/plugins/svn4ideaOld/src/org/jetbrains/idea/svn/checkin/SvnCheckinEnvironment.java +++ b/plugins/svn4ideaOld/src/org/jetbrains/idea/svn/checkin/SvnCheckinEnvironment.java @@ -373,6 +373,11 @@ public class SvnCheckinEnvironment implements CheckinEnvironment { return false; } + @Override + public boolean isRefreshAfterCommitNeeded() { + return true; + } + private class KeepLocksComponent implements RefreshableOnComponent { private final JCheckBox myKeepLocksBox; private boolean myIsKeepLocks;