IDEA 11 and pushing changes to Gerrit

Gerrit (http://code.google.com/p/gerrit/) is code review software. It works this way: instead of
     git push origin master
you do
     git push review
where review is defined as:


[remote "review"]
 url = ssh://john.doe@gerrit:29418/test
 push = HEAD:refs/for/master


refs/for/ is a 'magical' reference where every change is converted to a code review request and later, when accepted, marged with a proper branch. See http://gerrit-documentation.googlecode.com/svn/Documentation/2.2.0/user-upload.html#_git_push for details.

Now, IDEA 10.5 allow such push using Version Control → Git → Push changes, then:
- Remote: review
- Push: Default

A new push dialog introduced in IDEA 11 does not allow to perform this operation. What's more - it looks that checking Push current branch to alternative branch has no effect whatsoever.

1
3 comments

Hello Marcin,

In the new Git push dialog you may do the same: choose remote "review" and type in "refs/for/master"

But I agree that it is less handy, when push spec is defined.
Please fire a request in our bugtracker: http://youtrack.jetbrains.net/

There is also a problem http://youtrack.jetbrains.net/issue/IDEA-77985 that didn't allow to push to alternative remotes in certain conditions. The request is fixed and the fix will be available in the forthcoming 11.0.1

0

So, if I understand correctly I should set things this way (look at the attachment). Well, it doesn't work - IDEA runs command

19:17:18.394: git push origin master:review/refs/for/master

which doesn't make any sense. And I'm just confused what is a purpose of fields next to the 'Push current branch to alternative branch'. Basic syntax for push is

git push <repository> <src>:<dst>

and one can deduct that the combobox allows to choose a repository (remote) and the textfield allows to set dst.

Issue http://youtrack.jetbrains.net/issue/IDEA-77985 looks similar. There is also http://youtrack.jetbrains.net/issue/IDEA-78244, which should fetch default push from remote if defined, right?

One more thing - there is no way to specify src. Usually I want to push the last commit of the current branch, so e.g. HEAD = master but sometimes I need to fix and re-push one of the previously commited changes:

git push origin HEAD^:refs/for/master.


Anyway, it is not a common scenario so I could live without ability to set src from IDEA.


Attachment(s):
push.png
0

Yes, it should work that way: configure remote and destination branch.
You correctly identified the issues that prevent the functionality to work for remotes other than origin. The fix will be in 11.0.1 which is going to be release quite soon.

As per the source to push – it is not implemented yet because of some difficulties, but if there would be many requests, we'll probably make this work in future releases.

0

Please sign in to leave a comment.