diff --git a/platform/vcs-api/src/com/intellij/openapi/vcs/VcsConfiguration.java b/platform/vcs-api/src/com/intellij/openapi/vcs/VcsConfiguration.java index 0bb1cb05f874..2ef1bc8fa21a 100644 --- a/platform/vcs-api/src/com/intellij/openapi/vcs/VcsConfiguration.java +++ b/platform/vcs-api/src/com/intellij/openapi/vcs/VcsConfiguration.java @@ -126,6 +126,7 @@ public final class VcsConfiguration implements PersistentStateComponent } public boolean FORCE_NON_EMPTY_COMMENT = false; + public boolean CLEAR_INITIAL_COMMIT_MESSAGE = false; private final ArrayList myLastCommitMessages = new ArrayList(); public String LAST_COMMIT_MESSAGE = null; diff --git a/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/ui/CommitChangeListDialog.java b/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/ui/CommitChangeListDialog.java index 3693b6221be9..16c165644ae2 100644 --- a/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/ui/CommitChangeListDialog.java +++ b/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/ui/CommitChangeListDialog.java @@ -321,20 +321,8 @@ public class CommitChangeListDialog extends DialogWrapper implements CheckinProj myCommitMessageArea = new CommitMessage(project); - if (comment != null) { - setCommitMessage(comment); - myLastKnownComment = comment; - myLastSelectedListName = initialSelection == null ? myBrowser.getSelectedChangeList().getName() : initialSelection.getName(); - } else { - updateComment(); - - if (StringUtil.isEmptyOrSpaces(myCommitMessageArea.getComment())) { - setCommitMessage(VcsConfiguration.getInstance(project).LAST_COMMIT_MESSAGE); - final String messageFromVcs = getInitialMessageFromVcs(); - if (messageFromVcs != null) { - myCommitMessageArea.setText(messageFromVcs); - } - } + if (!VcsConfiguration.getInstance(project).CLEAR_INITIAL_COMMIT_MESSAGE) { + setComment(project, initialSelection, comment); } myActionName = VcsBundle.message("commit.dialog.title"); @@ -471,6 +459,24 @@ public class CommitChangeListDialog extends DialogWrapper implements CheckinProj showDetailsIfSaved(); } + private void setComment(Project project, LocalChangeList initialSelection, String comment) { + if (comment != null) { + setCommitMessage(comment); + myLastKnownComment = comment; + myLastSelectedListName = initialSelection == null ? myBrowser.getSelectedChangeList().getName() : initialSelection.getName(); + } else { + updateComment(); + + if (StringUtil.isEmptyOrSpaces(myCommitMessageArea.getComment())) { + setCommitMessage(VcsConfiguration.getInstance(project).LAST_COMMIT_MESSAGE); + final String messageFromVcs = getInitialMessageFromVcs(); + if (messageFromVcs != null) { + myCommitMessageArea.setText(messageFromVcs); + } + } + } + } + private void showDetailsIfSaved() { String value = PropertiesComponent.getInstance().getValue(DETAILS_SHOW_OPTION); if (value != null) { @@ -710,6 +716,7 @@ public class CommitChangeListDialog extends DialogWrapper implements CheckinProj } private void updateComment() { + if (VcsConfiguration.getInstance(getProject()).CLEAR_INITIAL_COMMIT_MESSAGE) return; final LocalChangeList list = (LocalChangeList) myBrowser.getSelectedChangeList(); if (list == null || (list.getName().equals(myLastSelectedListName))) { return; diff --git a/platform/vcs-impl/src/com/intellij/openapi/vcs/configurable/VcsGeneralConfigurationPanel.form b/platform/vcs-impl/src/com/intellij/openapi/vcs/configurable/VcsGeneralConfigurationPanel.form index 207841e3db13..ac45cac42c5b 100644 --- a/platform/vcs-impl/src/com/intellij/openapi/vcs/configurable/VcsGeneralConfigurationPanel.form +++ b/platform/vcs-impl/src/com/intellij/openapi/vcs/configurable/VcsGeneralConfigurationPanel.form @@ -152,7 +152,7 @@ - + @@ -186,7 +186,7 @@ - + @@ -212,7 +212,7 @@ - + @@ -236,6 +236,14 @@ + + + + + + + + diff --git a/platform/vcs-impl/src/com/intellij/openapi/vcs/configurable/VcsGeneralConfigurationPanel.java b/platform/vcs-impl/src/com/intellij/openapi/vcs/configurable/VcsGeneralConfigurationPanel.java index a8007ab2fec8..2b1b63bf1b6f 100644 --- a/platform/vcs-impl/src/com/intellij/openapi/vcs/configurable/VcsGeneralConfigurationPanel.java +++ b/platform/vcs-impl/src/com/intellij/openapi/vcs/configurable/VcsGeneralConfigurationPanel.java @@ -28,6 +28,7 @@ import com.intellij.openapi.vfs.ReadonlyStatusHandler; import com.intellij.util.ui.UIUtil; import org.jetbrains.annotations.Nls; import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; import javax.swing.*; import java.awt.*; @@ -62,6 +63,7 @@ public class VcsGeneralConfigurationPanel implements SearchableConfigurable { private JCheckBox myCbOfferToMoveChanges; private JComboBox myFailedCommitChangelistCombo; private JComboBox myOnPatchCreation; + private JCheckBox myClearInitialCommitMessage; private ButtonGroup myEmptyChangelistRemovingGroup; public VcsGeneralConfigurationPanel(final Project project) { @@ -101,6 +103,7 @@ public class VcsGeneralConfigurationPanel implements SearchableConfigurable { VcsConfiguration settings = VcsConfiguration.getInstance(myProject); settings.FORCE_NON_EMPTY_COMMENT = myForceNonEmptyComment.isSelected(); + settings.CLEAR_INITIAL_COMMIT_MESSAGE = myClearInitialCommitMessage.isSelected(); settings.OFFER_MOVE_TO_ANOTHER_CHANGELIST_ON_PARTIAL_COMMIT = myCbOfferToMoveChanges.isSelected(); settings.REMOVE_EMPTY_INACTIVE_CHANGELISTS = getSelected(myEmptyChangelistRemovingGroup); settings.MOVE_TO_FAILED_COMMIT_CHANGELIST = getFailedCommitConfirm(); @@ -120,6 +123,7 @@ public class VcsGeneralConfigurationPanel implements SearchableConfigurable { settings.SHOW_PATCH_IN_EXPLORER = getShowPatchValue(); } + @Nullable private Boolean getShowPatchValue() { final int index = myOnPatchCreation.getSelectedIndex(); if (index == 0) { @@ -176,6 +180,9 @@ public class VcsGeneralConfigurationPanel implements SearchableConfigurable { if (settings.FORCE_NON_EMPTY_COMMENT != myForceNonEmptyComment.isSelected()){ return true; } + if (settings.CLEAR_INITIAL_COMMIT_MESSAGE != myClearInitialCommitMessage.isSelected()){ + return true; + } if (settings.OFFER_MOVE_TO_ANOTHER_CHANGELIST_ON_PARTIAL_COMMIT != myCbOfferToMoveChanges.isSelected()){ return true; } @@ -205,6 +212,7 @@ public class VcsGeneralConfigurationPanel implements SearchableConfigurable { public void reset() { VcsConfiguration settings = VcsConfiguration.getInstance(myProject); myForceNonEmptyComment.setSelected(settings.FORCE_NON_EMPTY_COMMENT); + myClearInitialCommitMessage.setSelected(settings.CLEAR_INITIAL_COMMIT_MESSAGE); myCbOfferToMoveChanges.setSelected(settings.OFFER_MOVE_TO_ANOTHER_CHANGELIST_ON_PARTIAL_COMMIT); int id = settings.REMOVE_EMPTY_INACTIVE_CHANGELISTS.getId(); UIUtil.setSelectedButton(myEmptyChangelistRemovingGroup, id == 0 ? 0 : id == 1 ? 2 : 1); @@ -291,6 +299,7 @@ public class VcsGeneralConfigurationPanel implements SearchableConfigurable { return null; } + @NotNull public String getHelpTopic() { return "project.propVCSSupport.Confirmation"; }