From ca1d3c8547f573c0991e4286ae1b780c98ee454c Mon Sep 17 00:00:00 2001 From: Nadya Zabrodina Date: Fri, 20 May 2016 18:27:22 +0300 Subject: [PATCH] [patch]: remove option 'include base revision texts into patch' * this option is usually used for shelves and it is still available for shelf; --- .../src/messages/VcsBundle.properties | 2 - .../openapi/vcs/VcsConfiguration.java | 1 - .../patch/CreatePatchCommitExecutor.java | 22 +++------- .../patch/CreatePatchConfigurationPanel.java | 40 ------------------- 4 files changed, 5 insertions(+), 60 deletions(-) diff --git a/platform/platform-resources-en/src/messages/VcsBundle.properties b/platform/platform-resources-en/src/messages/VcsBundle.properties index 99c01d7acbeb..38193c114b90 100644 --- a/platform/platform-resources-en/src/messages/VcsBundle.properties +++ b/platform/platform-resources-en/src/messages/VcsBundle.properties @@ -436,8 +436,6 @@ changes.remove.active.empty.prompt=Select the changelist to make active: changes.remove.active.title=Delete Active Changelist create.patch.loading.content.progress=Loading Content Revisions create.patch.reverse.checkbox=&Reverse patch -create.patch.base.revision=&Include entire base revision content into patch file -create.patch.base.revision.tooltip = For all modified non-binary files smaller than 500kB store their entire base revision texts inside the patch file. create.patch.file.path=&Patch file: create.patch.encoding=Encoding: committed.changes.refresh.progress=Refreshing VCS history 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 0793b65c9013..0477f35d3d3b 100644 --- a/platform/vcs-api/src/com/intellij/openapi/vcs/VcsConfiguration.java +++ b/platform/vcs-api/src/com/intellij/openapi/vcs/VcsConfiguration.java @@ -72,7 +72,6 @@ public final class VcsConfiguration implements PersistentStateComponent() { - @Override - public boolean value(Change change) { - return change.getBeforeRevision() != null && change.getAfterRevision() != null; - } - })); - myPanel.showTextStoreOption(); JComponent panel = myPanel.getPanel(); panel.putClientProperty(SessionDialog.VCS_CONFIGURATION_UI_TITLE, "Patch File Settings"); return panel; @@ -188,13 +182,7 @@ public class CreatePatchCommitExecutor extends LocalCommitExecutor implements Pr }, ModalityState.NON_MODAL, myProject); return; } - myPanel.onOk(); - boolean storeTexts = myPanel.isStoreTexts(); - myCommitContext.putUserData(BaseRevisionTextPatchEP.ourPutBaseRevisionTextKey, storeTexts); - if (storeTexts) { - final List list = ContainerUtil.map(myPanel.getIncludedChanges(), ChangesUtil::getFilePath); - myCommitContext.putUserData(BaseRevisionTextPatchEP.ourBaseRevisionPaths, list); - } + myCommitContext.putUserData(BaseRevisionTextPatchEP.ourPutBaseRevisionTextKey, false); int binaryCount = 0; for(Change change: changes) { diff --git a/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/patch/CreatePatchConfigurationPanel.java b/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/patch/CreatePatchConfigurationPanel.java index 29deb1ce7464..56036aa94e42 100644 --- a/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/patch/CreatePatchConfigurationPanel.java +++ b/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/patch/CreatePatchConfigurationPanel.java @@ -23,7 +23,6 @@ package com.intellij.openapi.vcs.changes.patch; import com.intellij.ide.IdeBundle; -import com.intellij.openapi.diff.impl.patch.SelectFilesToAddTextsToPatchPanel; import com.intellij.openapi.fileChooser.FileChooserFactory; import com.intellij.openapi.fileChooser.FileSaverDescriptor; import com.intellij.openapi.fileChooser.FileSaverDialog; @@ -33,8 +32,6 @@ import com.intellij.openapi.ui.TextFieldWithBrowseButton; import com.intellij.openapi.util.io.FileUtil; import com.intellij.openapi.util.text.StringUtil; import com.intellij.openapi.vcs.VcsBundle; -import com.intellij.openapi.vcs.VcsConfiguration; -import com.intellij.openapi.vcs.changes.Change; import com.intellij.openapi.vfs.CharsetToolkit; import com.intellij.openapi.vfs.LocalFileSystem; import com.intellij.openapi.vfs.VirtualFile; @@ -50,9 +47,6 @@ import javax.swing.*; import java.awt.event.*; import java.io.File; import java.nio.charset.Charset; -import java.util.ArrayList; -import java.util.Collection; -import java.util.List; public class CreatePatchConfigurationPanel { private static final String SYSTEM_DEFAULT = IdeBundle.message("encoding.name.system.default", CharsetToolkit.getDefaultSystemCharset().displayName()); @@ -62,10 +56,8 @@ public class CreatePatchConfigurationPanel { private JCheckBox myReversePatchCheckbox; private JComboBox myEncoding; private JLabel myErrorLabel; - private JCheckBox myIncludeBaseRevisionTextCheckBox; private Consumer myOkEnabledListener; private final Project myProject; - private List myChanges; private boolean myExecute; public CreatePatchConfigurationPanel(@NotNull final Project project) { @@ -91,7 +83,6 @@ public class CreatePatchConfigurationPanel { } }); - myIncludeBaseRevisionTextCheckBox.setVisible(false); myFileNameField.getTextField().addInputMethodListener(new InputMethodListener() { public void inputMethodTextChanged(final InputMethodEvent event) { checkName(); @@ -146,27 +137,16 @@ public class CreatePatchConfigurationPanel { myFileNameField = new TextFieldWithBrowseButton(); myReversePatchCheckbox = new JCheckBox(VcsBundle.message("create.patch.reverse.checkbox")); myEncoding = new ComboBox(); - myIncludeBaseRevisionTextCheckBox = new JCheckBox(VcsBundle.message("create.patch.base.revision", 0)); - myIncludeBaseRevisionTextCheckBox.setToolTipText(VcsBundle.message("create.patch.base.revision.tooltip")); myErrorLabel = new JLabel(); myMainPanel = FormBuilder.createFormBuilder() .addLabeledComponent(VcsBundle.message("create.patch.file.path"), myFileNameField) .addComponent(myReversePatchCheckbox) - .addComponent(myIncludeBaseRevisionTextCheckBox) .addLabeledComponent(VcsBundle.message("create.patch.encoding"), myEncoding) .addComponent(myErrorLabel) .getPanel(); } - public void showTextStoreOption() { - if (myChanges.size() > 0) { - myIncludeBaseRevisionTextCheckBox.setVisible(true); - final VcsConfiguration configuration = VcsConfiguration.getInstance(myProject); - myIncludeBaseRevisionTextCheckBox.setSelected(configuration.INCLUDE_TEXT_INTO_PATCH); - } - } - private void checkName() { final PatchNameChecker patchNameChecker = new PatchNameChecker(getFileName()); if (patchNameChecker.nameOk()) { @@ -181,22 +161,6 @@ public class CreatePatchConfigurationPanel { } } - public void onOk() { - if (myIncludeBaseRevisionTextCheckBox.isVisible()) { - final VcsConfiguration vcsConfiguration = VcsConfiguration.getInstance(myProject); - vcsConfiguration.INCLUDE_TEXT_INTO_PATCH = myIncludeBaseRevisionTextCheckBox.isSelected(); - } - } - - public boolean isStoreTexts() { - return myIncludeBaseRevisionTextCheckBox.isSelected(); - } - - public Collection getIncludedChanges() { - myChanges.removeAll(SelectFilesToAddTextsToPatchPanel.getBig(myChanges)) ; - return myChanges; - } - public JComponent getPanel() { return myMainPanel; } @@ -229,8 +193,4 @@ public class CreatePatchConfigurationPanel { public String getError() { return myErrorLabel.getText() == null ? "" : myErrorLabel.getText(); } - - public void setChanges(@NotNull Collection changes) { - myChanges = new ArrayList(changes); - } } \ No newline at end of file