From fe9f39e84c74110a129e63fdf757f18daf203506 Mon Sep 17 00:00:00 2001 From: irengrig Date: Mon, 16 Nov 2009 23:08:40 +0300 Subject: [PATCH] VCS: show number of stripped dirs --- .../vcs/changes/patch/ApplyPatchDifferentiatedDialog.java | 3 +++ .../openapi/vcs/changes/patch/FilePatchInProgress.java | 12 ++++++++++++ .../com/intellij/openapi/vcs/changes/patch/Strippable.java | 1 + 3 files changed, 16 insertions(+) diff --git a/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/patch/ApplyPatchDifferentiatedDialog.java b/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/patch/ApplyPatchDifferentiatedDialog.java index f3b82f2829..5dfe2551ea 100644 --- a/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/patch/ApplyPatchDifferentiatedDialog.java +++ b/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/patch/ApplyPatchDifferentiatedDialog.java @@ -736,6 +736,9 @@ public class ApplyPatchDifferentiatedDialog extends DialogWrapper { component.append(" "); component.append("["+ patchPath + "]", SimpleTextAttributes.GRAY_ATTRIBUTES); } + if (patchChange.getPatchInProgress().getCurrentStrip() > 0) { + component.append(" stripped " + patchChange.getPatchInProgress().getCurrentStrip(), SimpleTextAttributes.GRAY_ITALIC_ATTRIBUTES); + } final String text; if (FilePatchStatus.ADDED.equals(patchChange.getPatchInProgress().getStatus())) { text = "(Added)"; diff --git a/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/patch/FilePatchInProgress.java b/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/patch/FilePatchInProgress.java index 4f0ac83417..680542289f 100644 --- a/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/patch/FilePatchInProgress.java +++ b/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/patch/FilePatchInProgress.java @@ -312,6 +312,10 @@ public class FilePatchInProgress implements Strippable { return myStrippable.getCurrentPath(); } + public int getCurrentStrip() { + return myStrippable.getCurrentStrip(); + } + private static class StripCapablePath implements Strippable { private final int myStripMax; private int myCurrentStrip; @@ -337,6 +341,10 @@ public class FilePatchInProgress implements Strippable { myCurrentStrip = 0; } + public int getCurrentStrip() { + return myCurrentStrip; + } + // down - restore dirs... public boolean canDown() { return myCurrentStrip > 0; @@ -454,6 +462,10 @@ public class FilePatchInProgress implements Strippable { return myParts[0].getCurrentPath(); } + public int getCurrentStrip() { + return myParts[0].getCurrentStrip(); + } + public void applyBackToPatch(final FilePatch patch) { final String beforeName = patch.getBeforeName(); if (beforeName != null) { diff --git a/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/patch/Strippable.java b/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/patch/Strippable.java index 9a8ef5895c..47e29ee6b5 100644 --- a/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/patch/Strippable.java +++ b/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/patch/Strippable.java @@ -29,4 +29,5 @@ public interface Strippable { void setZero(); String getCurrentPath(); + int getCurrentStrip(); } -- 2.11.4.GIT