Search in sources :

Example 41 with CommittedChangeList

use of com.intellij.openapi.vcs.versionBrowser.CommittedChangeList in project intellij-community by JetBrains.

the class SvnLogUtil method loadInterval.

public List<CommittedChangeList> loadInterval(final SVNRevision fromIncluding, final SVNRevision toIncluding, final int maxCount, final boolean includingYoungest, final boolean includeOldest) throws VcsException {
    final List<CommittedChangeList> result = new ArrayList<>();
    LogEntryConsumer handler = createLogHandler(fromIncluding, toIncluding, includingYoungest, includeOldest, result);
    SvnTarget target = SvnTarget.fromURL(myLocation.toSvnUrl());
    myVcs.getFactory(target).createHistoryClient().doLog(target, fromIncluding, toIncluding, true, true, false, maxCount, null, handler);
    return result;
}
Also used : CommittedChangeList(com.intellij.openapi.vcs.versionBrowser.CommittedChangeList) SvnTarget(org.tmatesoft.svn.core.wc2.SvnTarget) ArrayList(java.util.ArrayList)

Example 42 with CommittedChangeList

use of com.intellij.openapi.vcs.versionBrowser.CommittedChangeList in project intellij-community by JetBrains.

the class Merger method getInfo.

@Nullable
public String getInfo() {
    String result = null;
    if (myMergeChunk != null) {
        // TODO: Use values from SvnBundle
        StringBuilder builder = new StringBuilder("Changelist(s) :");
        for (CommittedChangeList list : myMergeChunk.changeLists()) {
            final String nextComment = list.getComment().trim().replace('\n', '|');
            builder.append("\n").append(list.getNumber()).append(" (").append(nextComment).append(")");
        }
        builder.append(" merging faced problems");
        result = builder.toString();
    }
    return result;
}
Also used : CommittedChangeList(com.intellij.openapi.vcs.versionBrowser.CommittedChangeList) Nullable(org.jetbrains.annotations.Nullable)

Example 43 with CommittedChangeList

use of com.intellij.openapi.vcs.versionBrowser.CommittedChangeList in project intellij-community by JetBrains.

the class Merger method getSkippedMessage.

@Nullable
public static String getSkippedMessage(@NotNull List<CommittedChangeList> changeLists) {
    String result = null;
    if (!changeLists.isEmpty()) {
        final StringBuilder sb = new StringBuilder();
        for (int i = 0; i < changeLists.size(); i++) {
            CommittedChangeList list = changeLists.get(i);
            if (i != 0) {
                sb.append(',');
            }
            sb.append(list.getNumber()).append(" (").append(list.getComment().replace('\n', '|')).append(')');
        }
        result = SvnBundle.message("action.Subversion.integrate.changes.warning.skipped.lists.text", sb.toString());
    }
    return result;
}
Also used : CommittedChangeList(com.intellij.openapi.vcs.versionBrowser.CommittedChangeList) Nullable(org.jetbrains.annotations.Nullable)

Example 44 with CommittedChangeList

use of com.intellij.openapi.vcs.versionBrowser.CommittedChangeList in project intellij-community by JetBrains.

the class GitCommittedChangeListProvider method getOneList.

@Override
public Pair<CommittedChangeList, FilePath> getOneList(final VirtualFile file, final VcsRevisionNumber number) throws VcsException {
    FilePath filePath = VcsUtil.getFilePath(file);
    final List<GitHeavyCommit> gitCommits = GitHistoryUtils.commitsDetails(myProject, filePath, new SymbolicRefs(), Collections.singletonList(number.asString()));
    if (gitCommits.size() != 1) {
        return null;
    }
    final GitHeavyCommit gitCommit = gitCommits.get(0);
    CommittedChangeList commit = new GitCommittedChangeList(gitCommit.getDescription() + " (" + gitCommit.getShortHash().getString() + ")", gitCommit.getDescription(), gitCommit.getAuthor(), (GitRevisionNumber) number, new Date(gitCommit.getAuthorTime()), gitCommit.getChanges(), assertNotNull(GitVcs.getInstance(myProject)), true);
    final Collection<Change> changes = commit.getChanges();
    if (changes.size() == 1) {
        Change change = changes.iterator().next();
        return Pair.create(commit, ChangesUtil.getFilePath(change));
    }
    for (Change change : changes) {
        if (change.getAfterRevision() != null && FileUtil.filesEqual(filePath.getIOFile(), change.getAfterRevision().getFile().getIOFile())) {
            return Pair.create(commit, filePath);
        }
    }
    final String afterTime = "--after=" + GitUtil.gitTime(gitCommit.getDate());
    final List<VcsFileRevision> history = GitHistoryUtils.history(myProject, filePath, (VirtualFile) null, afterTime);
    if (history.isEmpty()) {
        return Pair.create(commit, filePath);
    }
    return Pair.create(commit, ((GitFileRevision) history.get(history.size() - 1)).getPath());
}
Also used : SymbolicRefs(git4idea.history.browser.SymbolicRefs) GitHeavyCommit(git4idea.history.browser.GitHeavyCommit) CommittedChangeList(com.intellij.openapi.vcs.versionBrowser.CommittedChangeList) Change(com.intellij.openapi.vcs.changes.Change) VcsFileRevision(com.intellij.openapi.vcs.history.VcsFileRevision)

Example 45 with CommittedChangeList

use of com.intellij.openapi.vcs.versionBrowser.CommittedChangeList in project intellij-community by JetBrains.

the class SvnCachingRevisionsTest method createCommittedIterator.

private Iterator<ChangesBunch> createCommittedIterator(final int bunchSize, final List<Long> revisions) {
    final List<ChangesBunch> list = new ArrayList<>();
    for (int i = revisions.size() - 1; i >= 0; i -= bunchSize) {
        final int j = (bunchSize > i) ? -1 : (i - bunchSize);
        final List<CommittedChangeList> subList = new ArrayList<>();
        for (int k = i; k > j; --k) {
            subList.add(createList(revisions.get(k)));
        }
        list.add(new ChangesBunch(subList, (j != -1)));
        if (j == -1) {
            break;
        }
    }
    return list.iterator();
}
Also used : CommittedChangeList(com.intellij.openapi.vcs.versionBrowser.CommittedChangeList) ChangesBunch(com.intellij.openapi.vcs.changes.committed.ChangesBunch)

Aggregations

CommittedChangeList (com.intellij.openapi.vcs.versionBrowser.CommittedChangeList)45 ChangeBrowserSettings (com.intellij.openapi.vcs.versionBrowser.ChangeBrowserSettings)8 Nullable (org.jetbrains.annotations.Nullable)8 Change (com.intellij.openapi.vcs.changes.Change)7 ChangesBunch (com.intellij.openapi.vcs.changes.committed.ChangesBunch)5 VirtualFile (com.intellij.openapi.vfs.VirtualFile)5 ChangeList (com.intellij.openapi.vcs.changes.ChangeList)4 NotNull (org.jetbrains.annotations.NotNull)4 ProgressIndicator (com.intellij.openapi.progress.ProgressIndicator)3 Project (com.intellij.openapi.project.Project)3 Pair (com.intellij.openapi.util.Pair)3 List (java.util.List)3 DefaultMutableTreeNode (javax.swing.tree.DefaultMutableTreeNode)3 Application (com.intellij.openapi.application.Application)2 Task (com.intellij.openapi.progress.Task)2 Ref (com.intellij.openapi.util.Ref)2 VcsFileRevision (com.intellij.openapi.vcs.history.VcsFileRevision)2 VcsRevisionNumber (com.intellij.openapi.vcs.history.VcsRevisionNumber)2 ChangesBrowserSettingsEditor (com.intellij.openapi.vcs.versionBrowser.ChangesBrowserSettingsEditor)2 IOException (java.io.IOException)2