on 2019 Apr 24 12:10 PM
Hello,
I would like to create a Git plugin for the WebIDE. The plugin (extension) should connect a project with an external git.
In our case, we use gitlab. The Gitlab API is accessed via HTTP requests and creates an empty git repository. We have already been able to implement this as a plugin.
But afterwards we must initialize the local git repository of an existing project. Then, the remote origin of this local git repository should be set to the created gitlab repository.
For this plugin (extension) I would like to use the two existing functions/features of the WebIDE.
1. Initialization of the local git repository(see picture 1):
2. Set the project remote (see picture 2):
This will open a dialog in which you have to enter the URL of the Git repository (see picture 3).
I would like to execute the two steps automatically in the background within my plugin without opening the dialogs.
As far as I know these two controls are use:
1. Sap.watt.ideplatform.gitclient/command/InitRepository
2. Sap.watt.ideplatform.gitclient/command/SetRemote
Does anybody know, if there is a way to call the two methods InitRepository and SetRemote without the dialogs?
If so, could you kindly send me a code example?
If this doesn't work, I'd like to call the methods that open the dialogs. Is this possible?
Or is it possible to execute the git commands
- git add -A
- git remote add origin <URL of Repository>
via Javascript
Best regards
Kevin Kussyk
Request clarification before answering.
Hi Kevin,
I am afraid that git APIs are not public API and you are not supposed to use them. But since sap.watt.ideplatform.gitclient/command/InitRepository and sap.watt.ideplatform.gitclient/command/SetRemote are commands you can use the following workaround:
execute: function () {
var that = this;
return this.context.service.command.getCommand("gitclient.initrepository").then(function (oInitRepoCommand) {
return oInitRepoCommand.getService().execute().then(function () {
return that.context.service.command.getCommand("gitclient.setRemote").then(function (oSetRemoteCommand) {
return oSetRemoteCommand.getService().execute().then(function () {
// do something
});
});
});
});
}
Regards,
Rima
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
57 | |
7 | |
7 | |
6 | |
5 | |
4 | |
4 | |
4 | |
4 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.