From 79a4b7aa972cdb0cef1ffc3070fff011d7348000 Mon Sep 17 00:00:00 2001 From: Aleksey Pivovarov Date: Wed, 19 Apr 2017 13:59:44 +0300 Subject: [PATCH] vcs: remove unnecessary wrapper --- .../vcs/changes/VcsCurrentRevisionProxy.java | 53 +++++-------------- 1 file changed, 13 insertions(+), 40 deletions(-) diff --git a/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/VcsCurrentRevisionProxy.java b/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/VcsCurrentRevisionProxy.java index 297fa5c2c6a5..55b157a61de2 100644 --- a/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/VcsCurrentRevisionProxy.java +++ b/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/VcsCurrentRevisionProxy.java @@ -59,7 +59,7 @@ public class VcsCurrentRevisionProxy implements ContentRevision { @Nullable public String getContent() throws VcsException { - return getVcsRevision().getContent(); + return ContentRevisionCache.getAsString(getVcsRevision().second, getFile(), null); } @NotNull @@ -70,7 +70,7 @@ public class VcsCurrentRevisionProxy implements ContentRevision { @NotNull public VcsRevisionNumber getRevisionNumber() { try { - return getVcsRevision().getRevisionNumber(); + return getVcsRevision().first; } catch(VcsException ex) { return VcsRevisionNumber.NULL; @@ -78,51 +78,24 @@ public class VcsCurrentRevisionProxy implements ContentRevision { } @NotNull - private ContentRevision getVcsRevision() throws VcsException { - final FilePath file = getFile(); - final Pair pair; + private Pair getVcsRevision() throws VcsException { try { - pair = ContentRevisionCache.getOrLoadCurrentAsBytes(myProject, file, myVcsKey, + return ContentRevisionCache.getOrLoadCurrentAsBytes(myProject, getFile(), myVcsKey, new CurrentRevisionProvider() { - @Override - public VcsRevisionNumber getCurrentRevision() throws VcsException { - return getCurrentRevisionNumber(); - } + @Override + public VcsRevisionNumber getCurrentRevision() throws VcsException { + return getCurrentRevisionNumber(); + } - @Override - public Pair get() throws VcsException, IOException { - return loadContent(); - } - }); + @Override + public Pair get() throws VcsException, IOException { + return loadContent(); + } + }); } catch (IOException e) { throw new VcsException(e); } - - return new ByteBackedContentRevision() { - @Override - public String getContent() throws VcsException { - return ContentRevisionCache.getAsString(getContentAsBytes(), file, null); - } - - @Nullable - @Override - public byte[] getContentAsBytes() throws VcsException { - return pair.getSecond(); - } - - @NotNull - @Override - public FilePath getFile() { - return file; - } - - @NotNull - @Override - public VcsRevisionNumber getRevisionNumber() { - return pair.getFirst(); - } - }; } @NotNull