From eab4a2488eca969179fda9c0888f00ef11781003 Mon Sep 17 00:00:00 2001 From: Julia Beliaeva Date: Fri, 31 Mar 2017 16:03:39 +0300 Subject: [PATCH] [git] remove deprecated classes: GitHeavyCommit, SymbolicRefs, SymbolicRefsI --- .../src/git4idea/history/GitHistoryUtils.java | 72 ------ .../history/browser/GitHeavyCommit.java | 235 ------------------ .../history/browser/SymbolicRefs.java | 74 ------ .../history/browser/SymbolicRefsI.java | 29 --- 4 files changed, 410 deletions(-) delete mode 100644 plugins/git4idea/src/git4idea/history/browser/GitHeavyCommit.java delete mode 100644 plugins/git4idea/src/git4idea/history/browser/SymbolicRefs.java delete mode 100644 plugins/git4idea/src/git4idea/history/browser/SymbolicRefsI.java diff --git a/plugins/git4idea/src/git4idea/history/GitHistoryUtils.java b/plugins/git4idea/src/git4idea/history/GitHistoryUtils.java index 178675830bec..ff981006948d 100644 --- a/plugins/git4idea/src/git4idea/history/GitHistoryUtils.java +++ b/plugins/git4idea/src/git4idea/history/GitHistoryUtils.java @@ -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 currentRefs = record.getRefs(); - List locals = new ArrayList<>(); - List remotes = new ArrayList<>(); - List 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 currentRefs, @NotNull List locals, - @NotNull List remotes, @NotNull List 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 commitsDetails(@NotNull Project project, @NotNull FilePath path, @Nullable SymbolicRefsI refs, - @NotNull Collection 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 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); diff --git a/plugins/git4idea/src/git4idea/history/browser/GitHeavyCommit.java b/plugins/git4idea/src/git4idea/history/browser/GitHeavyCommit.java deleted file mode 100644 index 3bad1c2d43d6..000000000000 --- a/plugins/git4idea/src/git4idea/history/browser/GitHeavyCommit.java +++ /dev/null @@ -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 myTags; - private final List myLocalBranches; - private final List myRemoteBranches; - - private final Set myParentsHashes; - private final Set myParentsLinks; - - // todo concern having - private final List myPathsList; - private final List myChanges; - private String myCurrentBranch; - - private final long myAuthorTime; - //private final List 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 parentsHashes, - final List pathsList, - final String authorEmail, - final String comitterEmail, - List tags, - final List localBranches, - final List remoteBranches, - List 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 getParentsHashes() { - return myParentsHashes; - } - - // todo think of interface - public Set 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 getTags() { - return myTags; - } - - public void orderTags(final Comparator comparator) { - Collections.sort(myTags, comparator); - } - - public List getLocalBranches() { - return myLocalBranches; - } - - public List getRemoteBranches() { - return myRemoteBranches; - } - - public String getAuthorEmail() { - return myAuthorEmail; - } - - public String getCommitterEmail() { - return myComitterEmail; - } - - public List getPathsList() { - return myPathsList; - } - - @Override - public String toString() { - return myHash.getValue(); - } - - @NotNull - public AbstractHash getShortHash() { - return myShortHash; - } - - public List 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; - } -} diff --git a/plugins/git4idea/src/git4idea/history/browser/SymbolicRefs.java b/plugins/git4idea/src/git4idea/history/browser/SymbolicRefs.java deleted file mode 100644 index fbee7b3a3f11..000000000000 --- a/plugins/git4idea/src/git4idea/history/browser/SymbolicRefs.java +++ /dev/null @@ -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 myLocalBranches; - private final TreeSet myRemoteBranches; - private String myUsername; - - public SymbolicRefs() { - myLocalBranches = new TreeSet<>(); - myRemoteBranches = new TreeSet<>(); - } - - public TreeSet getLocalBranches() { - return myLocalBranches; - } - - public TreeSet 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 - } -} diff --git a/plugins/git4idea/src/git4idea/history/browser/SymbolicRefsI.java b/plugins/git4idea/src/git4idea/history/browser/SymbolicRefsI.java deleted file mode 100644 index c899f040df67..000000000000 --- a/plugins/git4idea/src/git4idea/history/browser/SymbolicRefsI.java +++ /dev/null @@ -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(); - -}