Remove gerrit.enableNewFeatures

This was a hack inserted to support gerrit-review and friends
when some UI features were not yet ready for mainstream use.
Today all servers leave enableNewFeatures set to true, which
means the branch conditions can simply be removed.

Change-Id: Id75db4b340fed01a938bf09128f204c1d6799806
This commit is contained in:
Shawn Pearce 2015-01-06 14:51:24 -08:00
parent 28261856c6
commit 9ed3450f6a
6 changed files with 34 additions and 58 deletions

View File

@ -56,7 +56,6 @@ public class GerritConfig implements Cloneable {
protected AccountGeneralPreferences.ChangeScreen changeScreen;
protected List<String> archiveFormats;
protected int largeChangeSize;
protected boolean newFeatures;
protected String replyLabel;
protected String replyTitle;
@ -303,14 +302,6 @@ public class GerritConfig implements Cloneable {
archiveFormats = formats;
}
public boolean getNewFeatures() {
return newFeatures;
}
public void setNewFeatures(boolean n) {
newFeatures = n;
}
public String getReplyTitle() {
return replyTitle;
}

View File

@ -628,9 +628,7 @@ public class Dispatcher {
}
public static boolean isChangeScreen2() {
if (!Gerrit.getConfig().getNewFeatures()) {
return false;
} else if (changeScreen2) {
if (changeScreen2) {
return true;
}
@ -707,7 +705,7 @@ public class Dispatcher {
sbs1(token, baseId, id, patchIndex, patchSetDetail, patchTable, topView,
PatchScreen.Type.UNIFIED);
return;
} else if ("cm".equals(panel) && Gerrit.getConfig().getNewFeatures()) {
} else if ("cm".equals(panel)) {
if (Gerrit.isSignedIn()
&& DiffView.UNIFIED_DIFF.equals(Gerrit.getUserAccount()
.getGeneralPreferences().getDiffView())) {

View File

@ -196,32 +196,29 @@ public class MyPreferencesScreen extends SettingsScreen {
formGrid.setWidget(row, fieldIdx, dateTimePanel);
row++;
if (Gerrit.getConfig().getNewFeatures()) {
formGrid.setText(row, labelIdx, "");
formGrid.setWidget(row, fieldIdx, relativeDateInChangeTable);
row++;
formGrid.setText(row, labelIdx, "");
formGrid.setWidget(row, fieldIdx, relativeDateInChangeTable);
row++;
formGrid.setText(row, labelIdx, "");
formGrid.setWidget(row, fieldIdx, sizeBarInChangeTable);
row++;
formGrid.setText(row, labelIdx, "");
formGrid.setWidget(row, fieldIdx, sizeBarInChangeTable);
row++;
formGrid.setText(row, labelIdx, "");
formGrid.setWidget(row, fieldIdx, legacycidInChangeTable);
row++;
}
formGrid.setText(row, labelIdx, "");
formGrid.setWidget(row, fieldIdx, legacycidInChangeTable);
row++;
formGrid.setText(row, labelIdx, Util.C.commentVisibilityLabel());
formGrid.setWidget(row, fieldIdx, commentVisibilityStrategy);
row++;
if (Gerrit.getConfig().getNewFeatures()) {
formGrid.setText(row, labelIdx, Util.C.changeScreenLabel());
formGrid.setWidget(row, fieldIdx, changeScreen);
row++;
formGrid.setText(row, labelIdx, Util.C.changeScreenLabel());
formGrid.setWidget(row, fieldIdx, changeScreen);
row++;
formGrid.setText(row, labelIdx, Util.C.diffViewLabel());
formGrid.setWidget(row, fieldIdx, diffView);
formGrid.setText(row, labelIdx, Util.C.diffViewLabel());
formGrid.setWidget(row, fieldIdx, diffView);
}
add(formGrid);
save = new Button(Util.C.buttonSaveChanges());

View File

@ -122,8 +122,7 @@ public class ChangeInfoBlock extends Composite {
}
table.setText(R_SUBMIT_TYPE, 1, submitType);
final Change.Status status = chg.getStatus();
if (Gerrit.getConfig().getNewFeatures()
&& (status.equals(Change.Status.NEW) || status.equals(Change.Status.DRAFT))) {
if (status.equals(Change.Status.NEW) || status.equals(Change.Status.DRAFT)) {
table.getRowFormatter().setVisible(R_MERGE_TEST, true);
table.setText(R_MERGE_TEST, 1, changeDetail.isMergeable() ? Util.C
.changeInfoBlockCanMergeYes() : Util.C.changeInfoBlockCanMergeNo());

View File

@ -59,15 +59,13 @@ public class ChangeTable2 extends NavigationTable<ChangeInfo> {
private static final int C_SIZE = 9;
private static final int BASE_COLUMNS = 10;
private final boolean useNewFeatures = Gerrit.getConfig().getNewFeatures();
private final List<Section> sections;
private int columns;
private List<String> labelNames;
public ChangeTable2() {
super(Util.C.changeItemHelp());
columns = useNewFeatures ? BASE_COLUMNS : BASE_COLUMNS - 1;
columns = BASE_COLUMNS;
labelNames = Collections.emptyList();
if (Gerrit.isSignedIn()) {
@ -83,9 +81,7 @@ public class ChangeTable2 extends NavigationTable<ChangeInfo> {
table.setText(0, C_PROJECT, Util.C.changeTableColumnProject());
table.setText(0, C_BRANCH, Util.C.changeTableColumnBranch());
table.setText(0, C_LAST_UPDATE, Util.C.changeTableColumnLastUpdate());
if (useNewFeatures) {
table.setText(0, C_SIZE, Util.C.changeTableColumnSize());
}
table.setText(0, C_SIZE, Util.C.changeTableColumnSize());
final FlexCellFormatter fmt = table.getFlexCellFormatter();
fmt.addStyleName(0, C_STAR, Gerrit.RESOURCES.css().iconHeader());
@ -164,9 +160,7 @@ public class ChangeTable2 extends NavigationTable<ChangeInfo> {
}
int i = C_SIZE;
if (useNewFeatures) {
fmt.addStyleName(row, i++, Gerrit.RESOURCES.css().cSIZE());
}
fmt.addStyleName(row, i++, Gerrit.RESOURCES.css().cSIZE());
for (; i < columns; i++) {
fmt.addStyleName(row, i, Gerrit.RESOURCES.css().cAPPROVAL());
}
@ -185,7 +179,7 @@ public class ChangeTable2 extends NavigationTable<ChangeInfo> {
}
Collections.sort(labelNames);
int baseColumns = useNewFeatures ? BASE_COLUMNS : BASE_COLUMNS - 1;
int baseColumns = BASE_COLUMNS;
if (baseColumns + labelNames.size() < columns) {
int n = columns - (baseColumns + labelNames.size());
for (int row = 0; row < table.getRowCount(); row++) {
@ -228,7 +222,7 @@ public class ChangeTable2 extends NavigationTable<ChangeInfo> {
Change.Status status = c.status();
if (status != Change.Status.NEW) {
table.setText(row, C_STATUS, Util.toLongString(status));
} else if (!c.mergeable() && useNewFeatures) {
} else if (!c.mergeable()) {
table.setText(row, C_STATUS, Util.C.changeTableNotMergeable());
}
@ -248,20 +242,19 @@ public class ChangeTable2 extends NavigationTable<ChangeInfo> {
} else {
table.setText(row, C_LAST_UPDATE, shortFormat(c.updated()));
}
int col = C_SIZE;
if (useNewFeatures) {
if (Gerrit.isSignedIn()
&& !Gerrit.getUserAccount().getGeneralPreferences()
.isSizeBarInChangeTable()) {
table.setText(row, col,
Util.M.insertionsAndDeletions(c.insertions(), c.deletions()));
} else {
table.setWidget(row, col, getSizeWidget(c));
fmt.getElement(row, col).setTitle(
Util.M.insertionsAndDeletions(c.insertions(), c.deletions()));
}
col++;
if (Gerrit.isSignedIn()
&& !Gerrit.getUserAccount().getGeneralPreferences()
.isSizeBarInChangeTable()) {
table.setText(row, col,
Util.M.insertionsAndDeletions(c.insertions(), c.deletions()));
} else {
table.setWidget(row, col, getSizeWidget(c));
fmt.getElement(row, col).setTitle(
Util.M.insertionsAndDeletions(c.insertions(), c.deletions()));
}
col++;
boolean displayInfo = Gerrit.isSignedIn() && Gerrit.getUserAccount()
.getGeneralPreferences().isShowInfoInReviewCategory();

View File

@ -146,8 +146,6 @@ class GerritConfigProvider implements Provider<GerritConfig> {
}
})));
config.setNewFeatures(cfg.getBoolean("gerrit", "enableNewFeatures", true));
config.setReportBugUrl(cfg.getString("gerrit", null, "reportBugUrl"));
config.setReportBugText(cfg.getString("gerrit", null, "reportBugText"));