diff --git a/plugins/svn4idea/gen/icons/SvnIcons.java b/plugins/svn4idea/gen/icons/SvnIcons.java index b6e25eea279b..f9c3192bd446 100644 --- a/plugins/svn4idea/gen/icons/SvnIcons.java +++ b/plugins/svn4idea/gen/icons/SvnIcons.java @@ -30,7 +30,6 @@ public final class SvnIcons { public static final Icon MarkAsMerged = load("/icons/MarkAsMerged.png"); // 16x16 public static final Icon MarkAsNotMerged = load("/icons/MarkAsNotMerged.png"); // 16x16 public static final Icon Notintegrated = load("/icons/Notintegrated.png"); // 16x16 - public static final Icon PropertiesDiff = load("/icons/PropertiesDiff.png"); // 16x16 public static final Icon ShowIntegratedFrom = load("/icons/ShowIntegratedFrom.png"); // 16x16 public static final Icon UndoIntegrateToBranch = load("/icons/UndoIntegrateToBranch.png"); // 16x16 } diff --git a/plugins/svn4idea/resources/icons/PropertiesDiff.png b/plugins/svn4idea/resources/icons/PropertiesDiff.png deleted file mode 100644 index 287843f949a1..000000000000 Binary files a/plugins/svn4idea/resources/icons/PropertiesDiff.png and /dev/null differ diff --git a/plugins/svn4idea/src/META-INF/plugin.xml b/plugins/svn4idea/src/META-INF/plugin.xml index 19c6d261c79c..523979a73df8 100644 --- a/plugins/svn4idea/src/META-INF/plugin.xml +++ b/plugins/svn4idea/src/META-INF/plugin.xml @@ -35,9 +35,6 @@ - - - diff --git a/plugins/svn4idea/src/org/jetbrains/idea/svn/SvnBundle.properties b/plugins/svn4idea/src/org/jetbrains/idea/svn/SvnBundle.properties index f762979bbe03..737acaafdc94 100644 --- a/plugins/svn4idea/src/org/jetbrains/idea/svn/SvnBundle.properties +++ b/plugins/svn4idea/src/org/jetbrains/idea/svn/SvnBundle.properties @@ -583,8 +583,6 @@ action.working.copies.map.correct.roots.button.text=Correct &Roots action.working.copies.map.correct.warning.text=Some folders marked in 'Project Settings | Version Control' as under Subversion control,\n\ are unversioned (Versioned folders may be under them).\n\ You can use 'Correct Roots' button to perform auto correction. -action.Subversion.properties.difference.diff.title=Subversion properties difference: {0} -action.Subversion.properties.difference.diff.for.move.title=Subversion properties difference: {0} -> {1} message.Subversion.files.can.not.be.added.to.subversion.are.not.under.working.copy.text=File(s) {0} can not be added to Subversion control since they are not under working copy. action.Subversion.integrate.difference.option.use.ancestry.text=&Use ancestry fatal.Subversion.javasvn.jar.library.version.test=javasvn.jar library is old;\nPlease make sure installation was made properly. @@ -620,12 +618,10 @@ loading.default.branches.configuration.text=Loading default branches configurati loading.data.for.root.text=Loading data for {0} action.Subversion.TogglePropertiesDiff.text=Show properties action.Subversion.TogglePropertiesDiff.description=Show differences in SVN properties -action.PropertiesDiff.text=Compare Subversion Properties action.IntegrateChangeSetAction.text=Integrate to Branch dialog.map.working.copies.button.refresh.text=Re&fresh refreshing.working.copies.roots.progress.text=Refreshing working copies roots... retrieving.subversion.status.text=Retrieving Subversion status... -fetching.properties.contents.progress.title=Fetching properties contents... show.properties.diff.progress.text.revision.information=Revision {0} show.properties.diff.progress.text2.property.information=Property {0} svn.checkout.destination.directory.title=Destination Directory diff --git a/plugins/svn4idea/src/org/jetbrains/idea/svn/actions/ShowPropertiesDiffAction.java b/plugins/svn4idea/src/org/jetbrains/idea/svn/actions/ShowPropertiesDiffAction.java deleted file mode 100644 index 1343fc545b32..000000000000 --- a/plugins/svn4idea/src/org/jetbrains/idea/svn/actions/ShowPropertiesDiffAction.java +++ /dev/null @@ -1,208 +0,0 @@ -// Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. -package org.jetbrains.idea.svn.actions; - -import com.intellij.diff.DiffManager; -import com.intellij.openapi.actionSystem.AnAction; -import com.intellij.openapi.actionSystem.AnActionEvent; -import com.intellij.openapi.progress.PerformInBackgroundOption; -import com.intellij.openapi.progress.ProgressIndicator; -import com.intellij.openapi.progress.Task; -import com.intellij.openapi.project.DumbAware; -import com.intellij.openapi.project.Project; -import com.intellij.openapi.ui.Messages; -import com.intellij.openapi.vcs.FilePath; -import com.intellij.openapi.vcs.VcsDataKeys; -import com.intellij.openapi.vcs.changes.Change; -import com.intellij.openapi.vcs.changes.ChangesUtil; -import com.intellij.openapi.vcs.changes.ContentRevision; -import com.intellij.openapi.vcs.changes.CurrentContentRevision; -import org.jetbrains.annotations.NotNull; -import org.jetbrains.annotations.Nullable; -import org.jetbrains.idea.svn.SvnBaseContentRevision; -import org.jetbrains.idea.svn.SvnBundle; -import org.jetbrains.idea.svn.SvnRevisionNumber; -import org.jetbrains.idea.svn.SvnVcs; -import org.jetbrains.idea.svn.api.Revision; -import org.jetbrains.idea.svn.api.Target; -import org.jetbrains.idea.svn.commandLine.SvnBindException; -import org.jetbrains.idea.svn.difftool.properties.SvnPropertiesDiffRequest; -import org.jetbrains.idea.svn.difftool.properties.SvnPropertiesDiffRequest.PropertyContent; -import org.jetbrains.idea.svn.history.SvnLazyPropertyContentRevision; -import org.jetbrains.idea.svn.history.SvnRepositoryContentRevision; -import org.jetbrains.idea.svn.properties.PropertyData; - -import java.io.File; -import java.util.Collections; -import java.util.List; - -import static com.intellij.openapi.actionSystem.CommonDataKeys.PROJECT; -import static com.intellij.util.ObjectUtils.notNull; -import static com.intellij.util.containers.ContainerUtil.exists; - -public class ShowPropertiesDiffAction extends AnAction implements DumbAware { - - @Override - public void update(@NotNull AnActionEvent e) { - boolean isVisible = checkThatChangesAreUnderSvn(e.getData(VcsDataKeys.CHANGES)); - - e.getPresentation().setVisible(isVisible); - e.getPresentation().setEnabled(isVisible && e.getProject() != null); - } - - private static boolean checkThatChangesAreUnderSvn(@Nullable Change[] changes) { - return changes != null && exists(changes, change -> isUnderSvn(change.getBeforeRevision()) || isUnderSvn(change.getAfterRevision())); - } - - private static boolean isUnderSvn(@Nullable ContentRevision revision) { - return revision instanceof SvnBaseContentRevision; - } - - @Override - public void actionPerformed(@NotNull AnActionEvent e) { - Change[] changes = e.getData(VcsDataKeys.CHANGE_LEAD_SELECTION); - - if (checkThatChangesAreUnderSvn(changes)) { - new CalculateAndShow(e.getRequiredData(PROJECT), changes[0], e.getPresentation().getText()).queue(); - } - } - - private static class CalculateAndShow extends Task.Backgroundable { - private final Change myChange; - private List myBeforeContent; - private List myAfterContent; - private Revision myBeforeRevisionValue; - private Revision myAfterRevision; - private SvnBindException myException; - private final String myErrorTitle; - - private CalculateAndShow(@NotNull Project project, Change change, String errorTitle) { - super(project, SvnBundle.message("fetching.properties.contents.progress.title"), true, PerformInBackgroundOption.DEAF); - myChange = change; - myErrorTitle = errorTitle; - } - - @Override - public void run(@NotNull ProgressIndicator indicator) { - SvnVcs vcs = SvnVcs.getInstance(myProject); - - try { - myBeforeRevisionValue = getBeforeRevisionValue(myChange); - myAfterRevision = getAfterRevisionValue(myChange); - - myBeforeContent = getPropertyList(vcs, myChange.getBeforeRevision(), myBeforeRevisionValue); - indicator.checkCanceled(); - // gets exactly WORKING revision property - myAfterContent = getPropertyList(vcs, myChange.getAfterRevision(), myAfterRevision); - } - catch (SvnBindException exc) { - myException = exc; - } - } - - @Override - public void onSuccess() { - if (myException != null) { - Messages.showErrorDialog(myException.getMessage(), myErrorTitle); - return; - } - if (myBeforeContent != null && myAfterContent != null && myBeforeRevisionValue != null && myAfterRevision != null) { - SvnPropertiesDiffRequest diffRequest; - if (compareRevisions(myBeforeRevisionValue, myAfterRevision) > 0) { - diffRequest = new SvnPropertiesDiffRequest(getDiffWindowTitle(myChange), - new PropertyContent(myAfterContent), new PropertyContent(myBeforeContent), - revisionToString(myAfterRevision), revisionToString(myBeforeRevisionValue)); - } - else { - diffRequest = new SvnPropertiesDiffRequest(getDiffWindowTitle(myChange), - new PropertyContent(myBeforeContent), new PropertyContent(myAfterContent), - revisionToString(myBeforeRevisionValue), revisionToString(myAfterRevision)); - } - DiffManager.getInstance().showDiff(myProject, diffRequest); - } - } - } - - @NotNull - private static Revision getBeforeRevisionValue(@NotNull Change change) { - ContentRevision beforeRevision = change.getBeforeRevision(); - if (beforeRevision != null) { - return ((SvnRevisionNumber)beforeRevision.getRevisionNumber()).getRevision(); - } - else { - return Revision.of(((SvnRevisionNumber)notNull(change.getAfterRevision()).getRevisionNumber()).getRevision().getNumber() - 1); - } - } - - @NotNull - private static Revision getAfterRevisionValue(@NotNull Change change) { - ContentRevision afterRevision = change.getAfterRevision(); - if (afterRevision != null) { - // CurrentContentRevision will be here, for instance, if invoked from changes dialog for "Compare with Branch" action - return afterRevision instanceof CurrentContentRevision - ? Revision.WORKING - : ((SvnRevisionNumber)afterRevision.getRevisionNumber()).getRevision(); - } - else { - return Revision.of(((SvnRevisionNumber)notNull(change.getBeforeRevision()).getRevisionNumber()).getRevision().getNumber() + 1); - } - } - - @NotNull - private static String getDiffWindowTitle(@NotNull Change change) { - if (change.isMoved() || change.isRenamed()) { - FilePath beforeFilePath = ChangesUtil.getBeforePath(change); - FilePath afterFilePath = ChangesUtil.getAfterPath(change); - - String beforePath = beforeFilePath == null ? "" : beforeFilePath.getPath(); - String afterPath = afterFilePath == null ? "" : afterFilePath.getPath(); - return SvnBundle.message("action.Subversion.properties.difference.diff.for.move.title", beforePath, afterPath); - } else { - return SvnBundle.message("action.Subversion.properties.difference.diff.title", ChangesUtil.getFilePath(change).getPath()); - } - } - - private static int compareRevisions(@NotNull Revision revision1, @NotNull Revision revision2) { - if (revision1.equals(revision2)) { - return 0; - } - // working(local) ahead of head - if (Revision.WORKING.equals(revision1)) { - return 1; - } - if (Revision.WORKING.equals(revision2)) { - return -1; - } - if (Revision.HEAD.equals(revision1)) { - return 1; - } - if (Revision.HEAD.equals(revision2)) { - return -1; - } - return revision1.getNumber() > revision2.getNumber() ? 1 : -1; - } - - @NotNull - private static String revisionToString(@Nullable Revision revision) { - return revision == null ? "not exists" : revision.toString(); - } - - @NotNull - private static List getPropertyList(@NotNull SvnVcs vcs, - @Nullable ContentRevision contentRevision, - @Nullable Revision revision) throws SvnBindException { - if (contentRevision == null) { - return Collections.emptyList(); - } - - Target target; - if (contentRevision instanceof SvnRepositoryContentRevision) { - SvnRepositoryContentRevision svnRevision = (SvnRepositoryContentRevision)contentRevision; - target = Target.on(svnRevision.getUrl(), revision); - } else { - File ioFile = contentRevision.getFile().getIOFile(); - target = Target.on(ioFile, revision); - } - - return SvnLazyPropertyContentRevision.getPropertyList(vcs, target, revision); - } -} diff --git a/plugins/svn4idea/src/org/jetbrains/idea/svn/difftool/properties/SvnPropertiesDiffRequest.java b/plugins/svn4idea/src/org/jetbrains/idea/svn/difftool/properties/SvnPropertiesDiffRequest.java index 1cebdc025849..f7a9f74d21d3 100644 --- a/plugins/svn4idea/src/org/jetbrains/idea/svn/difftool/properties/SvnPropertiesDiffRequest.java +++ b/plugins/svn4idea/src/org/jetbrains/idea/svn/difftool/properties/SvnPropertiesDiffRequest.java @@ -1,10 +1,10 @@ +// Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. package org.jetbrains.idea.svn.difftool.properties; import com.intellij.diff.contents.DiffContent; import com.intellij.diff.contents.DiffContentBase; import com.intellij.diff.contents.EmptyContent; import com.intellij.diff.requests.ContentDiffRequest; -import com.intellij.openapi.fileEditor.OpenFileDescriptor; import com.intellij.openapi.fileTypes.FileType; import com.intellij.util.containers.ContainerUtil; import org.jetbrains.annotations.NotNull; @@ -18,20 +18,6 @@ public class SvnPropertiesDiffRequest extends ContentDiffRequest { @NotNull private final List myContentTitles; @NotNull private final String myWindowTitle; - public SvnPropertiesDiffRequest(@NotNull String windowTitle, - @NotNull DiffContent content1, - @NotNull DiffContent content2, - @NotNull String title1, - @NotNull String title2) { - myWindowTitle = windowTitle; - myContents = ContainerUtil.list(content1, content2); - myContentTitles = ContainerUtil.list(title1, title2); - - assert content1 instanceof PropertyContent || content1 instanceof EmptyContent; - assert content2 instanceof PropertyContent || content2 instanceof EmptyContent; - assert content1 instanceof PropertyContent || content2 instanceof PropertyContent; - } - public SvnPropertiesDiffRequest(@Nullable List before, @Nullable List after, @Nullable String title1, @Nullable String title2) { assert before != null || after != null;