Remember previously used push target branch name
kriegaex opened this issue · comments
This is a follow-up issue for #404, as requested by @uwolfer.
When working on a local branch that has a name different from the branch name I want to push to on the Gerrit server, the plugin never remembers my previous choice and I have to overwrite it for each push. It would be good if the plugin would remember at least a single target branch name, better a list of previously used branches.
I have the same problem. The default target branch is always "master" but my project's main branch is "main" so I always need to adjust that manually for every push.
I would even be happy if the plugin would read my git config and use that push path (refs/for/main
):
[remote "origin"]
url = git@github.com:TYPO3/typo3.git
fetch = +refs/heads/*:refs/remotes/origin/*
push = HEAD:refs/for/main
pushurl = ssh://xxx@review.typo3.org:29418/Packages/TYPO3.CMS.git
@simonschaufi: If I remember correctly, the default push branch is provided by IntelliJ (and this plugin only adds the prefix refs/for/
). If you set the tracked branch of your local branch to main
, the push dialog should automatically suggest refs/for/main
next time (probably restart required).
@uwolfer The truth is: in the push dialog I see main -> origin : main
.
As soon as I click the "Push to Gerrit" checkbox, it changes to refs/for/master
and the Branch input field is filled with "master".
In my git config there is nowhere a "master" branch.
Thanks for your feedback @simonschaufi.
This is really interesting - the plugin does not hardcode master
in any place as far as I can see. As far as I read the code, it constructs the branch name based on the remote branch name provided by IntelliJ...
At the moment, I do really not have an idea where master
comes from in your case. I have never seen this behavior. Will keep an eye on it.
@uwolfer I checked my .git/config
and the IDE settings and couldn't find "master" anywhere. Could we make a remote debug session to find out the issue?
@simonschaufi How does it look like after you execute the following command?
git branch --set-upstream my-local-branch origin/main
@uwolfer my git version is brand new (git version 2.25.1
) and doesn't support --set-upstream
anymore. Instead, I used git branch --set-upstream-to=origin/main
.
PhpStorm 2022.1.2
This is in my .git/config now:
[branch "issue/97701-Deprecate_showNewContentWizard"]
remote = origin
merge = refs/heads/main
rebase = true
and the branch is already filled with "master" but deactivated:
When I click the checkbox, the push target is again refs/for/master
and master is in the input field
and the branch is already filled with "master" but deactivated:
Is this correct? According to your screenshot, it is filled in with main
?
What IntelliJ version do you use? Do you remember if it ever worked in the past as expected?
@uwolfer No, it's not correct. It should be "main" but indeed it is pre-filled with master and as I said, I have no glue where this comes from.
PhpStorm 2022.1.2
Build #PS-221.5787.33, built on June 1, 2022
Runtime version: 11.0.15+10-b2043.56 amd64
VM: OpenJDK 64-Bit Server VM by JetBrains s.r.o.
Linux 5.14.0-1038-oem
GC: G1 Young Generation, G1 Old Generation
Memory: 4096M
Cores: 8
Registry:
debugger.watches.in.variables=false
run.processes.with.pty=TRUE
ide.balloon.shadow.size=0
Current Desktop: ubuntu:GNOME
It never worked correctly but TYPO3 used to use the master branch some months ago, but then they changed it to main and since then it is broken.
It never worked correctly but TYPO3 used to use the master branch some months ago, but then they changed it to main and since then it is broken.
That is probably in an interesting point. One thing you could try: clone the repo into a new location, setup IntelliJ, and try to push to Gerrit. Probably there is some IntelliJ setting which still holds a reference to master... This is just a guess into the dark, but I do not really have an idea what is going wrong.
clone the repo into a new location
I've done exactly that, tried it with Phpstorm, same result.
I then downloaded the plugin as well in Rider and there it's exactly the same behavior: The branch input field is prefilled with "master".
I then tried it in IntelliJ IDEA Ultimate - same result - prefilled with "master".
So I come to the conclusion that it is either hardcoded into Jetbrains software or it's some git setting.
So when you open the push window, it's prefilled with main?
Which Java version do I need to install to debug it on my system? I'm running Ubuntu btw.
So when you open the push window, it's prefilled with main?
It is not prefilled with main in my cases, but it is always prefilled with tracked branch name (and if there is none, it uses the local branch name). I can even switch the tracked branch name, and then when I open the push dialog, it shows the updated one.
Which Java version do I need to install to debug it on my system? I'm running Ubuntu btw.
I do not think it depends on the Java version. You can follow these steps in order to set up in IDE for developing and debugging the plugin.
I am really sorry, but I have no idea what is going on in your case. I would be really interested to hear your debugging results.
I have seen this documentation already but I'm always getting an error when I run the "runIde" action:
Forms instrumentation failed for /home/simon/Code/github/uwolfer/gerrit-intellij-plugin/src/main/java/com/urswolfer/intellij/plugin/gerrit/ui/LoginPanel.form: java.lang.RuntimeException: com.intellij.compiler.instrumentation.InstrumentationClassFinder$2: Class not found: javax.swing.JTextField
So I guess something is missing in my development environment which is not documented.
@simonschaufi What version of Java are you using? I know for sure that 11 works.
I use within IntelliJ:
- SDK: obenjdk-18
- SDK default 18
and my system versions are these:
java --version
openjdk 11.0.15 2022-04-19
OpenJDK Runtime Environment (build 11.0.15+10-Ubuntu-0ubuntu0.20.04.1)
OpenJDK 64-Bit Server VM (build 11.0.15+10-Ubuntu-0ubuntu0.20.04.1, mixed mode, sharing)
That is why I was asking you if you could help me setup my dev environment.
@uwolfer Through somebody else I finally found the reason for the "master" setting! 🎉
Have a look at TYPO3/typo3@3aad7ec
I didn't know that such a setting file exists!
Still, I would be interested in how to setup a working dev environment.
Through somebody else I finally found the reason for the "master" setting!
Great - thanks for the update!
Still, I would be interested in how to setup a working dev environment.
I think I have seen the same error as you posted also in the past - but I do not remember anymore what the fix for it was... :( Could you try to run intellij2020.3 branch, and see if the same happens?
The branch intellij2020.3
indeed works!
Sorry for not having given feedback here as the issue creator. But the fix happended more than one year after I had created it, and by then Gerrit already had become irrelevant and untestable for me, because (thank God!) Eclipse decided to close its Gerrit instance. I only used it, because I had to. But still, I want to thank @uwolfer for taking care of previously created issues and this one, too. I am sure, there still are many Gerrit users out there who can enjoy the fruits of your work. Great job!