New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
only update submodule status at changes #5777
only update submodule status at changes #5777
Conversation
ac0a586
to
e61e803
Compare
Am testing the change. Will report back. |
I think calling the bool "updateStatus" is confusing, considering the function we call is UpdateSubmodulesStatus. Not sure what's a better name, though. Either the bool or the function should be renamed. Maybe "updateDetailedStatus" or "getDetailedStatus" to match the name of the value that gets set: SubmoduleInfo.Detailed. In any case, I'm not sure this is working the way you wanted. The last commit makes it so that I never see submodule status icons in the browse menu (when the option is enabled). The only place where it could possibly be updated is in the FormBrowse anonymous func registered on GitWorkingDirectoryStatusChanged: if (AppSettings.ShowSubmoduleStatus && _submoduleStatusProvider.HasSubmodulesStatusChanged(status))
{
UpdateSubmodulesStatus(updateStatus: true);
} When I change repo, and this gets called, _submoduleStatusProvider.HasSubmodulesStatusChanged(status) returns false. Not sure when this would return true. Overall, I'm not sure I understand this change. If we enable status update in browse menu, shouldn't refresh, etc. always update it? |
e61e803
to
e260afa
Compare
Codecov Report
@@ Coverage Diff @@
## master #5777 +/- ##
=========================================
Coverage ? 36.62%
=========================================
Files ? 623
Lines ? 47464
Branches ? 6307
=========================================
Hits ? 17383
Misses ? 29349
Partials ? 732 |
The submodule status updates when the commit-count reports that submodules are changed. If not, there is no need to update the status for submodules as they are not changed. (Changes to supermodules are ignored). |
|
Commit count is how many commits did the submodule move. |
Thanks @vbjay. I'm going to test this change again soon to better understand what I was seeing. |
@gerhardol I just tried the latest, and now I see the status icons appear. Not sure what was happening before. Anyway, I personally don't like that we don't get the status of all submodules, including parents. It feels inconsistent. For example, when I'm at the root module, I see the following: But if I check out the nested Git.hub, which itself has a diff, I see this: Now it looks like all my submodules are up to date. This feels weird and inconsistent, don't you think? And if I check out the parent of Git.hub, we see all status updates, even for super modules: I find this difficult to understand as a user. Indeed if I've got a module currently opened, and I make any modification, I'd like to see that the parent module is dirty in the submodule list. All of this, of course, will apply to the Submodule ROT. |
I have seen the problem with status not always updated, not what the cause is.
Really similar if status is never updated. I suggest that the icon is changed so you can see if the status is updated or not for these scenarios. Also add a button for refresh of status. The current implementation will calculate status when opening a repo (and refresh) but only trigger stus refresh when the commit-count reports changed submodules. So this PR would not be a major difference from v3. The core problem is what to trigger recalculations on superprojects from. I assume the submodule structure will be separate from the status, i.e. done separately and that we want status (configurable off).
|
I don't think either of the two options above are great. The first because of the reason I specified above - that it's weird to see parent module status only when a current module's submodule status has changed. The second because it means we'd never see parent module status changed by default. Adding a special icon to show that their status is unknown seems weird to me. And adding a extra button to force update these status just adds more friction.
Just to be sure, would this option only refresh submodule status when form is activated (upon opening a module)? It would not update status if other changes are detected? I think another option would be:
I'm adding the above option, but I personally don't want it. My opinion is to leave things as they are. If we're going to optimize updating all submodules, it needs to be done in a seamless way -- the user shouldn't have to press any extra buttons, or see "unknown status" icons. I think the right solution will have something to do with scheduling tasks with priorities, or perhaps for now, introducing an artificial delay on the status updates of super modules. |
In 2.x, the submodules are reread every time the Browse form becomes active. Click on another window, click back on Browse and the structure/status is refreshed.
Every time the Browse window is activated then? |
Okay, then no, not like in v2, but like in the current version before your last commit. Basically, setting a dirty flag to update submodules when certain actions are performed. This works well in my opinion. And when it doesn't work, hitting F5/refresh to force it does the job.
You're right, most of the time you're in the top-most module, so this option I put forth isn't worth it. You didn't respond to the last paragraph I wrote, but I would like your thoughts, so here it is again: My opinion is to leave things as they are. If we're going to optimize updating all submodules, it needs to be done in a seamless way -- the user shouldn't have to press any extra buttons, or see "unknown status" icons. I think the right solution will have something to do with scheduling tasks with priorities |
In v3 all status are refreshed at start. All status are updated when any submodule is updated. There is no trigger for supermodules changes only. This is incomplete. The v2 approach is the only I can think of that will be updating supermodules at changes. This could be documented too. I added some other proposals to the list.
I considered that answered in the other paragraph. |
Right. So I don't know if it's really that bad that we don't detect super module changes automatically, as long as F5/Refresh does it. This is similar in spirit to how you can make repo changes outside of GE, and it will only show once you hit F5/Refresh. Thoughts?
Should that second point be "Update all supermodules on any change to submodules or upon refreshing explicitly (behavior in current master) ? |
e260afa
to
b2d101a
Compare
Updated to refresh status immediately when there are supermodules Will clean up and remove wip in some days |
This is a great idea @gerhardol! We get the fast performance when we're in the top-level module, and the supermodule updates otherwise. There is a bug, though, that I found while testing:
The reason this happens is this code in FormBrowse in the GitWorkingDirectoryStatusChanged handler: if (AppSettings.ShowSubmoduleStatus && _submoduleStatusProvider.HasSubmodulesStatusChanged(status))
{
UpdateSubmodulesStructure(updateStatus: true);
} When we go from dirty back to clean, this code won't call UpdateSubmoduleStructure because 'status' will be empty. I think the right fix is changing it to something like this: bool updateStatus = AppSettings.ShowSubmoduleStatus && _submoduleStatusProvider.HasSubmodulesStatusChanged(status);
UpdateSubmodulesStructure(updateStatus: updateStatus); This way, we always call UpdateSubmoduleStructure with either 'true' if there are submodule files to update, or false otherwise. This will make sure to update the status icons all the time. Edit: incidentally, this might also fix the bug of there being no submodules at all in the submodules menu on startup sometimes. I saw it happen the first time I launched with your latest changes. |
Thanks _submoduleStatusProvider.HasSubmodulesStatusCleanToDirty(status)
That should not make any change, if something make it worse. The occasional "no submodules" (very often in 2.x) is probably occurring when the structure is not updated or being refreshed. Splitting structure and status should improve this further (but the main reason for a split is performance). |
The remaining problem I know of is that the submodule list is not always updated after starting GE |
d4edef2
to
33515e8
Compare
My educated guess is that this is related to CancellationException being thrown, and code in an async handler using a cancelled token, similar to the problem I fixed recently with RoT remaining blank. One thing I think I noticed last time is that on startup, there are two calls to UpdateSubmoduleStructure very close together, so the second would cancel the first. |
I just ran your latest branch, and ran with "browse ", and I got the load with no submodules in the menu. Below is the partial output in VS. As you can see, there's a bunch of System.OperationCanceledException that got thrown at the end. I suspect this to be the problem:
|
Okay, did a bit more debugging, since I'm able to repro the problem of no submodules showing up right now. The problem is that on launch, and opening the first repo, we never get a call to UpdateSubmodulesStructure(). I think this boils down to the fact that the code in UICommands_PostRepositoryChanged doesn't run the first time we launch and browse a repo; only if we change the repo afterwards. Note that this also means UpdateStashCount() isn't run on launch. Eplicitly invoking UICommands_PostRepositoryChanged from the FormBrowse does work, but we probably want to call a function "OnPostRepositoryChanged" from both places instead: InitializeComplete();
RestorePosition();
UICommands_PostRepositoryChanged(this, null);
return; Edit: Ah, and I can explain why it works sometimes on launch. If you have at least one submodule change, then when it executes the GitWorkingDirectoryStatusChanged callback on launch, and you have ShowSubmoduleStatus enabled, then this code will end up calling UpdateSubmoduleStructure: if (AppSettings.ShowSubmoduleStatus)
{
if (_submoduleStatusProvider.HasChangedToNone(status))
{
UpdateSubmodulesStructure(updateStatus: false);
}
else if (_submoduleStatusProvider.HasStatusChanges(status))
{
UpdateSubmodulesStructure(updateStatus: true);
}
} However, if ShowSubmoduleStatus is false, or you have no submodule changes whatsoever, then UpdateSubmoduleStructure never gets called on launch, and we end up with no submodules in the menu. Edit 2: Yeah, so I guess if we explicitly call UpdateSubmodulesStructure in the FormBrowse constructor, we will end potentially calling it twice in succession (second time in UICommands_PostRepositoryChanged callback), which means the first one will be cancelled, etc. Maybe in the UICommands_PostRepositoryChanged callback, we want to make sure to call UpdateSubmoduleStructure if it has never been called before? |
Should be the solution |
No problem. Just want to make sure you saw my 2 edits to my comment, especially the second one, where I mention that adding this call means we'll end up cancelling it if we have submodule changes and status update enabled... |
Is this something we need for v3?
…On Fri, Nov 30, 2018, 1:38 AM Antonio Maiorano ***@***.***> wrote:
Should be the solution
Thanks
No problem. Just want to make sure you saw my 2 edits to my comment,
especially the second one, where I mention that adding this call means
we'll end up cancelling it if we have submodule changes and status update
enabled...
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
<#5777 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AEMyXosNbFyJqYPfS9kcH_VNetrRXrBoks5uz_F4gaJpZM4Yezd->
.
|
No Further decrease the load when opening a repo for next release after 3.0. |
33515e8
to
671c39b
Compare
Start GitStatus with shorter delay if requested interactively
671c39b
to
e1bff16
Compare
Submodule structure (no Git query required) is calculated directly when a repo is opened, but submodule status is delayed to when commit-count reports that there are changes. No action needed otherwise. Submodule status setting is now dependent on the status updates Previously the status was calculated initially also if commit-count was disabled, but never updated. Similar for stash count
e1bff16
to
9f39c23
Compare
Updated and squashed. (If someone is interested in the changes to fix the last issue discussed, you can look at bugfix/submodule-performance-test-3 in my clone). The CodeFactor comment is on FormBrowse() constructor, I do not want to rewrite that now... |
This is a follow up to #5747 after discussions with @amaiorano
This is part 1 of #5769 - should maybe be considered for 3.0
This is based on #5747 minus last commit, submitted for @amaiorano to give feedback
Changes proposed in this pull request:
SubmoduleStatus: Update only when commit-count reports changes to submodules
Update submodule status at changes directly (async)
when changes detected, do not wait for dropdown or form reactivation
Submodule status setting is now dependent on the status updates
There are two special cases:
Screenshots before and after (if PR changes UI):
What did I do to test the code and ensure quality:
Has been tested on (remove any that don't apply):