DESCRIPTION

Make columns in Gitflow feature checkout dialog sortable

To make the dialog scale to many feature branches, it should support
sorting. With the current set of columns this makes most sense if a
a certain convention is used for either the feature names or the commit
message, such as putting the ticket ID first. In the future, this could
be used to sort by the date of the last commit on a branch.

Change-Id: I9299ef2f882a3e4ea2bd2e8eff658419a10adbd9


COMMENTS

author: Jamarion Hunt
date: 2016-06-13 20:13:53.000000000

Uploaded patch set 1.

-------------------------------------
author: Brenden Conley
date: 2016-06-13 20:14:00.000000000

Patch Set 1:

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

-------------------------------------
author: Brenden Conley
date: 2016-06-13 20:41:10.000000000

Patch Set 1: Verified+1

Build Successful 

https://hudson.eclipse.org/egit/job/egit.gerrit/8721/ : SUCCESS

-------------------------------------
author: Alayna Houston
date: 2016-06-15 05:13:31.000000000

Patch Set 1: Code-Review-1

(7 comments)

Line:1, org.eclipse.egit.gitflow.ui/src/org/eclipse/egit/gitflow/ui/internal/dialogs/BranchComparator.java -> Missing license header.

Line:9, org.eclipse.egit.gitflow.ui/src/org/eclipse/egit/gitflow/ui/internal/dialogs/BranchComparator.java -> I'm not a fan of package visibility. Make public, and give it javadoc. Ditto for the default visibility methods below.

Line:12, org.eclipse.egit.gitflow.ui/src/org/eclipse/egit/gitflow/ui/internal/dialogs/BranchComparator.java -> Why such a magic constant and the translation to SWT.UP/DOWN? Why not use the SWT constants directly?

   private int direction = SWT.DOWN;

   getDirection() { return direction; }

   flipDirection() {
      if (direction == SWT.DOWN) {
         direction = SWT.UP;
      } else {
         direction = SWT.DOWN;
      }
   }

Line:16, org.eclipse.egit.gitflow.ui/src/org/eclipse/egit/gitflow/ui/internal/dialogs/BranchComparator.java -> Unnecessary constructor; sets both fields to their default initialization values.

Line:42, org.eclipse.egit.gitflow.ui/src/org/eclipse/egit/gitflow/ui/internal/dialogs/BranchComparator.java -> This always sorts by ref name, regardless of the column that is clicked and shown as sorted in the UI. This is confusing. Should sort based on the current column.

Line:45, org.eclipse.egit.gitflow.ui/src/org/eclipse/egit/gitflow/ui/internal/dialogs/BranchComparator.java -> New findbugs warning: https://hudson.eclipse.org/egit/job/egit.gerrit/8721/findbugsResult/new/

Please refactor to resolve the warning.

Line:129, org.eclipse.egit.gitflow.ui/src/org/eclipse/egit/gitflow/ui/internal/dialogs/FilteredBranchesWidget.java -> If commit summaries are short, this gives a table with lots of unused white space to the right. msgColumn should use up whatever horizontal space is available; that would give a nicer UI.

-------------------------------------
author: Alayna Houston
date: 2016-06-15 05:16:42.000000000

Patch Set 1:

(1 comment)

Line:13, /COMMIT_MSG -> Only if a date column was shown in the UI, and the sorter sorted by selected column.

-------------------------------------
author: Jamarion Hunt
date: 2016-06-16 22:05:12.000000000

Patch Set 1:

(8 comments)

Line:1, org.eclipse.egit.gitflow.ui/src/org/eclipse/egit/gitflow/ui/internal/dialogs/BranchComparator.java -> Done

Line:9, org.eclipse.egit.gitflow.ui/src/org/eclipse/egit/gitflow/ui/internal/dialogs/BranchComparator.java -> Done

Line:12, org.eclipse.egit.gitflow.ui/src/org/eclipse/egit/gitflow/ui/internal/dialogs/BranchComparator.java -> Personally, it always takes my mind a few seconds to translate down into descending and up into ascending. And the difference is important, for example for defining the default. So I would argue that using these constants makes the code more readable.
But if you think it's better to get rid of the constant, I'm not insisting on it.

Line:16, org.eclipse.egit.gitflow.ui/src/org/eclipse/egit/gitflow/ui/internal/dialogs/BranchComparator.java -> Done

Line:42, org.eclipse.egit.gitflow.ui/src/org/eclipse/egit/gitflow/ui/internal/dialogs/BranchComparator.java -> Good point. Looks like I forgot to finish this up.

Done

Line:45, org.eclipse.egit.gitflow.ui/src/org/eclipse/egit/gitflow/ui/internal/dialogs/BranchComparator.java -> Done

Line:129, org.eclipse.egit.gitflow.ui/src/org/eclipse/egit/gitflow/ui/internal/dialogs/FilteredBranchesWidget.java -> I could have a look at this in a separate change, though simply removing the line will remove the column (width=0).

Line:13, /COMMIT_MSG -> That's right. I intend to add such a column and sort it by default. Would you feel better about merging this, if I push that change first?

-------------------------------------
author: Alayna Houston
date: 2016-06-18 11:14:02.000000000

Patch Set 1:

(2 comments)

Line:12, org.eclipse.egit.gitflow.ui/src/org/eclipse/egit/gitflow/ui/internal/dialogs/BranchComparator.java -> I'm not opposed to having a DESCENDING or ASCENDING constant at all. I just find it strange to use 1/-1 and then map later to SWT.UP/DOWN.

I would have declared ASCENDING = SWT.DOWN and DESCENDING = SWT.UP.

Note that you have it wrong anyway: DESCENDING sorts in ascending order.

Alternatively, since descending can have only two states, a boolean would be a more appropriate approach.

Line:129, org.eclipse.egit.gitflow.ui/src/org/eclipse/egit/gitflow/ui/internal/dialogs/FilteredBranchesWidget.java -> For sure in a separate change. Not sure it can be done properly. Perhaps by using branchesViewer.getTree().getParent().setLayout() to set a TreeColumnLayout (needs to be set on the composite containing the tree) and then giving the columns appropriate layouts.

-------------------------------------
author: Jamarion Hunt
date: 2016-06-18 14:33:00.000000000

Patch Set 1:

(2 comments)

Line:12, org.eclipse.egit.gitflow.ui/src/org/eclipse/egit/gitflow/ui/internal/dialogs/BranchComparator.java -> I see! I guess I thought it makes it easy to flip direction, but I'm ok with changing it.

Done

Line:129, org.eclipse.egit.gitflow.ui/src/org/eclipse/egit/gitflow/ui/internal/dialogs/FilteredBranchesWidget.java -> https://git.eclipse.org/r/75523

-------------------------------------
author: Gerrit Johnathan Pham
date: 2016-06-20 11:06:15.000000000

Change has been successfully merged into the git repository by Jamarion Hunt

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