Merge changes I340efe7f,I7fdccee7

* changes:
  ChangeScreen2: add Gerrit config and user preference
  Create buck.properties during tools/eclipse/project.py
This commit is contained in:
Shawn Pearce 2013-09-24 19:36:11 +00:00 committed by Gerrit Code Review
commit 2dd0fc86a5
32 changed files with 164 additions and 59 deletions

View File

@ -1334,6 +1334,7 @@ form:
---- ----
fetch-cmd some://url/to/commit-msg .git/hooks/commit-msg ; chmod +x .git/hooks/commit-msg fetch-cmd some://url/to/commit-msg .git/hooks/commit-msg ; chmod +x .git/hooks/commit-msg
---- ----
+ +
By default unset; falls back to using scp from the canonical SSH host, By default unset; falls back to using scp from the canonical SSH host,
or curl from the canonical HTTP URL for the server. Only necessary if a or curl from the canonical HTTP URL for the server. Only necessary if a
@ -1357,6 +1358,11 @@ Gerrit service. By default this links to the upstream Gerrit
Code Review's own bug tracker but could be directed to the system Code Review's own bug tracker but could be directed to the system
administrator's ticket queue. administrator's ticket queue.
[[gerrit.changeScreen]]gerrit.changeScreen::
+
Default change screen UI to direct users to. Valid values are
`OLD_UI` and `CHANGE_SCREEN2`. Default is `OLD_UI`.
[[gitweb]]Section gitweb [[gitweb]]Section gitweb
~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~

View File

@ -54,12 +54,8 @@ public class PageLinks {
return "/c/" + c + "/"; return "/c/" + c + "/";
} }
public static String toChange2(final Change.Id c) { public static String toChange(Change.Id c, String p) {
return "/c2/" + c + "/"; return "/c/" + c + "/" + p;
}
public static String toChange2(Change.Id c, String p) {
return "/c2/" + c + "/" + p;
} }
public static String toChange(final PatchSet.Id ps) { public static String toChange(final PatchSet.Id ps) {

View File

@ -16,6 +16,7 @@ package com.google.gerrit.common.data;
import com.google.gerrit.reviewdb.client.Account; import com.google.gerrit.reviewdb.client.Account;
import com.google.gerrit.reviewdb.client.Account.FieldName; import com.google.gerrit.reviewdb.client.Account.FieldName;
import com.google.gerrit.reviewdb.client.AccountGeneralPreferences;
import com.google.gerrit.reviewdb.client.AccountGeneralPreferences.DownloadCommand; import com.google.gerrit.reviewdb.client.AccountGeneralPreferences.DownloadCommand;
import com.google.gerrit.reviewdb.client.AccountGeneralPreferences.DownloadScheme; import com.google.gerrit.reviewdb.client.AccountGeneralPreferences.DownloadScheme;
import com.google.gerrit.reviewdb.client.AuthType; import com.google.gerrit.reviewdb.client.AuthType;
@ -51,6 +52,7 @@ public class GerritConfig implements Cloneable {
protected String anonymousCowardName; protected String anonymousCowardName;
protected int suggestFrom; protected int suggestFrom;
protected int changeUpdateDelay; protected int changeUpdateDelay;
protected AccountGeneralPreferences.ChangeScreen changeScreen;
public String getLoginUrl() { public String getLoginUrl() {
return loginUrl; return loginUrl;
@ -270,4 +272,12 @@ public class GerritConfig implements Cloneable {
public void setChangeUpdateDelay(int seconds) { public void setChangeUpdateDelay(int seconds) {
changeUpdateDelay = seconds; changeUpdateDelay = seconds;
} }
public AccountGeneralPreferences.ChangeScreen getChangeScreen() {
return changeScreen;
}
public void setChangeScreen(AccountGeneralPreferences.ChangeScreen ui) {
this.changeScreen = ui;
}
} }

View File

@ -81,6 +81,7 @@ import com.google.gerrit.common.PageLinks;
import com.google.gerrit.common.data.PatchSetDetail; import com.google.gerrit.common.data.PatchSetDetail;
import com.google.gerrit.reviewdb.client.Account; import com.google.gerrit.reviewdb.client.Account;
import com.google.gerrit.reviewdb.client.AccountGeneralPreferences.DiffView; import com.google.gerrit.reviewdb.client.AccountGeneralPreferences.DiffView;
import com.google.gerrit.reviewdb.client.AccountGeneralPreferences;
import com.google.gerrit.reviewdb.client.AccountGroup; import com.google.gerrit.reviewdb.client.AccountGroup;
import com.google.gerrit.reviewdb.client.Change; import com.google.gerrit.reviewdb.client.Change;
import com.google.gerrit.reviewdb.client.Patch; import com.google.gerrit.reviewdb.client.Patch;
@ -93,8 +94,6 @@ import com.google.gwt.user.client.Window;
import com.google.gwtorm.client.KeyUtil; import com.google.gwtorm.client.KeyUtil;
public class Dispatcher { public class Dispatcher {
private static boolean useChangeScreen2;
public static String toPatchSideBySide(final Patch.Key id) { public static String toPatchSideBySide(final Patch.Key id) {
return toPatch("", null, id); return toPatch("", null, id);
} }
@ -203,9 +202,6 @@ public class Dispatcher {
} else if (matchPrefix("/c/", token)) { } else if (matchPrefix("/c/", token)) {
change(token); change(token);
} else if (matchPrefix("/c2/", token)) {
change2(token);
} else if (matchExact(MINE, token)) { } else if (matchExact(MINE, token)) {
Gerrit.display(token, mine(token)); Gerrit.display(token, mine(token));
@ -480,7 +476,7 @@ public class Dispatcher {
if (rest.isEmpty()) { if (rest.isEmpty()) {
Gerrit.display(token, panel== null Gerrit.display(token, panel== null
? (useChangeScreen2 ? (isChangeScreen2()
? new ChangeScreen2(id, null, false) ? new ChangeScreen2(id, null, false)
: new ChangeScreen(id)) : new ChangeScreen(id))
: new NotFoundScreen()); : new NotFoundScreen());
@ -513,7 +509,7 @@ public class Dispatcher {
patch(token, base, p, 0, null, null, panel); patch(token, base, p, 0, null, null, panel);
} else { } else {
if (panel == null) { if (panel == null) {
Gerrit.display(token, useChangeScreen2 Gerrit.display(token, isChangeScreen2()
? new ChangeScreen2(id, String.valueOf(ps.get()), false) ? new ChangeScreen2(id, String.valueOf(ps.get()), false)
: new ChangeScreen(id)); : new ChangeScreen(id));
} else if ("publish".equals(panel)) { } else if ("publish".equals(panel)) {
@ -524,19 +520,17 @@ public class Dispatcher {
} }
} }
private static void change2(final String token) { private static boolean isChangeScreen2() {
String rest = skip(token); AccountGeneralPreferences.ChangeScreen ui = null;
Change.Id id; if (Gerrit.isSignedIn()) {
int s = rest.indexOf('/'); ui = Gerrit.getUserAccount()
if (0 <= s) { .getGeneralPreferences()
id = Change.Id.parse(rest.substring(0, s)); .getChangeScreen();
rest = rest.substring(s + 1);
} else {
id = Change.Id.parse(rest);
rest = "";
} }
useChangeScreen2 = true; if (ui == null) {
Gerrit.display(token, new ChangeScreen2(id, rest, false)); ui = Gerrit.getConfig().getChangeScreen();
}
return ui == AccountGeneralPreferences.ChangeScreen.CHANGE_SCREEN2;
} }
private static void publish(final PatchSet.Id ps) { private static void publish(final PatchSet.Id ps) {

View File

@ -26,6 +26,7 @@ public interface AccountConstants extends Constants {
String accountId(); String accountId();
String commentVisibilityLabel(); String commentVisibilityLabel();
String changeScreenLabel();
String diffViewLabel(); String diffViewLabel();
String maximumPageSizeFieldLabel(); String maximumPageSizeFieldLabel();
String dateFormatLabel(); String dateFormatLabel();
@ -38,6 +39,9 @@ public interface AccountConstants extends Constants {
String buttonSaveChanges(); String buttonSaveChanges();
String showRelativeDateInChangeTable(); String showRelativeDateInChangeTable();
String changeScreenOldUi();
String changeScreenNewUi();
String tabAccountSummary(); String tabAccountSummary();
String tabPreferences(); String tabPreferences();
String tabWatchedProjects(); String tabWatchedProjects();

View File

@ -12,12 +12,16 @@ reversePatchSetOrder = Display Patch Sets In Reverse Order
showUsernameInReviewCategory = Display Person Name In Review Category showUsernameInReviewCategory = Display Person Name In Review Category
maximumPageSizeFieldLabel = Maximum Page Size: maximumPageSizeFieldLabel = Maximum Page Size:
commentVisibilityLabel = Comment Visibility: commentVisibilityLabel = Comment Visibility:
diffViewLabel = Diff View (ChangeScreen2 only): changeScreenLabel = Change View:
diffViewLabel = Diff View (Change Screen 2):
dateFormatLabel = Date/Time Format: dateFormatLabel = Date/Time Format:
contextWholeFile = Whole File contextWholeFile = Whole File
buttonSaveChanges = Save Changes buttonSaveChanges = Save Changes
showRelativeDateInChangeTable = Show Relative Dates in Changes Table showRelativeDateInChangeTable = Show Relative Dates in Changes Table
changeScreenOldUi = Old Screen
changeScreenNewUi = Change Screen 2
tabAccountSummary = Profile tabAccountSummary = Profile
tabPreferences = Preferences tabPreferences = Preferences
tabWatchedProjects = Watched Projects tabWatchedProjects = Watched Projects

View File

@ -21,6 +21,7 @@ import java.util.Date;
public interface AccountMessages extends Messages { public interface AccountMessages extends Messages {
String lines(short cnt); String lines(short cnt);
String rowsPerPage(short cnt); String rowsPerPage(short cnt);
String changeScreenServerDefault(String d);
String enterIAGREE(String iagree); String enterIAGREE(String iagree);
String contactOnFile(Date lastDate); String contactOnFile(Date lastDate);
} }

View File

@ -1,5 +1,7 @@
lines = {0} lines lines = {0} lines
rowsPerPage = {0} rows per page rowsPerPage = {0} rows per page
changeScreenServerDefault = Server Default ({0})
enterIAGREE = (enter {0} in the box to the left) enterIAGREE = (enter {0} in the box to the left)
contactOnFile = Contact information last updated on {0,date,medium} at {0,time,short}. contactOnFile = Contact information last updated on {0,date,medium} at {0,time,short}.

View File

@ -48,6 +48,7 @@ public class MyPreferencesScreen extends SettingsScreen {
private ListBox dateFormat; private ListBox dateFormat;
private ListBox timeFormat; private ListBox timeFormat;
private ListBox commentVisibilityStrategy; private ListBox commentVisibilityStrategy;
private ListBox changeScreen;
private ListBox diffView; private ListBox diffView;
private Button save; private Button save;
@ -68,30 +69,36 @@ public class MyPreferencesScreen extends SettingsScreen {
commentVisibilityStrategy = new ListBox(); commentVisibilityStrategy = new ListBox();
commentVisibilityStrategy.addItem( commentVisibilityStrategy.addItem(
com.google.gerrit.client.changes.Util.C.messageCollapseAll(), com.google.gerrit.client.changes.Util.C.messageCollapseAll(),
AccountGeneralPreferences.CommentVisibilityStrategy.COLLAPSE_ALL.name() AccountGeneralPreferences.CommentVisibilityStrategy.COLLAPSE_ALL.name());
);
commentVisibilityStrategy.addItem( commentVisibilityStrategy.addItem(
com.google.gerrit.client.changes.Util.C.messageExpandMostRecent(), com.google.gerrit.client.changes.Util.C.messageExpandMostRecent(),
AccountGeneralPreferences.CommentVisibilityStrategy.EXPAND_MOST_RECENT.name() AccountGeneralPreferences.CommentVisibilityStrategy.EXPAND_MOST_RECENT.name());
);
commentVisibilityStrategy.addItem( commentVisibilityStrategy.addItem(
com.google.gerrit.client.changes.Util.C.messageExpandRecent(), com.google.gerrit.client.changes.Util.C.messageExpandRecent(),
AccountGeneralPreferences.CommentVisibilityStrategy.EXPAND_RECENT.name() AccountGeneralPreferences.CommentVisibilityStrategy.EXPAND_RECENT.name());
);
commentVisibilityStrategy.addItem( commentVisibilityStrategy.addItem(
com.google.gerrit.client.changes.Util.C.messageExpandAll(), com.google.gerrit.client.changes.Util.C.messageExpandAll(),
AccountGeneralPreferences.CommentVisibilityStrategy.EXPAND_ALL.name() AccountGeneralPreferences.CommentVisibilityStrategy.EXPAND_ALL.name());
);
changeScreen = new ListBox();
changeScreen.addItem(
Util.M.changeScreenServerDefault(
getLabel(Gerrit.getConfig().getChangeScreen())),
"");
changeScreen.addItem(
Util.C.changeScreenOldUi(),
AccountGeneralPreferences.ChangeScreen.OLD_UI.name());
changeScreen.addItem(
Util.C.changeScreenNewUi(),
AccountGeneralPreferences.ChangeScreen.CHANGE_SCREEN2.name());
diffView = new ListBox(); diffView = new ListBox();
diffView.addItem( diffView.addItem(
com.google.gerrit.client.changes.Util.C.sideBySide(), com.google.gerrit.client.changes.Util.C.sideBySide(),
AccountGeneralPreferences.DiffView.SIDE_BY_SIDE.name() AccountGeneralPreferences.DiffView.SIDE_BY_SIDE.name());
);
diffView.addItem( diffView.addItem(
com.google.gerrit.client.changes.Util.C.unifiedDiff(), com.google.gerrit.client.changes.Util.C.unifiedDiff(),
AccountGeneralPreferences.DiffView.UNIFIED_DIFF.name() AccountGeneralPreferences.DiffView.UNIFIED_DIFF.name());
);
Date now = new Date(); Date now = new Date();
dateFormat = new ListBox(); dateFormat = new ListBox();
@ -129,7 +136,7 @@ public class MyPreferencesScreen extends SettingsScreen {
relativeDateInChangeTable = new CheckBox(Util.C.showRelativeDateInChangeTable()); relativeDateInChangeTable = new CheckBox(Util.C.showRelativeDateInChangeTable());
final Grid formGrid = new Grid(10, 2); final Grid formGrid = new Grid(11, 2);
int row = 0; int row = 0;
formGrid.setText(row, labelIdx, ""); formGrid.setText(row, labelIdx, "");
@ -168,6 +175,10 @@ public class MyPreferencesScreen extends SettingsScreen {
formGrid.setWidget(row, fieldIdx, commentVisibilityStrategy); formGrid.setWidget(row, fieldIdx, commentVisibilityStrategy);
row++; row++;
formGrid.setText(row, labelIdx, Util.C.changeScreenLabel());
formGrid.setWidget(row, fieldIdx, changeScreen);
row++;
formGrid.setText(row, labelIdx, Util.C.diffViewLabel()); formGrid.setText(row, labelIdx, Util.C.diffViewLabel());
formGrid.setWidget(row, fieldIdx, diffView); formGrid.setWidget(row, fieldIdx, diffView);
row++; row++;
@ -195,6 +206,7 @@ public class MyPreferencesScreen extends SettingsScreen {
e.listenTo(timeFormat); e.listenTo(timeFormat);
e.listenTo(relativeDateInChangeTable); e.listenTo(relativeDateInChangeTable);
e.listenTo(commentVisibilityStrategy); e.listenTo(commentVisibilityStrategy);
e.listenTo(changeScreen);
e.listenTo(diffView); e.listenTo(diffView);
} }
@ -219,6 +231,7 @@ public class MyPreferencesScreen extends SettingsScreen {
timeFormat.setEnabled(on); timeFormat.setEnabled(on);
relativeDateInChangeTable.setEnabled(on); relativeDateInChangeTable.setEnabled(on);
commentVisibilityStrategy.setEnabled(on); commentVisibilityStrategy.setEnabled(on);
changeScreen.setEnabled(on);
diffView.setEnabled(on); diffView.setEnabled(on);
} }
@ -237,6 +250,9 @@ public class MyPreferencesScreen extends SettingsScreen {
setListBox(commentVisibilityStrategy, setListBox(commentVisibilityStrategy,
AccountGeneralPreferences.CommentVisibilityStrategy.EXPAND_RECENT, AccountGeneralPreferences.CommentVisibilityStrategy.EXPAND_RECENT,
p.getCommentVisibilityStrategy()); p.getCommentVisibilityStrategy());
setListBox(changeScreen,
null,
p.getChangeScreen());
setListBox(diffView, setListBox(diffView,
AccountGeneralPreferences.DiffView.SIDE_BY_SIDE, AccountGeneralPreferences.DiffView.SIDE_BY_SIDE,
p.getDiffView()); p.getDiffView());
@ -249,7 +265,8 @@ public class MyPreferencesScreen extends SettingsScreen {
private <T extends Enum<?>> void setListBox(final ListBox f, private <T extends Enum<?>> void setListBox(final ListBox f,
final T defaultValue, final T currentValue) { final T defaultValue, final T currentValue) {
setListBox(f, defaultValue.name(), // setListBox(f,
defaultValue != null ? defaultValue.name() : "",
currentValue != null ? currentValue.name() : ""); currentValue != null ? currentValue.name() : "");
} }
@ -280,6 +297,9 @@ public class MyPreferencesScreen extends SettingsScreen {
final int idx = f.getSelectedIndex(); final int idx = f.getSelectedIndex();
if (0 <= idx) { if (0 <= idx) {
String v = f.getValue(idx); String v = f.getValue(idx);
if ("".equals(v)) {
return defaultValue;
}
for (T t : all) { for (T t : all) {
if (t.name().equals(v)) { if (t.name().equals(v)) {
return t; return t;
@ -310,6 +330,9 @@ public class MyPreferencesScreen extends SettingsScreen {
p.setDiffView(getListBox(diffView, p.setDiffView(getListBox(diffView,
AccountGeneralPreferences.DiffView.SIDE_BY_SIDE, AccountGeneralPreferences.DiffView.SIDE_BY_SIDE,
AccountGeneralPreferences.DiffView.values())); AccountGeneralPreferences.DiffView.values()));
p.setChangeScreen(getListBox(changeScreen,
null,
AccountGeneralPreferences.ChangeScreen.values()));
enable(false); enable(false);
save.setEnabled(false); save.setEnabled(false);
@ -330,4 +353,18 @@ public class MyPreferencesScreen extends SettingsScreen {
} }
}); });
} }
private static String getLabel(AccountGeneralPreferences.ChangeScreen ui) {
if (ui == null) {
return "";
}
switch (ui) {
case OLD_UI:
return Util.C.changeScreenOldUi();
case CHANGE_SCREEN2:
return Util.C.changeScreenNewUi();
default:
return ui.name();
}
}
} }

View File

@ -38,7 +38,7 @@ class DefaultActions {
Window.alert(str.asString()); Window.alert(str.asString());
} }
} }
Gerrit.display(PageLinks.toChange2(id)); Gerrit.display(PageLinks.toChange(id));
} }
}; };
if ("PUT".equalsIgnoreCase(action.method())) { if ("PUT".equalsIgnoreCase(action.method())) {

View File

@ -34,7 +34,7 @@ class AbandonAction extends ActionMessageBox {
ChangeApi.abandon(id.get(), message, new GerritCallback<ChangeInfo>() { ChangeApi.abandon(id.get(), message, new GerritCallback<ChangeInfo>() {
@Override @Override
public void onSuccess(ChangeInfo result) { public void onSuccess(ChangeInfo result) {
Gerrit.display(PageLinks.toChange2(id)); Gerrit.display(PageLinks.toChange(id));
hide(); hide();
} }
}); });

View File

@ -51,7 +51,7 @@ class CherryPickAction {
public void onSuccess(ChangeInfo result) { public void onSuccess(ChangeInfo result) {
sent = true; sent = true;
hide(); hide();
Gerrit.display(PageLinks.toChange2(result.legacy_id())); Gerrit.display(PageLinks.toChange(result.legacy_id()));
} }
@Override @Override

View File

@ -80,7 +80,7 @@ class EditMessageBox extends Composite {
new GerritCallback<JavaScriptObject>() { new GerritCallback<JavaScriptObject>() {
@Override @Override
public void onSuccess(JavaScriptObject msg) { public void onSuccess(JavaScriptObject msg) {
Gerrit.display(PageLinks.toChange2(changeId)); Gerrit.display(PageLinks.toChange(changeId));
hide(); hide();
}; };
}); });

View File

@ -112,7 +112,7 @@ class QuickApprove extends Button implements ClickHandler {
.post(input, new GerritCallback<ReviewInput>() { .post(input, new GerritCallback<ReviewInput>() {
@Override @Override
public void onSuccess(ReviewInput result) { public void onSuccess(ReviewInput result) {
Gerrit.display(PageLinks.toChange2(changeId)); Gerrit.display(PageLinks.toChange(changeId));
} }
}); });
} }

View File

@ -26,7 +26,7 @@ class RebaseAction {
ChangeApi.rebase(id.get(), revision, ChangeApi.rebase(id.get(), revision,
new GerritCallback<ChangeInfo>() { new GerritCallback<ChangeInfo>() {
public void onSuccess(ChangeInfo result) { public void onSuccess(ChangeInfo result) {
Gerrit.display(PageLinks.toChange2(id)); Gerrit.display(PageLinks.toChange(id));
} }
}); });
} }

View File

@ -174,7 +174,7 @@ class RelatedChanges extends Composite {
private String url(ChangeAndCommit c) { private String url(ChangeAndCommit c) {
if (c.has_change_number() && c.has_revision_number()) { if (c.has_change_number() && c.has_revision_number()) {
PatchSet.Id id = c.patch_set_id(); PatchSet.Id id = c.patch_set_id();
return "#" + PageLinks.toChange2( return "#" + PageLinks.toChange(
id.getParentKey(), id.getParentKey(),
String.valueOf(id.get())); String.valueOf(id.get()));
} }

View File

@ -47,7 +47,7 @@ class Reload extends Image implements ClickHandler,
} }
void reload() { void reload() {
Gerrit.display(PageLinks.toChange2(changeId)); Gerrit.display(PageLinks.toChange(changeId));
} }
@Override @Override

View File

@ -144,7 +144,7 @@ class ReplyBox extends Composite {
.post(in, new GerritCallback<ReviewInput>() { .post(in, new GerritCallback<ReviewInput>() {
@Override @Override
public void onSuccess(ReviewInput result) { public void onSuccess(ReviewInput result) {
Gerrit.display(PageLinks.toChange2( Gerrit.display(PageLinks.toChange(
psId.getParentKey(), psId.getParentKey(),
String.valueOf(psId.get()))); String.valueOf(psId.get())));
} }

View File

@ -34,7 +34,7 @@ class RestoreAction extends ActionMessageBox {
ChangeApi.restore(id.get(), message, new GerritCallback<ChangeInfo>() { ChangeApi.restore(id.get(), message, new GerritCallback<ChangeInfo>() {
@Override @Override
public void onSuccess(ChangeInfo result) { public void onSuccess(ChangeInfo result) {
Gerrit.display(PageLinks.toChange2(id)); Gerrit.display(PageLinks.toChange(id));
hide(); hide();
} }
}); });

View File

@ -46,7 +46,7 @@ class RevertAction {
public void onSuccess(ChangeInfo result) { public void onSuccess(ChangeInfo result) {
sent = true; sent = true;
hide(); hide();
Gerrit.display(PageLinks.toChange2(result.legacy_id())); Gerrit.display(PageLinks.toChange(result.legacy_id()));
} }
@Override @Override

View File

@ -203,7 +203,7 @@ class RevisionsBox extends Composite {
} }
private String url(RevisionInfo r) { private String url(RevisionInfo r) {
return PageLinks.toChange2( return PageLinks.toChange(
changeId, changeId,
String.valueOf(r._number())); String.valueOf(r._number()));
} }

View File

@ -40,7 +40,7 @@ class SubmitAction {
} }
private void redisplay() { private void redisplay() {
Gerrit.display(PageLinks.toChange2(id)); Gerrit.display(PageLinks.toChange(id));
} }
}); });
} }

View File

@ -134,7 +134,7 @@ class Topic extends Composite {
new GerritCallback<String>() { new GerritCallback<String>() {
@Override @Override
public void onSuccess(String result) { public void onSuccess(String result) {
Gerrit.display(PageLinks.toChange2( Gerrit.display(PageLinks.toChange(
psId.getParentKey(), psId.getParentKey(),
String.valueOf(psId.get()))); String.valueOf(psId.get())));
} }

View File

@ -73,7 +73,7 @@ class Header extends Composite {
this.path = path; this.path = path;
SafeHtml.setInnerHTML(filePath, formatPath(path)); SafeHtml.setInnerHTML(filePath, formatPath(path));
up.setTargetHistoryToken(PageLinks.toChange2( up.setTargetHistoryToken(PageLinks.toChange(
patchSetId.getParentKey(), patchSetId.getParentKey(),
String.valueOf(patchSetId.get()))); String.valueOf(patchSetId.get())));
} }

View File

@ -1096,7 +1096,7 @@ public class SideBySide2 extends Screen {
public void run() { public void run() {
String rev = String.valueOf(revision.get()); String rev = String.valueOf(revision.get());
Gerrit.display( Gerrit.display(
PageLinks.toChange2(changeId, rev), PageLinks.toChange(changeId, rev),
new ChangeScreen2(changeId, rev, openReplyBox)); new ChangeScreen2(changeId, rev, openReplyBox));
} }
}; };

View File

@ -31,7 +31,7 @@ class UpToChangeCommand2 extends KeyCommand {
@Override @Override
public void onKeyPress(final KeyPressEvent event) { public void onKeyPress(final KeyPressEvent event) {
Gerrit.display(PageLinks.toChange2( Gerrit.display(PageLinks.toChange(
revision.getParentKey(), revision.getParentKey(),
String.valueOf(revision.get()))); String.valueOf(revision.get())));
} }

View File

@ -17,6 +17,7 @@ package com.google.gerrit.httpd;
import com.google.gerrit.common.data.GerritConfig; import com.google.gerrit.common.data.GerritConfig;
import com.google.gerrit.common.data.GitwebConfig; import com.google.gerrit.common.data.GitwebConfig;
import com.google.gerrit.reviewdb.client.Account; import com.google.gerrit.reviewdb.client.Account;
import com.google.gerrit.reviewdb.client.AccountGeneralPreferences;
import com.google.gerrit.server.account.Realm; import com.google.gerrit.server.account.Realm;
import com.google.gerrit.server.config.AllProjectsName; import com.google.gerrit.server.config.AllProjectsName;
import com.google.gerrit.server.config.AnonymousCowardName; import com.google.gerrit.server.config.AnonymousCowardName;
@ -124,6 +125,9 @@ class GerritConfigProvider implements Provider<GerritConfig> {
config.setSuggestFrom(cfg.getInt("suggest", "from", 0)); config.setSuggestFrom(cfg.getInt("suggest", "from", 0));
config.setChangeUpdateDelay((int) ConfigUtil.getTimeUnit( config.setChangeUpdateDelay((int) ConfigUtil.getTimeUnit(
cfg, "change", null, "updateDelay", 30, TimeUnit.SECONDS)); cfg, "change", null, "updateDelay", 30, TimeUnit.SECONDS));
config.setChangeScreen(cfg.getEnum(
"gerrit", null, "changeScreen",
AccountGeneralPreferences.ChangeScreen.OLD_UI));
config.setReportBugUrl(cfg.getString("gerrit", null, "reportBugUrl")); config.setReportBugUrl(cfg.getString("gerrit", null, "reportBugUrl"));
if (config.getReportBugUrl() == null) { if (config.getReportBugUrl() == null) {

View File

@ -77,6 +77,11 @@ public final class AccountGeneralPreferences {
UNIFIED_DIFF UNIFIED_DIFF
} }
public static enum ChangeScreen {
OLD_UI,
CHANGE_SCREEN2
}
public static enum TimeFormat { public static enum TimeFormat {
/** 12-hour clock: 1:15 am, 2:13 pm */ /** 12-hour clock: 1:15 am, 2:13 pm */
HHMM_12("h:mm a"), HHMM_12("h:mm a"),
@ -144,6 +149,9 @@ public final class AccountGeneralPreferences {
@Column(id = 14, length = 20, notNull = false) @Column(id = 14, length = 20, notNull = false)
protected String diffView; protected String diffView;
@Column(id = 15, length = 20, notNull = false)
protected String changeScreen;
public AccountGeneralPreferences() { public AccountGeneralPreferences() {
} }
@ -278,6 +286,14 @@ public final class AccountGeneralPreferences {
this.diffView = diffView.name(); this.diffView = diffView.name();
} }
public ChangeScreen getChangeScreen() {
return changeScreen != null ? ChangeScreen.valueOf(changeScreen) : null;
}
public void setChangeScreen(ChangeScreen ui) {
changeScreen = ui != null ? ui.name() : null;
}
public void resetToDefaults() { public void resetToDefaults() {
maximumPageSize = DEFAULT_PAGESIZE; maximumPageSize = DEFAULT_PAGESIZE;
showSiteHeader = true; showSiteHeader = true;
@ -292,5 +308,6 @@ public final class AccountGeneralPreferences {
relativeDateInChangeTable = false; relativeDateInChangeTable = false;
commentVisibilityStrategy = null; commentVisibilityStrategy = null;
diffView = null; diffView = null;
changeScreen = null;
} }
} }

View File

@ -17,6 +17,7 @@ package com.google.gerrit.server.account;
import com.google.gerrit.extensions.restapi.AuthException; import com.google.gerrit.extensions.restapi.AuthException;
import com.google.gerrit.extensions.restapi.RestReadView; import com.google.gerrit.extensions.restapi.RestReadView;
import com.google.gerrit.reviewdb.client.AccountGeneralPreferences; import com.google.gerrit.reviewdb.client.AccountGeneralPreferences;
import com.google.gerrit.reviewdb.client.AccountGeneralPreferences.ChangeScreen;
import com.google.gerrit.reviewdb.client.AccountGeneralPreferences.CommentVisibilityStrategy; import com.google.gerrit.reviewdb.client.AccountGeneralPreferences.CommentVisibilityStrategy;
import com.google.gerrit.reviewdb.client.AccountGeneralPreferences.DateFormat; import com.google.gerrit.reviewdb.client.AccountGeneralPreferences.DateFormat;
import com.google.gerrit.reviewdb.client.AccountGeneralPreferences.DiffView; import com.google.gerrit.reviewdb.client.AccountGeneralPreferences.DiffView;
@ -61,6 +62,7 @@ public class GetPreferences implements RestReadView<AccountResource> {
Boolean relativeDateInChangeTable; Boolean relativeDateInChangeTable;
CommentVisibilityStrategy commentVisibilityStrategy; CommentVisibilityStrategy commentVisibilityStrategy;
DiffView diffView; DiffView diffView;
ChangeScreen changeScreen;
PreferenceInfo(AccountGeneralPreferences p) { PreferenceInfo(AccountGeneralPreferences p) {
changesPerPage = p.getMaximumPageSize(); changesPerPage = p.getMaximumPageSize();
@ -76,6 +78,7 @@ public class GetPreferences implements RestReadView<AccountResource> {
relativeDateInChangeTable = p.isRelativeDateInChangeTable() ? true : null; relativeDateInChangeTable = p.isRelativeDateInChangeTable() ? true : null;
commentVisibilityStrategy = p.getCommentVisibilityStrategy(); commentVisibilityStrategy = p.getCommentVisibilityStrategy();
diffView = p.getDiffView(); diffView = p.getDiffView();
changeScreen = p.getChangeScreen();
} }
} }
} }

View File

@ -32,7 +32,7 @@ import java.util.List;
/** A version of the database schema. */ /** A version of the database schema. */
public abstract class SchemaVersion { public abstract class SchemaVersion {
/** The current schema version. */ /** The current schema version. */
public static final Class<Schema_83> C = Schema_83.class; public static final Class<Schema_84> C = Schema_84.class;
public static class Module extends AbstractModule { public static class Module extends AbstractModule {
@Override @Override

View File

@ -0,0 +1,26 @@
// Copyright (C) 2013 The Android Open Source Project
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
package com.google.gerrit.server.schema;
import com.google.inject.Inject;
import com.google.inject.Provider;
public class Schema_84 extends SchemaVersion {
@Inject
Schema_84(Provider<Schema_83> prior) {
super(prior);
}
}

View File

@ -151,6 +151,7 @@ gen_project()
gen_classpath() gen_classpath()
try: try:
check_call(['buck', 'build'] + MAIN + GWT) targets = ['//tools:buck.properties'] + MAIN + GWT
check_call(['buck', 'build'] + targets)
except CalledProcessError as err: except CalledProcessError as err:
exit(1) exit(1)