DESCRIPTION

Suggest branch name based on active task when fetching from Gerrit

Change-Id: I22cf56291b2c3cd1473c87452be5394aaa0e562c


COMMENTS

author: Brenden Conley
date: 2013-01-17 19:03:55.000000000

Patch Set 2:

Build Started https://hudson.eclipse.org/sandbox/job/egit.gerrit/4015/ 

-------------------------------------
author: Brenden Conley
date: 2013-01-17 19:04:51.000000000

Patch Set 2: Fails

Build Failed 

https://hudson.eclipse.org/sandbox/job/egit.gerrit/4015/ : FAILURE

-------------------------------------
author: Douglas Trujillo
date: 2013-01-17 23:37:14.000000000

Patch Set 2: I would prefer that you didn't submit this; Unclean IP, do not check in

(11 inline comments)

- nice that you are taking up prior stalled work on this topic :-)
- we need you to assert the contributor questions as a comment on this change's review, see [1], this is required for all contributions from non-project committers by the Eclipse IP process

[1] http://wiki.eclipse.org/EGit/Contributor_Guide#Legal_Paperwork

Line:33, org.eclipse.egit.ui/META-INF/MANIFEST.MF -> this is a newer version than the latest available mylyn release (3.8.2), when is 3.9 going to be shipped ? 

This requires that we build against http://download.eclipse.org/mylyn/snapshots/weekly, i.e. this change also needs to update the target platform definitions in org.eclipse.egit.target, this will fix the build error

s/3.9.0/[3.9.0,4.0.0)/

Line:34, org.eclipse.egit.ui/META-INF/MANIFEST.MF -> s/3.9.0/[3.9.0,4.0.0)/

Line:2, org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/fetch/TaskBranchNameSuggester.java -> why 2004 ? Are you transferring something written earlier ?

Line:20, org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/fetch/TaskBranchNameSuggester.java -> - we don't use author tags
- we want javadoc for public classes

Line:30, org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/fetch/TaskBranchNameSuggester.java -> Shouldn't this list be configurable with a reasonable default ? What if somebody wants to use a different language than English ?

Line:51, org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/fetch/TaskBranchNameSuggester.java -> this may generate pretty long branch names, e.g. in the history view you end up seeing the bugID and only a few chars of the tasks header line, hence I would prefer to
- not use any prefix
- start with the semantic part of the task name and append the bug number
- use camel case instead of _
- limit the max length of the generated branch name

If we would first fetch and then inspect the commit messages we could find the bug ID in the commit message and use the corresponding bug instead of the active task, this would avoid the need to first select the correct active task manually. 

Then we could even automatically set the active task based on the bug ID contained in the commit message :-)

Line:56, org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/fetch/TaskBranchNameSuggester.java -> Maybe we could make this configurable via a branch name template similar to the commit message template which can accept task attributes to construct a commit message from the active task

Line:61, org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/fetch/TaskBranchNameSuggester.java -> style nit: we don't use braces around single line blocks, see contributor guide

Line:666, org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/fetch/FetchGerritChangePage.java -> style nit: missing blanks around operators, see contributor guide for styles we use

Line:667, org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/fetch/FetchGerritChangePage.java -> style nit: this line looks too wide

if the generated branch name is already taken, it's likely that either the wrong task is active or several commits are required to fix the bug, so probably we could act a bit smarter

Line:7, /COMMIT_MSG -> mark work in progress with [DRAFT] or [RFC] in the commit message header to avoid wasting the time of reviewers looking for changes ready to be submitted

-------------------------------------
author: Charles Atkins
date: 2013-01-18 00:08:04.000000000

Patch Set 2:

I confirm that:

* I authored 100% of the content that I am contributing.
* I own the copyright of the contributed content
* I have the rights to contribute the content to Eclipse.
* I contribute the content under the EPL.

-------------------------------------
author: Charles Atkins
date: 2013-01-18 00:20:42.000000000

Patch Set 2: (5 inline comments)

Thanks for the feedback!

Line:33, org.eclipse.egit.ui/META-INF/MANIFEST.MF -> I would think the mylyn dependency should only be from a separate bundle anyway (egit.mylyn or mylyn.git) and should be contributed through extension point.

Line:30, org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/fetch/TaskBranchNameSuggester.java -> Sounds like a good idea. OTOH, does git support branches with, say, Chinese characters in the name? :-)

Line:51, org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/fetch/TaskBranchNameSuggester.java -> That all sounds great, but I thought I'd start with baby steps. :) Also I followed the convention in use at Tasktop and Mylyn of naming branches as (task|bug)_ID_summary. But I agree we should probably encourage more compact branch names. I think ideally the task ID would not be part of the branch name at all but rather the branch would have metadata containing the task URL, but I don't know if this is possible.

Line:61, org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/fetch/TaskBranchNameSuggester.java -> I suppose there's no point in pointing out that omitting braces is discouraged:
http://www.oracle.com/technetwork/java/javase/documentation/codeconventions-142311.html#449
:-)

Line:667, org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/fetch/FetchGerritChangePage.java -> I agree we could be smarter e.g. offering to delete the branch or cherry-pick the commit on to it.

-------------------------------------
author: Douglas Trujillo
date: 2013-01-18 09:20:20.000000000

Patch Set 2: (4 inline comments)



Line:33, org.eclipse.egit.ui/META-INF/MANIFEST.MF -> that's true this functionality should move to egit.mylyn, egit.ui should not depend on mylyn, I missed this. But still the target platform needs to be adapted in order to fix the build and we need to know if 3.9 will be released with Juno SR2, otherwise this change has to wait until egit 2.3 was released

Line:30, org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/fetch/TaskBranchNameSuggester.java -> AFAIK jgit always uses UTF-8, but native git or the file system may have a different opinion

Line:51, org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/fetch/TaskBranchNameSuggester.java -> I agree, small steps are alway a good idea :)

AFAIK branches are just pointers implemented as a file containing a SHA1 so there's no way to add metadata in a git conform way at the moment

Line:61, org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/fetch/TaskBranchNameSuggester.java -> we just follow the convention established a long time ago (pre-dates my involvement in these projects), if you want to change this start the discussion on the jgit/egit dev lists

-------------------------------------
author: Charles Atkins
date: 2013-01-18 16:19:26.000000000

Patch Set 2: (2 inline comments)



Line:34, org.eclipse.egit.ui/META-INF/MANIFEST.MF -> There's actually no need for this to depend on 3.9.

Line:1, org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/fetch/TaskBranchNameSuggester.java -> All of this code was writtin in 2012 or 2013. This copyright message is just the template I have in my workspace.

-------------------------------------
