mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
[vcs-log] move HashImpl.toShortString and relevant constants to VcsLogUtil, rename
This commit is contained in:
@@ -17,6 +17,7 @@ package com.intellij.vcs.log.impl;
|
||||
|
||||
import com.intellij.util.io.DataInputOutputUtil;
|
||||
import com.intellij.vcs.log.Hash;
|
||||
import com.intellij.vcs.log.util.VcsLogUtil;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import java.io.DataInput;
|
||||
@@ -30,8 +31,6 @@ import java.util.Arrays;
|
||||
public class HashImpl implements Hash {
|
||||
|
||||
private static final int BASE = 16;
|
||||
private static final int SHORT_HASH_LENGTH = 7;
|
||||
public static final int FULL_HASH_LENGTH = 40;
|
||||
|
||||
@NotNull
|
||||
private final byte[] myData;
|
||||
@@ -131,11 +130,6 @@ public class HashImpl implements Hash {
|
||||
@NotNull
|
||||
@Override
|
||||
public String toShortString() {
|
||||
return toShortString(asString());
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public static String toShortString(@NotNull String hashString) {
|
||||
return hashString.substring(0, Math.min(hashString.length(), SHORT_HASH_LENGTH));
|
||||
return VcsLogUtil.getShortHash(asString());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -34,12 +34,12 @@ import com.intellij.util.containers.ContainerUtil;
|
||||
import com.intellij.util.ui.UIUtil;
|
||||
import com.intellij.vcs.log.*;
|
||||
import com.intellij.vcs.log.data.VcsLogData;
|
||||
import com.intellij.vcs.log.impl.HashImpl;
|
||||
import com.intellij.vcs.log.impl.VcsLogImpl;
|
||||
import com.intellij.vcs.log.impl.VcsLogUiProperties;
|
||||
import com.intellij.vcs.log.ui.highlighters.VcsLogHighlighterFactory;
|
||||
import com.intellij.vcs.log.ui.table.GraphTableModel;
|
||||
import com.intellij.vcs.log.ui.table.VcsLogGraphTable;
|
||||
import com.intellij.vcs.log.util.VcsLogUtil;
|
||||
import com.intellij.vcs.log.visible.VisiblePack;
|
||||
import com.intellij.vcs.log.visible.VisiblePackChangeListener;
|
||||
import com.intellij.vcs.log.visible.VisiblePackRefresher;
|
||||
@@ -222,7 +222,7 @@ public abstract class AbstractVcsLogUi implements VcsLogUi, Disposable {
|
||||
return ((Hash)commitId).toShortString();
|
||||
}
|
||||
else if (commitId instanceof String) {
|
||||
return HashImpl.toShortString((String)commitId);
|
||||
return VcsLogUtil.getShortHash((String)commitId);
|
||||
}
|
||||
return commitId.toString();
|
||||
}
|
||||
|
||||
@@ -57,6 +57,7 @@ import com.intellij.vcs.log.ui.frame.CommitPresentationUtil.CommitPresentation;
|
||||
import com.intellij.vcs.log.ui.table.CommitSelectionListener;
|
||||
import com.intellij.vcs.log.ui.table.VcsLogGraphTable;
|
||||
import com.intellij.vcs.log.util.TroveUtil;
|
||||
import com.intellij.vcs.log.util.VcsLogUtil;
|
||||
import gnu.trove.TIntHashSet;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
@@ -209,7 +210,7 @@ public class DetailsPanel extends JPanel implements EditorColorsListener, Dispos
|
||||
MultiMap<String, CommitId> resolvedHashes = MultiMap.createSmart();
|
||||
|
||||
Set<String> fullHashes =
|
||||
ContainerUtil.newHashSet(ContainerUtil.filter(unResolvedHashes, h -> h.length() == HashImpl.FULL_HASH_LENGTH));
|
||||
ContainerUtil.newHashSet(ContainerUtil.filter(unResolvedHashes, h -> h.length() == VcsLogUtil.FULL_HASH_LENGTH));
|
||||
for (String fullHash : fullHashes) {
|
||||
Hash hash = HashImpl.build(fullHash);
|
||||
for (VirtualFile root : myLogData.getRoots()) {
|
||||
|
||||
@@ -33,6 +33,8 @@ 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 = 7;
|
||||
|
||||
@NotNull
|
||||
public static Map<VirtualFile, Set<VcsRef>> groupRefsByRoot(@NotNull Collection<VcsRef> refs) {
|
||||
@@ -258,4 +260,9 @@ public class VcsLogUtil {
|
||||
Disposer.register(parent, () -> Disposer.dispose(disposable));
|
||||
Disposer.register(project, disposable);
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public static String getShortHash(@NotNull String hashString) {
|
||||
return hashString.substring(0, Math.min(hashString.length(), SHORT_HASH_LENGTH));
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user