Highlight merge commit on change screen

For a reviewer it is important to notice that he is reviewing a merge
commit. Normally this should be obvious by the commit message, but
there may be merge commits with bad commit messages. Highlight merge
commits by displaying an icon for them.

The icon is taken from the Tango Icon Library [1].

[1] http://tango.freedesktop.org/Tango_Icon_Library

Change-Id: I510909a3b146f448492ee11da3c8b80160dec715
This commit is contained in:
Edwin Kempin
2014-05-13 16:08:59 +02:00
committed by David Pursehouse
parent a83c222362
commit 69263d3520
6 changed files with 26 additions and 2 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 16 KiB

After

Width:  |  Height:  |  Size: 16 KiB

View File

@@ -107,7 +107,8 @@ is also a link to the commit in the Git web browser.
image::images/user-review-ui-change-screen-commit-info.png[width=800, link="images/user-review-ui-change-screen-commit-info.png"]
For merge commits the parent commits are also shown.
If a merge commit is viewed this is highlighted by an icon. In this
case the parent commits are also shown.
image::images/user-review-ui-change-screen-commit-info-merge-commit.png[width=800, link="images/user-review-ui-change-screen-commit-info-merge-commit.png"]

View File

@@ -69,4 +69,7 @@ public interface GerritResources extends ClientBundle {
@Source("warning.png")
public ImageResource warning();
@Source("important.png")
public ImageResource important();
}

View File

@@ -41,6 +41,7 @@ import com.google.gwt.user.client.ui.Composite;
import com.google.gwt.user.client.ui.FlowPanel;
import com.google.gwt.user.client.ui.HTML;
import com.google.gwt.user.client.ui.HTMLPanel;
import com.google.gwt.user.client.ui.Image;
import com.google.gwt.user.client.ui.ScrollPanel;
import com.google.gwt.user.client.ui.UIObject;
import com.google.gwt.user.client.ui.VerticalPanel;
@@ -59,6 +60,7 @@ class CommitBox extends Composite {
}
@UiField Style style;
@UiField Image mergeCommit;
@UiField CopyableLabel commitName;
@UiField AnchorElement browserLink;
@UiField Element parents;
@@ -120,6 +122,7 @@ class CommitBox extends Composite {
}
if (revInfo.commit().parents().length() > 1) {
mergeCommit.setVisible(true);
setParents(change.project(), revInfo.commit().parents());
}
}

View File

@@ -19,6 +19,7 @@ limitations under the License.
xmlns:g='urn:import:com.google.gwt.user.client.ui'
xmlns:x='urn:import:com.google.gerrit.client.ui'
xmlns:clippy='urn:import:com.google.gwtexpui.clippy.client'>
<ui:with field='ico' type='com.google.gerrit.client.GerritResources'/>
<ui:image field="toggle" src="more_less.png"/>
<ui:style type='com.google.gerrit.client.change.CommitBox.Style'>
@eval trimColor com.google.gerrit.client.Gerrit.getTheme().trimColor;
@@ -83,6 +84,11 @@ limitations under the License.
.parentWebLink {
margin-left:16px;
}
.mergeCommit {
margin-right: 3px;
float: left;
}
</ui:style>
<g:HTMLPanel>
<g:ScrollPanel styleName='{style.scroll}' ui:field='scroll'>
@@ -116,7 +122,18 @@ limitations under the License.
<td ui:field='committerDate' class='{style.date}' colspan="2"/>
</tr>
<tr>
<th><ui:msg>Commit</ui:msg></th>
<th>
<div class='{style.mergeCommit}'>
<ui:msg>Commit</ui:msg>
</div>
<g:Image
ui:field='mergeCommit'
resource='{ico.important}'
visible='false'
title='Merge Commit'>
<ui:attribute name='title'/>
</g:Image>
</th>
<td><clippy:CopyableLabel styleName='{style.clippy}' ui:field='commitName'/></td>
<td><a style="margin-left:16px;" ui:field='browserLink' href=""/></td>
</tr>

Binary file not shown.

After

Width:  |  Height:  |  Size: 717 B