From 5c964ca6fc6ccbec383e39fd0fdd6863d5e405b9 Mon Sep 17 00:00:00 2001 From: Bas Leijdekkers Date: Wed, 8 Apr 2015 18:01:21 +0200 Subject: [PATCH] IDEA-138565 (CVS. Show history for files with DEAD status) --- .../intellij/cvsSupport2/CvsBundle.properties | 1 - .../changeBrowser/CvsContentRevision.java | 8 ++------ .../cvsContent/GetFileContentOperation.java | 17 ++++------------- .../ComparableVcsRevisionOnOperation.java | 5 +---- .../cvsSupport2/history/CvsFileContent.java | 5 +---- 5 files changed, 8 insertions(+), 28 deletions(-) diff --git a/plugins/cvs/cvs-core/src/com/intellij/cvsSupport2/CvsBundle.properties b/plugins/cvs/cvs-core/src/com/intellij/cvsSupport2/CvsBundle.properties index 31acb1581014..67692d41fce2 100644 --- a/plugins/cvs/cvs-core/src/com/intellij/cvsSupport2/CvsBundle.properties +++ b/plugins/cvs/cvs-core/src/com/intellij/cvsSupport2/CvsBundle.properties @@ -222,7 +222,6 @@ column.name.sticky.data=Sticky Data column.name.keyword.substitution=Keyword Substitution column.name.revision=Revision operation.name.load.file=Load File -message.text.revision.was.deleted.from.repository=Revision {0} does not exist in repository exception.text.cannot.load.revision=Cannot load revision {0} exception.text.cannot.find.revision=Cannot find revision {0} operation.name.load.file.content=Load File Content diff --git a/plugins/cvs/cvs-plugin/src/com/intellij/cvsSupport2/changeBrowser/CvsContentRevision.java b/plugins/cvs/cvs-plugin/src/com/intellij/cvsSupport2/changeBrowser/CvsContentRevision.java index 25063be661e2..01b572fae7b7 100644 --- a/plugins/cvs/cvs-plugin/src/com/intellij/cvsSupport2/changeBrowser/CvsContentRevision.java +++ b/plugins/cvs/cvs-plugin/src/com/intellij/cvsSupport2/changeBrowser/CvsContentRevision.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2014 JetBrains s.r.o. + * Copyright 2000-2015 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. @@ -95,11 +95,7 @@ public class CvsContentRevision implements ContentRevision { throw new VcsException("Network problem"); } - final byte[] fileBytes = operation.getFileBytes(); - if (operation.isDeleted()) { - throw new VcsException(CvsBundle.message("message.text.revision.was.deleted.from.repository", myRevision.getRevision())); - } - return fileBytes; + return operation.getFileBytes(); } @NotNull diff --git a/plugins/cvs/cvs-plugin/src/com/intellij/cvsSupport2/cvsoperations/cvsContent/GetFileContentOperation.java b/plugins/cvs/cvs-plugin/src/com/intellij/cvsSupport2/cvsoperations/cvsContent/GetFileContentOperation.java index 44ba6892f32b..4e63a22c678f 100644 --- a/plugins/cvs/cvs-plugin/src/com/intellij/cvsSupport2/cvsoperations/cvsContent/GetFileContentOperation.java +++ b/plugins/cvs/cvs-plugin/src/com/intellij/cvsSupport2/cvsoperations/cvsContent/GetFileContentOperation.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2009 JetBrains s.r.o. + * Copyright 2000-2015 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. @@ -15,7 +15,6 @@ */ package com.intellij.cvsSupport2.cvsoperations.cvsContent; -import com.intellij.CvsBundle; import com.intellij.cvsSupport2.CvsUtil; import com.intellij.cvsSupport2.application.CvsEntriesManager; import com.intellij.cvsSupport2.connections.CvsEnvironment; @@ -31,8 +30,8 @@ import com.intellij.openapi.vcs.FilePath; import com.intellij.openapi.vfs.VirtualFile; import com.intellij.util.ArrayUtil; import org.jetbrains.annotations.NonNls; -import org.jetbrains.annotations.Nullable; import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; import org.netbeans.lib.cvsclient.admin.Entry; import org.netbeans.lib.cvsclient.command.Command; import org.netbeans.lib.cvsclient.command.checkout.CheckoutCommand; @@ -45,15 +44,6 @@ import java.util.Collections; @SuppressWarnings({"FieldAccessedSynchronizedAndUnsynchronized"}) public class GetFileContentOperation extends LocalPathIndifferentOperation { - public String getRevisionString() { - if (myCvsRevisionNumber != null) { - return myCvsRevisionNumber.asString(); - } else if (myRevisionOrDate != null){ - return myRevisionOrDate.toString(); - } else { - return CvsBundle.message("cvs.unknown.revision.presentation"); - } - } @NonNls private static final String VERS_PREFIX = "VERS:"; @@ -199,6 +189,7 @@ public class GetFileContentOperation extends LocalPathIndifferentOperation { public synchronized byte[] getFileBytes() { if (myFileBytes == null) { + if (myState == DELETED) return ArrayUtil.EMPTY_BYTE_ARRAY; myFileBytes = loadFileBytes(); } return myFileBytes; @@ -225,7 +216,7 @@ public class GetFileContentOperation extends LocalPathIndifferentOperation { } if (myReader.isEmpty()) { myState = DELETED; - return null; + return ArrayUtil.EMPTY_BYTE_ARRAY; } else { myState = SUCCESSFULLY_LOADED; diff --git a/plugins/cvs/cvs-plugin/src/com/intellij/cvsSupport2/history/ComparableVcsRevisionOnOperation.java b/plugins/cvs/cvs-plugin/src/com/intellij/cvsSupport2/history/ComparableVcsRevisionOnOperation.java index e8795da0b40a..dbd47ebd15f0 100644 --- a/plugins/cvs/cvs-plugin/src/com/intellij/cvsSupport2/history/ComparableVcsRevisionOnOperation.java +++ b/plugins/cvs/cvs-plugin/src/com/intellij/cvsSupport2/history/ComparableVcsRevisionOnOperation.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2009 JetBrains s.r.o. + * Copyright 2000-2015 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. @@ -65,9 +65,6 @@ public class ComparableVcsRevisionOnOperation implements VcsFileRevision { if (result.hasErrors()) { throw result.composeError(); } - if (isDeleted()){ - throw new VcsException(CvsBundle.message("message.text.revision.was.deleted.from.repository", myOperation.getRevisionString())); - } } return getContent(); } diff --git a/plugins/cvs/cvs-plugin/src/com/intellij/cvsSupport2/history/CvsFileContent.java b/plugins/cvs/cvs-plugin/src/com/intellij/cvsSupport2/history/CvsFileContent.java index c22ec7e21bad..5f004d4711a2 100644 --- a/plugins/cvs/cvs-plugin/src/com/intellij/cvsSupport2/history/CvsFileContent.java +++ b/plugins/cvs/cvs-plugin/src/com/intellij/cvsSupport2/history/CvsFileContent.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2009 JetBrains s.r.o. + * Copyright 2000-2015 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. @@ -57,9 +57,6 @@ public abstract class CvsFileContent implements VcsFileContent{ throw new VcsException(CvsBundle.message("exception.text.cannot.find.revision", getRevisionNumber())); } - if (isDeleted()) { - throw new VcsException(CvsBundle.message("message.text.revision.was.deleted.from.repository", getRevisionNumber())); - } return myComparableCvsRevisionOnOperation.getContent(); }