vcs: do not use ServiceManager because Upsource might not support it

* move patch builder into vcs-impl
* use own instance of ComparisonManagerImpl
This commit is contained in:
Aleksey Pivovarov
2016-07-25 20:49:26 +03:00
parent 45b1fe1515
commit 09295d4c0f
4 changed files with 7 additions and 41 deletions

View File

@@ -1,35 +0,0 @@
/*
* Copyright 2000-2016 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.intellij.diff.comparison;
import com.intellij.diff.util.Range;
import com.intellij.openapi.progress.ProgressIndicator;
import org.jetbrains.annotations.NotNull;
import java.util.List;
public abstract class ComparisonManagerEx extends ComparisonManager {
@NotNull
public static ComparisonManagerEx getInstanceEx() {
return (ComparisonManagerEx)ComparisonManager.getInstance();
}
@NotNull
public abstract List<Range> compareLines(@NotNull List<? extends CharSequence> lines1,
@NotNull List<? extends CharSequence> lines2,
@NotNull ComparisonPolicy policy,
@NotNull ProgressIndicator indicator) throws DiffTooBigException;
}

View File

@@ -34,7 +34,7 @@ import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
public class ComparisonManagerImpl extends ComparisonManagerEx {
public class ComparisonManagerImpl extends ComparisonManager {
public static final Logger LOG = Logger.getInstance(ComparisonManagerImpl.class);
@NotNull
@@ -166,7 +166,6 @@ public class ComparisonManagerImpl extends ComparisonManagerEx {
}
@NotNull
@Override
public List<Range> compareLines(@NotNull List<? extends CharSequence> lines1,
@NotNull List<? extends CharSequence> lines2,
@NotNull ComparisonPolicy policy,

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2000-2015 JetBrains s.r.o.
* Copyright 2000-2016 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -15,7 +15,7 @@
*/
package com.intellij.openapi.diff.impl.patch;
import com.intellij.diff.comparison.ComparisonManagerEx;
import com.intellij.diff.comparison.ComparisonManagerImpl;
import com.intellij.diff.comparison.ComparisonPolicy;
import com.intellij.diff.comparison.DiffTooBigException;
import com.intellij.diff.util.Range;
@@ -40,6 +40,9 @@ public class TextPatchBuilder {
@NonNls private static final String REVISION_NAME_TEMPLATE = "(revision {0})";
@NonNls private static final String DATE_NAME_TEMPLATE = "(date {0})";
// we can't use ComparisonManager.getInstance() because of Upsource
private static final ComparisonManagerImpl ourComparisonManager = new ComparisonManagerImpl();
@NotNull private final String myBasePath;
private final boolean myIsReversePath;
private final boolean myIsCaseSensitive;
@@ -263,8 +266,7 @@ public class TextPatchBuilder {
}
private static List<Range> doCompareLines(@NotNull List<String> beforeLines, @NotNull List<String> afterLines) {
return ComparisonManagerEx.getInstanceEx().compareLines(beforeLines, afterLines, ComparisonPolicy.DEFAULT,
DumbProgressIndicator.INSTANCE);
return ourComparisonManager.compareLines(beforeLines, afterLines, ComparisonPolicy.DEFAULT, DumbProgressIndicator.INSTANCE);
}
@NotNull