mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
[git] remove deprecated classes: GitHeavyCommit, SymbolicRefs, SymbolicRefsI
This commit is contained in:
@@ -51,11 +51,7 @@ import git4idea.branch.GitBranchUtil;
|
||||
import git4idea.commands.*;
|
||||
import git4idea.config.GitVersion;
|
||||
import git4idea.config.GitVersionSpecialty;
|
||||
import git4idea.history.browser.GitHeavyCommit;
|
||||
import git4idea.history.browser.SHAHash;
|
||||
import git4idea.history.browser.SymbolicRefs;
|
||||
import git4idea.history.browser.SymbolicRefsI;
|
||||
import git4idea.history.wholeTree.AbstractHash;
|
||||
import git4idea.i18n.GitBundle;
|
||||
import git4idea.log.GitLogProvider;
|
||||
import git4idea.log.GitRefManager;
|
||||
@@ -909,74 +905,6 @@ public class GitHistoryUtils {
|
||||
return ContainerUtil.map(record.getParentsHashes(), factory::createHash);
|
||||
}
|
||||
|
||||
@NotNull
|
||||
private static GitHeavyCommit createCommit(@NotNull Project project, @Nullable SymbolicRefsI refs, @NotNull VirtualFile root,
|
||||
@NotNull GitLogRecord record) throws VcsException {
|
||||
final Collection<String> currentRefs = record.getRefs();
|
||||
List<String> locals = new ArrayList<>();
|
||||
List<String> remotes = new ArrayList<>();
|
||||
List<String> tags = new ArrayList<>();
|
||||
final String s = parseRefs(refs, currentRefs, locals, remotes, tags);
|
||||
|
||||
GitHeavyCommit
|
||||
gitCommit = new GitHeavyCommit(root, AbstractHash.create(record.getHash()), new SHAHash(record.getHash()), record.getAuthorName(),
|
||||
record.getCommitterName(),
|
||||
record.getDate(), record.getSubject(), record.getFullMessage(),
|
||||
new HashSet<>(Arrays.asList(record.getParentsHashes())), record.getFilePaths(root),
|
||||
record.getAuthorEmail(),
|
||||
record.getCommitterEmail(), tags, locals, remotes,
|
||||
record.parseChanges(project, root), record.getAuthorTimeStamp());
|
||||
gitCommit.setCurrentBranch(s);
|
||||
return gitCommit;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
private static String parseRefs(@Nullable SymbolicRefsI refs, @NotNull Collection<String> currentRefs, @NotNull List<String> locals,
|
||||
@NotNull List<String> remotes, @NotNull List<String> tags) {
|
||||
if (refs == null) {
|
||||
return null;
|
||||
}
|
||||
for (String ref : currentRefs) {
|
||||
final SymbolicRefs.Kind kind = refs.getKind(ref);
|
||||
if (SymbolicRefs.Kind.LOCAL.equals(kind)) {
|
||||
locals.add(ref);
|
||||
}
|
||||
else if (SymbolicRefs.Kind.REMOTE.equals(kind)) {
|
||||
remotes.add(ref);
|
||||
}
|
||||
else {
|
||||
tags.add(ref);
|
||||
}
|
||||
}
|
||||
if (refs.getCurrent() != null && currentRefs.contains(refs.getCurrent().getName())) {
|
||||
return refs.getCurrent().getName();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
@NotNull
|
||||
public static List<GitHeavyCommit> commitsDetails(@NotNull Project project, @NotNull FilePath path, @Nullable SymbolicRefsI refs,
|
||||
@NotNull Collection<String> commitsIds) throws VcsException {
|
||||
path = getLastCommitName(project, path); // adjust path using change manager
|
||||
VirtualFile root = GitUtil.getGitRoot(path);
|
||||
GitSimpleHandler h = new GitSimpleHandler(project, root, GitCommand.SHOW);
|
||||
GitLogParser parser = new GitLogParser(project, GitLogParser.NameStatus.STATUS,
|
||||
HASH, HASH, COMMIT_TIME, AUTHOR_NAME, AUTHOR_TIME, AUTHOR_EMAIL, COMMITTER_NAME,
|
||||
COMMITTER_EMAIL, PARENTS, REF_NAMES, SUBJECT, BODY, RAW_BODY);
|
||||
h.setSilent(true);
|
||||
h.addParameters("--name-status", "-M", parser.getPretty(), "--encoding=UTF-8");
|
||||
h.addParameters(new ArrayList<>(commitsIds));
|
||||
|
||||
String output = h.run();
|
||||
final List<GitHeavyCommit> rc = new ArrayList<>();
|
||||
for (GitLogRecord record : parser.parse(output)) {
|
||||
final GitHeavyCommit gitCommit = createCommit(project, refs, root, record);
|
||||
rc.add(gitCommit);
|
||||
}
|
||||
return rc;
|
||||
}
|
||||
|
||||
public static long getAuthorTime(@NotNull Project project, @NotNull FilePath path, @NotNull String commitsId) throws VcsException {
|
||||
// adjust path using change manager
|
||||
path = getLastCommitName(project, path);
|
||||
|
||||
@@ -1,235 +0,0 @@
|
||||
/*
|
||||
* Copyright 2000-2010 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 git4idea.history.browser;
|
||||
|
||||
import com.intellij.openapi.vcs.FilePath;
|
||||
import com.intellij.openapi.vcs.changes.Change;
|
||||
import com.intellij.openapi.vfs.VirtualFile;
|
||||
import git4idea.GitCommit;
|
||||
import git4idea.history.wholeTree.AbstractHash;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
/**
|
||||
* This class is cluttered with a lot of fields which sometimes are populated, sometimes not, and some of which are completely
|
||||
* unrelated to the commit object (like tags, branches, root or current branch).
|
||||
* It will be removed.
|
||||
* {@link GitCommit} should be used instead.
|
||||
*/
|
||||
@Deprecated
|
||||
public class GitHeavyCommit {
|
||||
@NotNull private final VirtualFile myRoot;
|
||||
@NotNull private final AbstractHash myShortHash;
|
||||
@NotNull private final SHAHash myHash;
|
||||
private final String myAuthor;
|
||||
private final String myCommitter;
|
||||
private final String mySubject;
|
||||
private final String myDescription;
|
||||
private final Date myDate;
|
||||
|
||||
private final String myAuthorEmail;
|
||||
private final String myComitterEmail;
|
||||
|
||||
private final List<String> myTags;
|
||||
private final List<String> myLocalBranches;
|
||||
private final List<String> myRemoteBranches;
|
||||
|
||||
private final Set<String> myParentsHashes;
|
||||
private final Set<GitHeavyCommit> myParentsLinks;
|
||||
|
||||
// todo concern having
|
||||
private final List<FilePath> myPathsList;
|
||||
private final List<Change> myChanges;
|
||||
private String myCurrentBranch;
|
||||
|
||||
private final long myAuthorTime;
|
||||
//private final List<String> myBranches;
|
||||
private boolean myOnLocal;
|
||||
// very expensive to calculate it massively, seems it wouldnt be shown
|
||||
private boolean myOnTracked;
|
||||
|
||||
public GitHeavyCommit(@NotNull VirtualFile root, @NotNull final AbstractHash shortHash,
|
||||
@NotNull final SHAHash hash,
|
||||
final String author,
|
||||
final String committer,
|
||||
final Date date,
|
||||
final String subject,
|
||||
final String description,
|
||||
final Set<String> parentsHashes,
|
||||
final List<FilePath> pathsList,
|
||||
final String authorEmail,
|
||||
final String comitterEmail,
|
||||
List<String> tags,
|
||||
final List<String> localBranches,
|
||||
final List<String> remoteBranches,
|
||||
List<Change> changes,
|
||||
long authorTime) {
|
||||
myRoot = root;
|
||||
myShortHash = shortHash;
|
||||
myAuthor = author;
|
||||
myCommitter = committer;
|
||||
myDate = date;
|
||||
mySubject = subject;
|
||||
myDescription = description;
|
||||
myHash = hash;
|
||||
myParentsHashes = parentsHashes;
|
||||
myPathsList = pathsList;
|
||||
myAuthorEmail = authorEmail;
|
||||
myComitterEmail = comitterEmail;
|
||||
myTags = tags;
|
||||
myChanges = changes;
|
||||
myLocalBranches = localBranches;
|
||||
myRemoteBranches = remoteBranches;
|
||||
myAuthorTime = authorTime;
|
||||
//myBranches = branches;
|
||||
myParentsLinks = new HashSet<>();
|
||||
}
|
||||
|
||||
public void addParentLink(final GitHeavyCommit commit) {
|
||||
myParentsLinks.add(commit);
|
||||
}
|
||||
|
||||
public String getAuthor() {
|
||||
return myAuthor;
|
||||
}
|
||||
|
||||
public String getCommitter() {
|
||||
return myCommitter;
|
||||
}
|
||||
|
||||
public Date getDate() {
|
||||
return myDate;
|
||||
}
|
||||
|
||||
public String getDescription() {
|
||||
return myDescription;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public SHAHash getHash() {
|
||||
return myHash;
|
||||
}
|
||||
|
||||
// todo think of interface
|
||||
public Set<String> getParentsHashes() {
|
||||
return myParentsHashes;
|
||||
}
|
||||
|
||||
// todo think of interface
|
||||
public Set<GitHeavyCommit> getParentsLinks() {
|
||||
return myParentsLinks;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
if (this == o) return true;
|
||||
if (o == null || getClass() != o.getClass()) return false;
|
||||
|
||||
GitHeavyCommit gitCommit = (GitHeavyCommit)o;
|
||||
|
||||
if (!myHash.equals(gitCommit.myHash)) return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return myHash.hashCode();
|
||||
}
|
||||
|
||||
public List<String> getTags() {
|
||||
return myTags;
|
||||
}
|
||||
|
||||
public void orderTags(final Comparator<String> comparator) {
|
||||
Collections.sort(myTags, comparator);
|
||||
}
|
||||
|
||||
public List<String> getLocalBranches() {
|
||||
return myLocalBranches;
|
||||
}
|
||||
|
||||
public List<String> getRemoteBranches() {
|
||||
return myRemoteBranches;
|
||||
}
|
||||
|
||||
public String getAuthorEmail() {
|
||||
return myAuthorEmail;
|
||||
}
|
||||
|
||||
public String getCommitterEmail() {
|
||||
return myComitterEmail;
|
||||
}
|
||||
|
||||
public List<FilePath> getPathsList() {
|
||||
return myPathsList;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return myHash.getValue();
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public AbstractHash getShortHash() {
|
||||
return myShortHash;
|
||||
}
|
||||
|
||||
public List<Change> getChanges() {
|
||||
return myChanges;
|
||||
}
|
||||
|
||||
public void setCurrentBranch(String s) {
|
||||
myCurrentBranch = s;
|
||||
}
|
||||
|
||||
public String getCurrentBranch() {
|
||||
return myCurrentBranch;
|
||||
}
|
||||
|
||||
public long getAuthorTime() {
|
||||
return myAuthorTime;
|
||||
}
|
||||
|
||||
public String getComitterEmail() {
|
||||
return myComitterEmail;
|
||||
}
|
||||
|
||||
public boolean isOnLocal() {
|
||||
return myOnLocal;
|
||||
}
|
||||
|
||||
public void setOnLocal(boolean onLocal) {
|
||||
myOnLocal = onLocal;
|
||||
}
|
||||
|
||||
public boolean isOnTracked() {
|
||||
return myOnTracked;
|
||||
}
|
||||
|
||||
public void setOnTracked(boolean onTracked) {
|
||||
myOnTracked = onTracked;
|
||||
}
|
||||
|
||||
public String getSubject() {
|
||||
return mySubject;
|
||||
}
|
||||
|
||||
public VirtualFile getRoot() {
|
||||
return myRoot;
|
||||
}
|
||||
}
|
||||
@@ -1,74 +0,0 @@
|
||||
/*
|
||||
* Copyright 2000-2010 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 git4idea.history.browser;
|
||||
|
||||
import git4idea.GitBranch;
|
||||
|
||||
import java.util.TreeSet;
|
||||
|
||||
@Deprecated
|
||||
public class SymbolicRefs implements SymbolicRefsI {
|
||||
private GitBranch myCurrent;
|
||||
private final TreeSet<String> myLocalBranches;
|
||||
private final TreeSet<String> myRemoteBranches;
|
||||
private String myUsername;
|
||||
|
||||
public SymbolicRefs() {
|
||||
myLocalBranches = new TreeSet<>();
|
||||
myRemoteBranches = new TreeSet<>();
|
||||
}
|
||||
|
||||
public TreeSet<String> getLocalBranches() {
|
||||
return myLocalBranches;
|
||||
}
|
||||
|
||||
public TreeSet<String> getRemoteBranches() {
|
||||
return myRemoteBranches;
|
||||
}
|
||||
|
||||
@Override
|
||||
public GitBranch getCurrent() {
|
||||
return myCurrent;
|
||||
}
|
||||
|
||||
public void setCurrent(GitBranch current) {
|
||||
myCurrent = current;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Kind getKind(final String s) {
|
||||
if (myLocalBranches.contains(s)) return Kind.LOCAL;
|
||||
if (myRemoteBranches.contains(s)) return Kind.REMOTE;
|
||||
return Kind.TAG;
|
||||
}
|
||||
|
||||
public void clear() {
|
||||
myLocalBranches.clear();
|
||||
myRemoteBranches.clear();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getUsername() {
|
||||
return myUsername;
|
||||
}
|
||||
|
||||
public void setUsername(String username) {
|
||||
myUsername = username;
|
||||
}
|
||||
|
||||
public enum Kind {
|
||||
TAG,
|
||||
LOCAL,
|
||||
REMOTE
|
||||
}
|
||||
}
|
||||
@@ -1,29 +0,0 @@
|
||||
/*
|
||||
* Copyright 2000-2011 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 git4idea.history.browser;
|
||||
|
||||
import git4idea.GitBranch;
|
||||
|
||||
@Deprecated
|
||||
public interface SymbolicRefsI {
|
||||
|
||||
GitBranch getCurrent();
|
||||
|
||||
SymbolicRefs.Kind getKind(String s);
|
||||
|
||||
String getUsername();
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user