From bbb15eb971feac3003798618a400288db286d9c4 Mon Sep 17 00:00:00 2001 From: Aleksey Pivovarov Date: Wed, 9 Jan 2019 20:12:07 +0300 Subject: [PATCH] IDEA-87811 vcs: support line status markers for "modified without checkout" files --- .../vcs/impl/VcsFileStatusProvider.java | 21 ++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-) diff --git a/platform/vcs-impl/src/com/intellij/openapi/vcs/impl/VcsFileStatusProvider.java b/platform/vcs-impl/src/com/intellij/openapi/vcs/impl/VcsFileStatusProvider.java index 34c689c0cfb2..03b665ba888d 100644 --- a/platform/vcs-impl/src/com/intellij/openapi/vcs/impl/VcsFileStatusProvider.java +++ b/platform/vcs-impl/src/com/intellij/openapi/vcs/impl/VcsFileStatusProvider.java @@ -148,11 +148,22 @@ public class VcsFileStatusProvider implements FileStatusProvider, VcsBaseContent VcsBaseContentProvider provider = findProviderFor(file); return provider == null ? null : provider.getBaseRevision(file); } - final Change change = ChangeListManager.getInstance(myProject).getChange(file); - if (change == null) return null; - final ContentRevision beforeRevision = change.getBeforeRevision(); - if (beforeRevision == null) return null; - return new BaseContentImpl(beforeRevision); + + ChangeListManager changeListManager = ChangeListManager.getInstance(myProject); + + Change change = changeListManager.getChange(file); + if (change != null) { + ContentRevision beforeRevision = change.getBeforeRevision(); + return beforeRevision == null ? null : new BaseContentImpl(beforeRevision); + } + + FileStatus status = changeListManager.getStatus(file); + if (status == FileStatus.HIJACKED) { + VcsCurrentRevisionProxy beforeRevision = VcsCurrentRevisionProxy.create(file, myProject); + return beforeRevision == null ? null : new BaseContentImpl(beforeRevision); + } + + return null; } @Nullable