IDEA-67538: vcs: do not check for todos, etc when shelve or create patch

This commit is contained in:
anna
2012-02-20 09:46:52 +01:00
parent 69808a1863
commit fd856dd16e
5 changed files with 36 additions and 3 deletions
@@ -0,0 +1,23 @@
/*
* Copyright 2000-2012 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.intellij.openapi.vcs.changes;
/**
* User: anna
* Date: 2/17/12
*/
public abstract class LocalCommitExecutor implements CommitExecutorWithHelp {
}
@@ -19,6 +19,7 @@ package com.intellij.openapi.vcs.checkin;
import com.intellij.openapi.Disposable;
import com.intellij.openapi.vcs.VcsException;
import com.intellij.openapi.vcs.changes.CommitExecutor;
import com.intellij.openapi.vcs.changes.LocalCommitExecutor;
import com.intellij.openapi.vcs.ui.RefreshableOnComponent;
import com.intellij.util.PairConsumer;
import org.jetbrains.annotations.Nullable;
@@ -124,4 +125,13 @@ public abstract class CheckinHandler {
*/
public void includedChangesChanged() {
}
/**
* allows to skip before checkin steps when is not applicable. E.g. there should be no check for todos before shelf/create patch
* @param executor current operation (null for commit)
* @return true if handler should be skipped
*/
public boolean acceptExecutor(CommitExecutor executor) {
return executor == null || !(executor instanceof LocalCommitExecutor);
}
}
@@ -32,7 +32,6 @@ import com.intellij.openapi.util.DefaultJDOMExternalizer;
import com.intellij.openapi.util.InvalidDataException;
import com.intellij.openapi.util.JDOMExternalizable;
import com.intellij.openapi.util.WriteExternalException;
import com.intellij.openapi.util.text.StringUtil;
import com.intellij.openapi.vcs.*;
import com.intellij.openapi.vcs.changes.*;
import com.intellij.openapi.vcs.changes.shelf.ShelveChangesManager;
@@ -52,7 +51,7 @@ import java.util.List;
/**
* @author yole
*/
public class CreatePatchCommitExecutor implements CommitExecutorWithHelp, ProjectComponent, JDOMExternalizable {
public class CreatePatchCommitExecutor extends LocalCommitExecutor implements ProjectComponent, JDOMExternalizable {
private static final Logger LOG = Logger.getInstance("#com.intellij.openapi.vcs.changes.patch.CreatePatchCommitExecutor");
private final Project myProject;
@@ -37,7 +37,7 @@ import org.jetbrains.annotations.Nullable;
import javax.swing.*;
import java.util.Collection;
public class ShelveChangesCommitExecutor implements CommitExecutorWithHelp {
public class ShelveChangesCommitExecutor extends LocalCommitExecutor {
private static final Logger LOG = Logger.getInstance("#com.intellij.openapi.vcs.changes.shelf.ShelveChangesCommitExecutor");
private final Project myProject;
@@ -808,6 +808,7 @@ public class CommitChangeListDialog extends DialogWrapper implements CheckinProj
FileDocumentManager.getInstance().saveAllDocuments();
for (CheckinHandler handler : myHandlers) {
if (!(handler.acceptExecutor(executor))) continue;
final CheckinHandler.ReturnResult result = handler.beforeCheckin(executor, myAdditionalData);
if (result == CheckinHandler.ReturnResult.COMMIT) continue;
if (result == CheckinHandler.ReturnResult.CANCEL) {