Commit 6cd889d1 authored by agurov's avatar agurov

Provide interface to use SVN 1.8 diff output options (bug 476177)

https://bugs.eclipse.org/bugs/show_bug.cgi?id=476177

git-svn-id: https://dev.eclipse.org/svnroot/technology/org.eclipse.subversive/trunk@21502 ee007c2a-0a25-0410-9ab9-bf268980928c
parent 23b7a46a
......@@ -974,6 +974,12 @@ public class SVNUIMessages extends BaseMessages {
public static String PatchOptionsPage_Description;
public static String PatchOptionsPage_New;
public static String PatchOptionsPage_Options;
public static String PatchOptionsPage_DiffOutputOptions;
public static String PatchOptionsPage_IgnoreWhitespace;
public static String PatchOptionsPage_IgnoreSpaceChange;
public static String PatchOptionsPage_IgnoreEOLStyle;
public static String PatchOptionsPage_ShowCFunction;
public static String PatchOptionsPage_GITFormat;
public static String PatchOptionsPage_PatchRoot;
public static String PatchOptionsPage_PatchRootProject;
public static String PatchOptionsPage_PatchRootSelection;
......
......@@ -16,6 +16,7 @@ import org.eclipse.jface.action.IAction;
import org.eclipse.jface.wizard.WizardDialog;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.team.svn.core.IStateFilter;
import org.eclipse.team.svn.core.connector.ISVNConnector;
import org.eclipse.team.svn.core.operation.CompositeOperation;
import org.eclipse.team.svn.core.operation.IActionOperation;
import org.eclipse.team.svn.core.operation.local.CreatePatchOperation;
......@@ -48,7 +49,10 @@ public class CreatePatchAction extends AbstractWorkingCopyAction {
CreatePatchWizard wizard = new CreatePatchWizard(targets[0].getName(), targets);
WizardDialog dialog = new WizardDialog(shell, wizard);
if (dialog.open() == 0) {
CreatePatchOperation mainOp = new CreatePatchOperation(wizard.getSelection(), wizard.getFileName(), wizard.isRecursive(), wizard.isIgnoreDeleted(), wizard.isProcessBinary(), wizard.isProcessUnversioned(), wizard.getRootPoint());
CreatePatchOperation mainOp =
new CreatePatchOperation(
wizard.getSelection(), wizard.getFileName(), wizard.isRecursive(), wizard.isProcessUnversioned(),
ISVNConnector.Options.IGNORE_ANCESTRY | wizard.getDiffOptions(), wizard.getRootPoint(), wizard.getDiffOutputOptions());
CompositeOperation op = new CompositeOperation(mainOp.getId(), mainOp.getMessagesClass());
op.add(mainOp);
switch (wizard.getWriteMode()) {
......
......@@ -65,7 +65,7 @@ public class CreatePatchAction extends AbstractRepositoryModifyWorkspaceAction {
}
public static IActionOperation getCreatePatchOperation(IRepositoryResource first, IRepositoryResource second, CreatePatchWizard wizard) {
CreatePatchOperation mainOp = new CreatePatchOperation(first, second, wizard.getFileName(), wizard.isRecursive(), wizard.isIgnoreDeleted(), wizard.isProcessBinary(), wizard.isIgnoreAncestry());
CreatePatchOperation mainOp = new CreatePatchOperation(first, second, wizard.getFileName(), wizard.isRecursive(), wizard.getDiffOptions(), wizard.getDiffOutputOptions());
CompositeOperation op = new CompositeOperation(mainOp.getId(), mainOp.getMessagesClass());
op.add(mainOp);
switch (wizard.getWriteMode()) {
......
......@@ -1375,6 +1375,12 @@ PatchOptionsPage_New = Process &new resources
PatchOptionsPage_Ancestry = Ignore &ancestry
PatchOptionsPage_ProcessBinary_Verifier = Process binary
PatchOptionsPage_ProcessBinary_Verifier_Warning = SVN does not handle the creation of patches for binary files. So, enable this option only if files marked as binary contains non-binary content.
PatchOptionsPage_DiffOutputOptions = Diff output options
PatchOptionsPage_IgnoreWhitespace = Ignore difference in &whitespace completely
PatchOptionsPage_IgnoreSpaceChange = Ignore difference in &space numbers
PatchOptionsPage_IgnoreEOLStyle = Ignore difference in &EOL style
PatchOptionsPage_ShowCFunction = Show &C function name
PatchOptionsPage_GITFormat = Use extended &GIT's format for patch files
PatchOptionsPage_PatchRoot = Patch Root
PatchOptionsPage_PatchRootWorkspace = Workspace (Multi-project Apply Patch wizard specific)
PatchOptionsPage_PatchRootProject = Project
......
......@@ -18,6 +18,7 @@ import org.eclipse.core.resources.IResource;
import org.eclipse.core.resources.ResourcesPlugin;
import org.eclipse.core.runtime.Path;
import org.eclipse.jface.wizard.IWizardPage;
import org.eclipse.team.svn.core.connector.ISVNConnector;
import org.eclipse.team.svn.ui.SVNUIMessages;
import org.eclipse.team.svn.ui.wizard.createpatch.PatchOptionsPage;
import org.eclipse.team.svn.ui.wizard.createpatch.SelectPatchFilePage;
......@@ -90,7 +91,18 @@ public class CreatePatchWizard extends AbstractSVNWizard {
public boolean isRecursive() {
return this.options.isRecursive() & this.selectFile.isRecursive();
}
public long getDiffOptions() {
return
(this.isIgnoreAncestry() ? ISVNConnector.Options.IGNORE_ANCESTRY : ISVNConnector.Options.NONE) |
(this.isIgnoreDeleted() ? ISVNConnector.Options.SKIP_DELETED : ISVNConnector.Options.NONE) |
(this.isProcessBinary() ? ISVNConnector.Options.FORCE : ISVNConnector.Options.NONE);
}
public long getDiffOutputOptions() {
return this.options.getDiffOutputOptions();
}
public IResource []getSelection() {
return this.selectFile.isRecursive() ? this.roots : this.selectFile.getSelection();
}
......
......@@ -20,6 +20,9 @@ import org.eclipse.swt.widgets.Button;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Control;
import org.eclipse.swt.widgets.Group;
import org.eclipse.team.svn.core.connector.ISVNConnector;
import org.eclipse.team.svn.core.extension.CoreExtensionsManager;
import org.eclipse.team.svn.core.extension.factory.ISVNConnectorFactory;
import org.eclipse.team.svn.core.operation.local.CreatePatchOperation;
import org.eclipse.team.svn.ui.SVNTeamUIPlugin;
import org.eclipse.team.svn.ui.SVNUIMessages;
......@@ -44,6 +47,8 @@ public class PatchOptionsPage extends AbstractVerifiedWizardPage {
protected int rootPoint;
protected boolean multiSelect;
protected long diffOutputOptions;
protected Button rootSelection;
protected Button rootProject;
protected Button rootWorkspace;
......@@ -97,6 +102,10 @@ public class PatchOptionsPage extends AbstractVerifiedWizardPage {
public boolean isIgnoreAncestry() {
return this.showIgnoreAncestry ? this.ignoreAncestry : true;
}
public long getDiffOutputOptions() {
return this.diffOutputOptions;
}
protected Composite createControlImpl(Composite parent) {
GridLayout layout = null;
......@@ -189,6 +198,95 @@ public class PatchOptionsPage extends AbstractVerifiedWizardPage {
showIgnoreAncestryButton.setSelection(this.ignoreAncestry);
}
if (CoreExtensionsManager.instance().getSVNConnectorFactory().getSVNAPIVersion() >= ISVNConnectorFactory.APICompatibility.SVNAPI_1_8_x) {
Group outputOptions = new Group(composite, SWT.NONE);
outputOptions.setText(SVNUIMessages.PatchOptionsPage_DiffOutputOptions);
layout = new GridLayout();
outputOptions.setLayout(layout);
data = new GridData(GridData.FILL_HORIZONTAL);
outputOptions.setLayoutData(data);
Button ignoreWhitespaceButton = new Button(outputOptions, SWT.CHECK);
data = new GridData();
ignoreWhitespaceButton.setLayoutData(data);
ignoreWhitespaceButton.setText(SVNUIMessages.PatchOptionsPage_IgnoreWhitespace);
ignoreWhitespaceButton.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
if (((Button)e.widget).getSelection()) {
PatchOptionsPage.this.diffOutputOptions |= ISVNConnector.DiffOptions.IGNORE_WHITESPACE;
}
else {
PatchOptionsPage.this.diffOutputOptions &= ~ISVNConnector.DiffOptions.IGNORE_WHITESPACE;
}
}
});
ignoreWhitespaceButton.setSelection((this.diffOutputOptions & ISVNConnector.DiffOptions.IGNORE_WHITESPACE) != 0);
Button ignoreSpaceChangeButton = new Button(outputOptions, SWT.CHECK);
data = new GridData();
ignoreSpaceChangeButton.setLayoutData(data);
ignoreSpaceChangeButton.setText(SVNUIMessages.PatchOptionsPage_IgnoreSpaceChange);
ignoreSpaceChangeButton.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
if (((Button)e.widget).getSelection()) {
PatchOptionsPage.this.diffOutputOptions |= ISVNConnector.DiffOptions.IGNORE_SPACE_CHANGE;
}
else {
PatchOptionsPage.this.diffOutputOptions &= ~ISVNConnector.DiffOptions.IGNORE_SPACE_CHANGE;
}
}
});
ignoreSpaceChangeButton.setSelection((this.diffOutputOptions & ISVNConnector.DiffOptions.IGNORE_SPACE_CHANGE) != 0);
Button ignoreEOLStyleButton = new Button(outputOptions, SWT.CHECK);
data = new GridData();
ignoreEOLStyleButton.setLayoutData(data);
ignoreEOLStyleButton.setText(SVNUIMessages.PatchOptionsPage_IgnoreEOLStyle);
ignoreEOLStyleButton.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
if (((Button)e.widget).getSelection()) {
PatchOptionsPage.this.diffOutputOptions |= ISVNConnector.DiffOptions.IGNORE_EOL_STYLE;
}
else {
PatchOptionsPage.this.diffOutputOptions &= ~ISVNConnector.DiffOptions.IGNORE_EOL_STYLE;
}
}
});
ignoreEOLStyleButton.setSelection((this.diffOutputOptions & ISVNConnector.DiffOptions.IGNORE_EOL_STYLE) != 0);
Button showCFunctionButton = new Button(outputOptions, SWT.CHECK);
data = new GridData();
showCFunctionButton.setLayoutData(data);
showCFunctionButton.setText(SVNUIMessages.PatchOptionsPage_ShowCFunction);
showCFunctionButton.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
if (((Button)e.widget).getSelection()) {
PatchOptionsPage.this.diffOutputOptions |= ISVNConnector.DiffOptions.SHOW_FUNCTION;
}
else {
PatchOptionsPage.this.diffOutputOptions &= ~ISVNConnector.DiffOptions.SHOW_FUNCTION;
}
}
});
showCFunctionButton.setSelection((this.diffOutputOptions & ISVNConnector.DiffOptions.SHOW_FUNCTION) != 0);
Button useGITFormatButton = new Button(outputOptions, SWT.CHECK);
data = new GridData();
useGITFormatButton.setLayoutData(data);
useGITFormatButton.setText(SVNUIMessages.PatchOptionsPage_GITFormat);
useGITFormatButton.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
if (((Button)e.widget).getSelection()) {
PatchOptionsPage.this.diffOutputOptions |= ISVNConnector.DiffOptions.GIT_FORMAT;
}
else {
PatchOptionsPage.this.diffOutputOptions &= ~ISVNConnector.DiffOptions.GIT_FORMAT;
}
}
});
useGITFormatButton.setSelection((this.diffOutputOptions & ISVNConnector.DiffOptions.GIT_FORMAT) != 0);
}
if (this.localMode) {
Group patchRoot = new Group(composite, SWT.NONE);
patchRoot.setText(SVNUIMessages.PatchOptionsPage_PatchRoot);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment