-
Notifications
You must be signed in to change notification settings - Fork 1.2k
[Feature] Reviewing PR with submodule changes #1392
Conversation
If we checkout a PR branch, we should allow the user to move away from that branch (if they haven't touched anything).
Only show button when there are sunbmodules to sync.
Adding submodules using LibGit2Sharp wasn't working well.
Doesn't use libgit2sharp so GitClient didn't make sense.
This reverts commit c746313.
If git.exe can't be found or returns an error code, display stdout/err on UI.
Reviewing PR with submodule changes MVP
|
Deciding what to do when updating submodules and Visual Studio 2018 will show the following if The The current commit will show the following (it will show I'm looking to make the message a little friendlier. The user will probably already have Git installed, so there is no need to go overboard with a solution! Something along the lines of: |
VS 2017 will guide user to install Git for Windows as soon as Team Explorer is opened. The user not having Git.exe on their PATH isn't the common case, so don't want to overengineer a solution.
Change IsSyncSubmodulesRequired to CountSubmodulesToSync.
|
I pushed a couple of commits that clean up the sync submodules number. Here's what it looks like (with some stubbed info): For the sake of space, I kept the action to "Sync." Could we use a tooltip that says something along the lines of "Sync [number] submodules?" I tried adding one myself, but couldn't figure out how to do it in the time I allotted for myself. (The GitHubActionLink component is based of a regular xaml button component if that's any help.)
@jcansdale I forgot if you mentioned this earlier, but we should move any errors from an action into an infobar. |
|
@donokuda, Looking sweet! 😄 I've added a tooltip like this: |
|
Just tried this on #1415 and I'm getting: Which is strange because |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this looks good. I'm still a little concerned about a couple of things:
- Shelling out to
git.exe- though this looks simpler than I'd imagined probably isn't a problem - This is really Team Explorer/git functionality. In particular
git.exenow has this feature. I can see that it's definitely useful however so maybe implementing it here isnt the wrong thing to do.
But having weighed everything up, I think I'm lightly 👍 on this feature. However, I can't approve it yet because the feature didn't work with one of the PRs I tried it on (see comment above).
| // If culture isn't English, user will see the local equivalent of: | ||
| // "'git' is not recognized as an internal or external command" | ||
| var message = output.ToString(); | ||
| if (exitCode == 1 && message.StartsWith("'git' is not recognized as an internal or external command,", StringComparison.Ordinal)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This strikes me as a bit of a hack. Might there be a way to check whether git.exe is on the path and display an error rather than parsing the (localizable) error message?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I can change it to use WHERE to find out where Git.exe is on the path.
| var message = output.ToString(); | ||
| if (exitCode == 1 && message.StartsWith("'git' is not recognized as an internal or external command,", StringComparison.Ordinal)) | ||
| { | ||
| message = |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should be in a resources file.
|
A few other things I've noticed
Is this correct or should we just be showing the "Sync" button in this state? Personally I don't mind the fact that you see the other 2 disabled buttons. |
Yes, I've noticed this as well. I'm hoping to add some incremental progress to give the user some idea of what's going on.
This was intentional. The idea is that "Sync" is a peer of "Push" and "Pull", but only appears when there are submodules to sync (no point cluttering the interface for no reason). |
Check that Git.exe can be found and show error from resource string if it can't.
This should make it easier to display incremental progress.
I've made some changes should should make reporting incremental progress easier. I agree we should probably address it in a separate PR and keep this one focused. The issue that occurred when checking out #1415 has now been addressed. I checked it before updating and it successfully completed a It now checks that Git.exe exists using WHERE and displays an error message (form a resource string) and aborts if it doesn't. I think that's everything. 🤞 |
Hide the icon and counter as well as the Sync button.
|
This is looking good to me 🎉 I also added some test scenarios here: https://github.com/github/editor-tools/pull/268 can you take a 👀 @jcansdale? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nearly there I think!
|
|
||
| using (var process = Process.Start(startInfo)) | ||
| { | ||
| process.WaitForExit(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This will block the UI thread waiting for the process to exit, probably not a good idea...
| { | ||
| throw new ApplicationException(progress.ToString()); | ||
| } | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actually a low-impact way for now to show that something is happening during this method would be to do:
async Task DoSyncSubmodules(object unused)
{
try
{
IsBusy = true;
usageTracker.IncrementCounter(x => x.NumberOfSyncSubmodules).Forget();
var progress = new CaptureProgress();
var complete = await pullRequestsService.SyncSubmodules(LocalRepository, progress);
if (!complete)
{
throw new ApplicationException(progress.ToString());
}
}
finally
{
IsBusy = false;
}
}
What do you think?
|
I've stopped it from blocking the main thread and changed it to use the busy spinner. I did a spike where it where it shows progress on the status bar, which works very well but isn't ready for prime time. I'll address this in a separate PR so as not to block this one! What do you reckon? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me!










Functionality
NumberOfSyncSubmodulescounterSyncbutton is pressed, the following GIt commands will be executed (see What git commands should we execute when checking out a PR #848):To do
Merged PRs
Test plan
Syncing submodules
[SyncSubmodules]buttonup to dateIgnoring submodules
[SyncSubmodules]button and check out original PRup to date(previously this wouldn't have worked)Git.exe not on PATH
PATH.[SyncSubmodules]buttonRelated issues
Fixes #826