|
Re: JGit push with --set-upstream [message #1554286 is a reply to message #1551431] |
Fri, 09 January 2015 05:34 |
|
Am 08.01.2015 um 14:06 schrieb alexandre Escot:
> Hello,
>
> I am using JGit in my project and I search a way to push a branch and add the upstream reference (tracking).
> It is the option -u or ---set-upstream into the push command.
>
> I don't see a method in the class PushCommand which permit to do this.
That is more like a local config change rather than a remote command. With the Plugin Spy (Alt+Shift+F1) on the
"Configure Branch..." dialog you can open the class org.eclipse.egit.ui.internal.dialogs.BranchConfigurationDialog. It's
okPressed() method shows you what to do:
@Override
protected void okPressed() {
try {
String merge = branchText.getText();
if (merge.length() > 0)
myConfig.setString(ConfigConstants.CONFIG_BRANCH_SECTION,
myBranchName, ConfigConstants.CONFIG_KEY_MERGE,
merge);
else
myConfig.unset(ConfigConstants.CONFIG_BRANCH_SECTION,
myBranchName, ConfigConstants.CONFIG_KEY_MERGE);
String remote = remoteText.getText();
if (remote.length() > 0)
myConfig.setString(ConfigConstants.CONFIG_BRANCH_SECTION,
myBranchName, ConfigConstants.CONFIG_KEY_REMOTE,
remote);
else
myConfig.unset(ConfigConstants.CONFIG_BRANCH_SECTION,
myBranchName, ConfigConstants.CONFIG_KEY_REMOTE);
boolean rebaseFlag = rebase.getSelection();
if (rebaseFlag)
myConfig.setBoolean(ConfigConstants.CONFIG_BRANCH_SECTION,
myBranchName, ConfigConstants.CONFIG_KEY_REBASE,
true);
else
myConfig.unset(ConfigConstants.CONFIG_BRANCH_SECTION,
myBranchName, ConfigConstants.CONFIG_KEY_REBASE);
try {
myConfig.save();
super.okPressed();
} catch (IOException e) {
Activator.handleError(
UIText.BranchConfigurationDialog_SaveBranchConfigFailed, e, true);
}
} catch (RuntimeException e) {
Activator.handleError(e.getMessage(), e, true);
}
}
Cheers
/Eike
----
http://www.esc-net.de
http://thegordian.blogspot.com
http://twitter.com/eikestepper
Cheers
/Eike
----
http://www.esc-net.de
http://thegordian.blogspot.com
http://twitter.com/eikestepper
|
|
|
Powered by
FUDForum. Page generated in 0.05241 seconds