Merge branch 'stable-2.15'

* stable-2.15:
  BranchApi: Add missing throws declaration on NotImplemented#reflog
  FormatUtil: Fix Math#round() truncation error flagged by error-prone
  ReflogIT: Add test coverage for reflog permissions
  ChangeIT: Move reflog test to ReflogIT
  ChangeIT: Fix and expand reflog test
  BranchApi: Add method to get the branch's reflog
  GetReflog: Move ReflogEntryInfo to a separate class in extension API
  Fix http_archive rule in WORKSPACE
  ConfigInfoImpl: Return raw byte value for effective value
  TransferConfig: Move getEffectiveMaxObjectSizeLimit to ProjectState
  ProjectIT: Factor out a method to set the max object size limit
  Documentation: linux-quickstart - include Java 8 requirement
  Documentation: Include Java 8 requirement in installation notes
  Documentation: Remove 'install-quick' page in favour of 'linux-quickstart'

Change-Id: I895790a8b2f9e8439e91c15ba4ee9a5a14a4ee94
This commit is contained in:
David Pursehouse
2018-08-22 21:55:58 +09:00
18 changed files with 109 additions and 285 deletions

View File

@@ -126,7 +126,25 @@ public class FormatUtil {
if (size == 0) {
return Resources.C.notAvailable();
}
int p = Math.abs(Math.round(delta * 100 / size));
int p = Math.abs(saturatedCast(delta * 100 / size));
return p + "%";
}
/**
* Returns the {@code int} nearest in value to {@code value}.
*
* @param value any {@code long} value
* @return the same value cast to {@code int} if it is in the range of the {@code int} type,
* {@link Integer#MAX_VALUE} if it is too large, or {@link Integer#MIN_VALUE} if it is too
* small
*/
private static int saturatedCast(long value) {
if (value > Integer.MAX_VALUE) {
return Integer.MAX_VALUE;
}
if (value < Integer.MIN_VALUE) {
return Integer.MIN_VALUE;
}
return (int) value;
}
}

View File

@@ -38,6 +38,8 @@ public interface AdminMessages extends Messages {
String globalMaxObjectSizeLimit(String globalMaxObjectSizeLimit);
String noMaxObjectSizeLimit();
String pluginProjectOptionsTitle(String pluginName);
String pluginProjectInheritedValue(String value);

View File

@@ -5,8 +5,9 @@ project = Project {0}
deletedGroup = Deleted Group {0}
deletedReference = Reference {0} was deleted
deletedSection = Section {0} was deleted
effectiveMaxObjectSizeLimit = effective: {0}
effectiveMaxObjectSizeLimit = effective: {0} bytes
globalMaxObjectSizeLimit = The global max object size limit is set to {0}. The limit cannot be increased on project level.
noMaxObjectSizeLimit = No max object size limit is set.
pluginProjectOptionsTitle = {0} Plugin Options
pluginProjectOptionsTitle = {0} Plugin
pluginProjectInheritedValue = inherited: {0}

View File

@@ -439,14 +439,15 @@ public class ProjectInfoScreen extends ProjectScreen {
setSubmitType(result.defaultSubmitType());
setState(result.state());
maxObjectSizeLimit.setText(result.maxObjectSizeLimit().configuredValue());
if (result.maxObjectSizeLimit().inheritedValue() != null) {
effectiveMaxObjectSizeLimit.setVisible(true);
if (result.maxObjectSizeLimit().value() != null) {
effectiveMaxObjectSizeLimit.setText(
AdminMessages.I.effectiveMaxObjectSizeLimit(result.maxObjectSizeLimit().value()));
effectiveMaxObjectSizeLimit.setTitle(
AdminMessages.I.globalMaxObjectSizeLimit(result.maxObjectSizeLimit().inheritedValue()));
if (result.maxObjectSizeLimit().inheritedValue() != null) {
effectiveMaxObjectSizeLimit.setTitle(
AdminMessages.I.globalMaxObjectSizeLimit(result.maxObjectSizeLimit().inheritedValue()));
}
} else {
effectiveMaxObjectSizeLimit.setVisible(false);
effectiveMaxObjectSizeLimit.setText(AdminMessages.I.noMaxObjectSizeLimit());
}
saveProject.setEnabled(false);