IDEA-CR-11226 This reverts commit e40118c73c.

This commit is contained in:
Gregory.Shrago
2016-07-28 16:21:06 +03:00
parent 9bda11fc55
commit 6e56f34601
2 changed files with 17 additions and 3 deletions
@@ -266,6 +266,7 @@ public class FileHistoryPanelImpl extends PanelWithActionsAndCloseButton impleme
@NotNull
private static String getPresentableText(@NotNull VcsFileRevision revision, boolean withMessage) {
// implementation reflected by com.intellij.vcs.log.ui.frame.VcsLogGraphTable.getPresentableText()
StringBuilder sb = new StringBuilder();
sb.append(FileHistoryPanelImpl.RevisionColumnInfo.toString(revision, true)).append(" ");
sb.append(revision.getAuthor());
@@ -26,6 +26,7 @@ import com.intellij.openapi.diagnostic.Logger;
import com.intellij.openapi.ide.CopyPasteManager;
import com.intellij.openapi.ui.LoadingDecorator;
import com.intellij.openapi.ui.popup.Balloon;
import com.intellij.openapi.util.Comparing;
import com.intellij.openapi.util.Couple;
import com.intellij.openapi.util.Pair;
import com.intellij.openapi.util.text.StringUtil;
@@ -284,7 +285,7 @@ public class VcsLogGraphTable extends TableWithProgress implements DataProvider,
if (log == null) return;
List<VcsFullCommitDetails> details = VcsLogUtil.collectFirstPackOfLoadedSelectedDetails(log);
if (details.isEmpty()) return;
String text = StringUtil.join(details, VcsLogGraphTable::getTextForClipboard, "\n");
String text = StringUtil.join(details, commit -> getPresentableText(commit, true), "\n");
CopyPasteManager.getInstance().setContents(new StringSelection(text));
}
@@ -294,8 +295,20 @@ public class VcsLogGraphTable extends TableWithProgress implements DataProvider,
}
@NotNull
private static String getTextForClipboard(@NotNull VcsFullCommitDetails commit) {
return commit.getId().toShortString() + " " + commit.getSubject();
private static String getPresentableText(@NotNull VcsFullCommitDetails commit, boolean withMessage) {
// implementation reflected by com.intellij.openapi.vcs.history.FileHistoryPanelImpl.getPresentableText()
StringBuilder sb = new StringBuilder();
sb.append(commit.getId().toShortString()).append(" ");
sb.append(commit.getAuthor().getName());
long time = commit.getAuthorTime();
sb.append(" on ").append(DateFormatUtil.formatDate(time)).append(" at ").append(DateFormatUtil.formatTime(time));
if (!Comparing.equal(commit.getAuthor(), commit.getCommitter())) {
sb.append(" (committed by ").append(commit.getCommitter().getName()).append(")");
}
if (withMessage) {
sb.append(" ").append(commit.getSubject());
}
return sb.toString();
}
@Override