Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 369591

Summary: improve workflow for accepting contributions from github
Product: [ECD] Orion Reporter: Susan McCourt <susan>
Component: ClientAssignee: Szymon Brandys <Szymon.Brandys>
Status: RESOLVED FIXED QA Contact:
Severity: normal    
Priority: P3 CC: edyta.przymus, grant_gayed, mamacdon, Szymon.Brandys, tomasz.zarna
Version: 0.4   
Target Milestone: 1.0 M1   
Hardware: PC   
OS: Windows 7   
Whiteboard: gsoc2012
Bug Depends on: 368433, 369297, 369603, 369604, 369605    
Bug Blocks:    
Attachments:
Description Flags
Notification command none

Description Susan McCourt CLA 2012-01-24 15:11:39 EST
Now that we have more contributors on Orion (YEA!) we need to think about how Orion can better support committers taking contributions. 

The workflow today is not great.

- contributor sends a pull request or link to a commit in github
- we click on the link to figure out their repo and add it as a remote
- we fetch the branches
- we realize we need to know which branch, if they didn't specify it we ask for it
- we open git log and cherry pick the commit

What I would *like* to do is have contributors be able to give me a link that results in an Orion page opened on the commit page where I can browse diffs and cherry pick.

I think the main blocker today is that the commit link inside Orion is workspace specific.  Not sure about this, but I see this URL:
http://orion.eclipse.org/git/git-commit.html#/gitapi/commit
/f3bbbbce1b6683c0f9737102922e90886d5d81b7/file/b/?page=1&pageSize=

and I'm assuming that the file/b is workspace specific?

One quickie we could do is add a command to the repo page on the remote that says "open commit"...you paste in the commit id and it opens the commit page on the right thing.  Then I don't have to know the branch, which can be really helpful.

If we could get rid of the workspace-specific path (or if I'm wrong about that) then a better solution is a script on the github side that says
"make contribution link in Orion".  This would also require code on the Orion side to do whatever is needed to add the remote, etc.
Comment 1 Susan McCourt CLA 2012-01-24 17:03:23 EST
the blocking bugs suggest interim improvements to make the current workflow a bit easier
Comment 2 Susan McCourt CLA 2012-01-24 17:16:51 EST
the biggest PITA right now is figuring out how to get from 
github->commit id

to

a branch I can see in Orion.

If we can fix that problem somehow I would be less grumpy right now
Comment 3 Szymon Brandys CLA 2012-01-25 11:47:53 EST
(In reply to comment #0)
> One quickie we could do is add a command to the repo page on the remote that
> says "open commit"...you paste in the commit id and it opens the commit page on
> the right thing.  Then I don't have to know the branch, which can be really
> helpful.

I thought about the same before I look at the bug :) It makes sense. I'll try to add it ASAP.
Comment 4 Susan McCourt CLA 2012-01-25 12:11:17 EST
Szymon and I talked about what could easily be done for 0.4.

1. implement an "open commit command"
2. user can choose this command from an existing clone, or they can just choose it in the "Remotes" heading (unspecified remote)
3. the command parameters are a URL for the repo and the commit id (maybe extra credit is to parse a github commit link to get both parameters).  URL is prefilled in if command is chosen from an existing remote

Now the contributor just pastes in the github commit link (as today).
Committer can paste into the "open commit" slideout.

OR...cooler...

a greasemonkey script on the bugzilla side invokes the slideout by using the provided github commit id and our command syntax/URL binding stuff to do it:

Something like...
orion.eclipse.org/repository.html#,acceptContribution=https://github.com/user/orion.client/commit/someID
Comment 5 Szymon Brandys CLA 2012-01-27 04:13:16 EST
I'm taking the bug.
Comment 6 Szymon Brandys CLA 2012-02-16 08:47:33 EST
For .4 I added "Open Commit" dialog and a Greasmonkey script to open a commit from GitHub. I'll continue working on that in .5.
Comment 7 Susan McCourt CLA 2012-02-16 11:32:19 EST
(In reply to comment #6)
> For .4 I added "Open Commit" dialog and a Greasmonkey script to open a commit
> from GitHub. I'll continue working on that in .5.

This has already saved me time.  And yesterday I was able to find a reference to a commit SHA in a bug and open it to refer to a very old fix that would have been hard to find otherwise.
Comment 8 Edyta Przymus CLA 2012-07-19 17:21:22 EDT
One of the part of solution of this bug is a possibility to send from Orion ask for review to someone. I created such a command. I attached how it looks like - the button and the message. I implemented also the server part, and I really would appreciate any commands and remarks about it, because I didn't write a lot of server code yet.
These are commits:
Server:  https://github.com/edytaprzymus/orion.server/commit/0f55dd9bae19ba8340d32457fb9e852a114847ee

Client: https://github.com/edytaprzymus/orion.client/commit/c5e0ebfb4ffe8777edcc74e15c72d35ab5c38ebb

Please consider the code written in GitCommitHandlerV1 servlet. Please be aware that to test this feature you need to configure your localhost to be able to send emails.
Comment 9 Edyta Przymus CLA 2012-07-19 17:22:06 EDT
Created attachment 218953 [details]
Notification command
Comment 10 Szymon Brandys CLA 2012-07-24 10:50:56 EDT
I guess you gave me it to review by mistake.
1. The code does not compile. I had to add the dependency to javax.mail.glassfish
2. When I navigate through repositories, repository page I see lots of POST /gitapi/commit with response 500 in the firebug console
3. Git Log does not work at all
4. I was able to see the commit page only via clicking commit link on the tag list (repository page)
5. When I send notification, I has not confirmation that it was really sent

I haven't looked at the code yet, but noticed this in GitCommitHandlerV1 line 424 --> System.out.println(email);
Comment 11 Edyta Przymus CLA 2012-07-26 13:43:39 EDT
https://github.com/edytaprzymus/orion.client/commit/2fd5f8d9b5ec0f10540d2f4d05c392cd1d060608
https://github.com/edytaprzymus/orion.server/commit/ea5324333ab5a3a0f8e8b469621a24afb220774a
New commit:
-Szymon's remarks fixed
-Changed the input data of the command - now, you have to put user login, so whole thing is safer, because cannot work as a spam generator.
Comment 12 Edyta Przymus CLA 2012-07-31 08:27:07 EDT
I wrote all this code and have the rights to contribute it to Eclipse under the
eclipse.org web site terms of use.
Comment 13 Edyta Przymus CLA 2012-07-31 08:27:14 EDT
I wrote all this code and have the rights to contribute it to Eclipse under the
eclipse.org web site terms of use.
Comment 14 Szymon Brandys CLA 2012-08-07 05:19:06 EDT
I gave it another try. 

In the mail sent to the reviewer the url is wrong. The mails says:
Please visit http://localhost:8080//git/pullRequest.html#git://github.com/edytaprzymus/orion.client_902dfa2214dfaf86e144e4be48d6e275686f4ced to get the code.
There is a redundant slash before /git/pullRequest and clicking it ends up with 404.
Comment 15 Szymon Brandys CLA 2012-08-07 06:54:22 EDT
The client side looks good in general. We need to refactor the server part though.
All pull request related code should be in git bundles and this code should just call UserEmailUtil to send notifications. I think that we do not need EmailNotificationServlet, we could just use GitServlet to handle http calls for pull requests.
Comment 16 Szymon Brandys CLA 2012-08-07 07:11:55 EDT
The server side commit is messy. EmailNotificationServlet and /useremailnotification from plugin.xml in configurator are not used and can be removed.
Comment 17 Szymon Brandys CLA 2012-08-07 09:52:08 EDT
I fixed the server side and pushed.
Comment 18 Szymon Brandys CLA 2012-08-07 11:14:00 EDT
I also fixed all remaining issues in the client commit and released it. Marking the bug FIXED and please open new bugs for new or remaining issues.