[patch]: remove option 'include base revision texts into patch'

* this option is usually  used for shelves and it is still available for shelf;
This commit is contained in:
Nadya Zabrodina
2016-05-20 19:07:27 +03:00
parent c2a144b7bb
commit ca1d3c8547
4 changed files with 5 additions and 60 deletions
@@ -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
@@ -72,7 +72,6 @@ public final class VcsConfiguration implements PersistentStateComponent<VcsConfi
public boolean SOFT_WRAPS_IN_SHORT_DIFF = true;
public IgnoreSpaceEnum SHORT_DIFF_IGNORE_SPACE = IgnoreSpaceEnum.NO;
// asked only for non-DVCS
public boolean INCLUDE_TEXT_INTO_PATCH = false;
public boolean INCLUDE_TEXT_INTO_SHELF = false;
public Boolean SHOW_PATCH_IN_EXPLORER = null;
public boolean SHOW_FILE_HISTORY_DETAILS = true;
@@ -29,8 +29,10 @@ import com.intellij.openapi.diff.impl.patch.IdeaTextPatchBuilder;
import com.intellij.openapi.progress.ProcessCanceledException;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.ui.Messages;
import com.intellij.openapi.util.*;
import com.intellij.openapi.vcs.FilePath;
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.vcs.VcsApplicationSettings;
import com.intellij.openapi.vcs.VcsBundle;
import com.intellij.openapi.vcs.VcsConfiguration;
@@ -38,7 +40,6 @@ import com.intellij.openapi.vcs.changes.*;
import com.intellij.openapi.vcs.changes.shelf.ShelveChangesManager;
import com.intellij.openapi.vcs.changes.ui.SessionDialog;
import com.intellij.util.WaitForProgressToShow;
import com.intellij.util.containers.ContainerUtil;
import org.jdom.Element;
import org.jetbrains.annotations.Nls;
import org.jetbrains.annotations.NonNls;
@@ -137,13 +138,6 @@ public class CreatePatchCommitExecutor extends LocalCommitExecutor implements Pr
myPanel.setFileName(ShelveChangesManager.suggestPatchName(myProject, commitMessage, new File(PATCH_PATH), null));
myPanel.setReversePatch(false);
myPanel.setChanges(ContainerUtil.filter(changes, new Condition<Change>() {
@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<FilePath> list = ContainerUtil.map(myPanel.getIncludedChanges(), ChangesUtil::getFilePath);
myCommitContext.putUserData(BaseRevisionTextPatchEP.ourBaseRevisionPaths, list);
}
myCommitContext.putUserData(BaseRevisionTextPatchEP.ourPutBaseRevisionTextKey, false);
int binaryCount = 0;
for(Change change: changes) {
@@ -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<Boolean> myOkEnabledListener;
private final Project myProject;
private List<Change> 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<Change> 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<Change> changes) {
myChanges = new ArrayList<Change>(changes);
}
}