mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
[vcs-log] redirect DvcsUtil.getShortHash to VcsLogUtil.getShortHash
This commit is contained in:
@@ -53,10 +53,14 @@ import com.intellij.util.containers.ContainerUtil;
|
||||
import com.intellij.util.text.DateFormatUtil;
|
||||
import com.intellij.vcs.log.TimedVcsCommit;
|
||||
import com.intellij.vcs.log.VcsFullCommitDetails;
|
||||
import com.intellij.vcs.log.util.VcsLogUtil;
|
||||
import com.intellij.vcsUtil.VcsImplUtil;
|
||||
import com.intellij.vcsUtil.VcsUtil;
|
||||
import org.intellij.images.editor.ImageFileEditor;
|
||||
import org.jetbrains.annotations.*;
|
||||
import org.jetbrains.annotations.CalledInAwt;
|
||||
import org.jetbrains.annotations.Contract;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
@@ -69,8 +73,6 @@ public class DvcsUtil {
|
||||
|
||||
private static final Logger LOGGER = Logger.getInstance(DvcsUtil.class);
|
||||
private static final int IO_RETRIES = 3; // number of retries before fail if an IOException happens during file read.
|
||||
private static final int SHORT_HASH_LENGTH = 8;
|
||||
private static final int LONG_HASH_LENGTH = 40;
|
||||
|
||||
/**
|
||||
* Comparator for virtual files by name
|
||||
@@ -176,13 +178,13 @@ public class DvcsUtil {
|
||||
|
||||
@NotNull
|
||||
public static String getShortHash(@NotNull String hash) {
|
||||
if (hash.length() < SHORT_HASH_LENGTH) {
|
||||
if (hash.length() < VcsLogUtil.SHORT_HASH_LENGTH) {
|
||||
LOG.debug("Unexpectedly short hash: [" + hash + "]");
|
||||
}
|
||||
if (hash.length() > LONG_HASH_LENGTH) {
|
||||
if (hash.length() > VcsLogUtil.FULL_HASH_LENGTH) {
|
||||
LOG.debug("Unexpectedly long hash: [" + hash + "]");
|
||||
}
|
||||
return hash.substring(0, Math.min(SHORT_HASH_LENGTH, hash.length()));
|
||||
return VcsLogUtil.getShortHash(hash);
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@@ -468,7 +470,8 @@ public class DvcsUtil {
|
||||
|
||||
@NotNull
|
||||
public static String joinShortNames(@NotNull Collection<? extends Repository> repositories, int limit) {
|
||||
return joinWithAnd(ContainerUtil.map(repositories, (Function<Repository, String>)repository -> getShortRepositoryName(repository)), limit);
|
||||
return joinWithAnd(ContainerUtil.map(repositories, (Function<Repository, String>)repository -> getShortRepositoryName(repository)),
|
||||
limit);
|
||||
}
|
||||
|
||||
@NotNull
|
||||
|
||||
@@ -34,7 +34,7 @@ import static java.util.Collections.singletonList;
|
||||
public class VcsLogUtil {
|
||||
public static final int MAX_SELECTED_COMMITS = 1000;
|
||||
public static final int FULL_HASH_LENGTH = 40;
|
||||
private static final int SHORT_HASH_LENGTH = 8;
|
||||
public static final int SHORT_HASH_LENGTH = 8;
|
||||
|
||||
@NotNull
|
||||
public static Map<VirtualFile, Set<VcsRef>> groupRefsByRoot(@NotNull Collection<VcsRef> refs) {
|
||||
@@ -263,6 +263,6 @@ public class VcsLogUtil {
|
||||
|
||||
@NotNull
|
||||
public static String getShortHash(@NotNull String hashString) {
|
||||
return hashString.substring(0, Math.min(hashString.length(), SHORT_HASH_LENGTH));
|
||||
return hashString.substring(0, Math.min(SHORT_HASH_LENGTH, hashString.length()));
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user