Skip to content
This repository was archived by the owner on Jun 21, 2023. It is now read-only.

Commit 4ae78f8

Browse files
committed
Warn if user tries to open solution file that isn't checked out
Stop user from opening solution files that aren't related to the target PR diff file.
1 parent 6415049 commit 4ae78f8

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

src/GitHub.VisualStudio/Views/GitHubPane/PullRequestDetailView.xaml.cs

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -132,6 +132,12 @@ async Task DoOpenLiveFile(IPullRequestFileNode file)
132132
{
133133
try
134134
{
135+
if (!ViewModel.IsCheckedOut)
136+
{
137+
ShowInfoMessage("Checkout PR branch before opening file in solution.");
138+
return;
139+
}
140+
135141
var fullPath = ViewModel.GetLocalFilePath(file);
136142

137143
var activeView = NavigationService.FindActiveView();
@@ -152,6 +158,13 @@ async Task DoOpenLiveFile(IPullRequestFileNode file)
152158
}
153159
}
154160

161+
static void ShowInfoMessage(string message)
162+
{
163+
ErrorHandler.ThrowOnFailure(VsShellUtilities.ShowMessageBox(
164+
Services.GitHubServiceProvider, message, null,
165+
OLEMSGICON.OLEMSGICON_INFO, OLEMSGBUTTON.OLEMSGBUTTON_OK, OLEMSGDEFBUTTON.OLEMSGDEFBUTTON_FIRST));
166+
}
167+
155168
async Task DoDiffFile(IPullRequestFileNode file, bool workingDirectory)
156169
{
157170
try

0 commit comments

Comments
 (0)