-
-
Notifications
You must be signed in to change notification settings - Fork 2.1k
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
Remove IRunScript
and replace usage with IScriptHostControl
#11321
Open
SlugFiller
wants to merge
7
commits into
gitextensions:master
Choose a base branch
from
SlugFiller:replace-irunscript
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
c0f8e1b
Remove `IRunScript` and replace usage with `IScriptHostControl`
SlugFiller 5abb117
fixup! Remove `IRunScript` and replace usage with `IScriptHostControl`
SlugFiller 88d9090
fixup! Rebased
SlugFiller 91e0c77
fixup! Remove `THostForm` from `RunScripts` and pass using `IScriptHo…
SlugFiller 1ff0eb3
fixup! Remove `serviceProvider` parameter from `UserScriptContextMenu…
SlugFiller ff0f51c
fixup! Syntax sugar
SlugFiller dd94a30
fixup! Revert changes to `RunEventScripts`
SlugFiller File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
The not Control-specific functions of IScriptHostControl should be removed and be called via the anyway mandatory IGitUICommands and a slightly extended IBrowseRepo.
Then there will be no need for IScriptHostControl at all because the pair (IGitUICommands, IWin32Window) suffices - or
THostForm : IGitModuleForm, IWin32Window
.initial discussion: #11273 (comment)
Thoughts, @RussKie?
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.
A pair would never suffice, by virtue of being a pair. Because it has to be passed to, and stored inside, the likes of
RepoObjectsTree
. And there are no intersection types in C#. That's how we went down this rabbit hole in the first place.The other aspect is adding file selection methods to
IScriptHostControl
, which is necessary for #11239. So even if it was possible to removeIScriptHostControl
, it would only create issues down the line.And no, replacing it with
IGitUICommands
is not an option, because of windows likeFormCommit
that have multiple file lists in them. Having a relatively small, easily extensible interface, allows implementing a different file list for each control within the window. It allows returning the form's commonUICommands
, while still having customized file lists.TL;DR
IScriptHostControl
has to correspond with a control, not a form. Therefore, a form-common (and certainly an app-common) interface is too large to act as a replacement.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.
You are right that file selection methods should be added to
IScriptHostControl
.So I found a rationale why the current
IScriptHostControl
functions should be moved to IBrowseRepo (#11324): File scripts may benefit from RevisionGrid information, too. Having either files or revisions would be an arbitrary restriction.Regarding
RepoObjectsTree
andRevisionGridControl
, everything necessary is provided viaIGitUICommands
. They share the same owner Form.IScriptHostControl
can remain empty in this PR.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.
IScriptHostControl
can already carry both files and revisions if both information is available (e.g. diff view). And can skip the latter when it's unavailable (e.g. commit form). Moving half of that info toIBrowseRepo
doesn't make sense, whenIBrowseRepo
cannot conceivably handle the other half.You're right that if everything is provided via
THostForm
, thenRepoObjectsTree
can simply useFindForm() as GitModuleForm
(which, technically, is already a double-hack, usingas
, as well as usingGitModuleForm
in place of an intersection type). But the same would not apply to file lists, which would lack the ability to provide per-list overrides this way.Ultimately, instead of a clean-up refactor, it's a refactor that just makes everything more convoluted and complex. The beauty of
IScriptHostControl
is that it's relatively tiny, and can easily be extended/proxied with relatively minimal effort. More importantly, it's single-purpose. It's used purely for being passed toRunScript
.RunScript
does not need to worry about getting other parameters, andIScriptHostControl
does not need to worry about having other responsibilities.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 was an unlucky wording. Rather read "the pair" as "the two". And "no need for
IScriptHostControl
" means for this PR "RemovalIRunScript
".IWin32Window
is just needed as window owner of selection popups. Every control which wants to execute scripts, can pass its own handle (or its Form's handle).Every control which operates on a repo, already has an
IGitUICommands
instance.There is no need to downcast to
GitModuleForm
.THostForm
was just a trick in order to pass an owner handle and theIGitUICommands
instance in one argument. This can and should be split again.FileStatusList does not need to have information about e.g. the current checkout - and shall not need to have, which would be necessary if
IScriptHostControl
would provide information about revisions and files.Such information about revisions is provided by
IBrowseRepo
.What remains? A control wants to provide an interface in order to support additional placeholders ("options") in script arguments.
In the next PR, these will be files - in the future, something different for another control perhaps.
Hence it is nothing other than
IAdditionalScriptOptionsParser
orIScriptOptionsProvider
(and not a "host control").(Choosing names is not my strength. I am open to proposals.)
IScriptHostControl
should not be touched nor used by this PR - after rebase on #11324.Alternatively, we could supersede this PR with a new one. You or me?
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'm not entirely sure where you're going with this, so definitely you. If it gets accepted, I'll rebase #11239 on it, in the way that makes the most sense given the revised design.