Merge branch 'stable-2.7' into stable-2.8

* stable-2.7:
  Use rev-parse to find gitdir when generating commit-msg hook hint

Conflicts:
	gerrit-server/src/main/java/com/google/gerrit/server/git/validators/CommitValidators.java

Change-Id: Ib6b05123e34b9a87a2e9bc735f05a443bdc13756
diff --git a/.buckconfig b/.buckconfig
new file mode 100644
index 0000000..1bc29ac
--- /dev/null
+++ b/.buckconfig
@@ -0,0 +1,16 @@
+[alias]
+  api = //:api
+  api_deploy = //tools/maven:deploy
+  api_install = //tools/maven:install
+  docs = //Documentation:html
+  gerrit = //:gerrit
+  release = //:release
+
+[buildfile]
+  includes = //tools/default.defs
+
+[java]
+  src_roots = java, resources
+
+[project]
+  ignore = .git
diff --git a/.buckversion b/.buckversion
new file mode 100644
index 0000000..e39bcf8
--- /dev/null
+++ b/.buckversion
@@ -0,0 +1 @@
+274acb17e9b6dc9ee60bc1371c47a7f49640c24c
diff --git a/.gitignore b/.gitignore
index c87c26f..1b4c29c 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,9 +1,17 @@
 /.classpath
 /.project
-/.settings
-/.settings/org.eclipse.jdt.core.prefs
 /.settings/org.maven.ide.eclipse.prefs
+/.settings/org.eclipse.m2e.core.prefs
+/.settings/org.eclipse.ltk.core.refactoring.prefs
 /test_site
 /.idea
 /gerrit-parent.iml
 *.sublime-*
+/gerrit-package-plugins
+/.buckconfig.local
+/.buckd
+/buck-cache
+/buck-out
+/local.properties
+*.pyc
+/gwt-unitCache
diff --git a/.gitmodules b/.gitmodules
index 0f7fdab..6476c4c 100644
--- a/.gitmodules
+++ b/.gitmodules
@@ -1,11 +1,20 @@
+[submodule "plugins/commit-message-length-validator"]
+	path = plugins/commit-message-length-validator
+	url = ../plugins/commit-message-length-validator
+
+[submodule "plugins/cookbook-plugin"]
+	path = plugins/cookbook-plugin
+	url = ../plugins/cookbook-plugin
+
+[submodule "plugins/download-commands"]
+	path = plugins/download-commands
+	url = ../plugins/download-commands
+
 [submodule "plugins/replication"]
 	path = plugins/replication
-	url = https://gerrit.googlesource.com/plugins/replication
+	url = ../plugins/replication
 
 [submodule "plugins/reviewnotes"]
 	path = plugins/reviewnotes
-	url = https://gerrit.googlesource.com/plugins/reviewnotes
+	url = ../plugins/reviewnotes
 
-[submodule "plugins/commit-message-length-validator"]
-	path = plugins/commit-message-length-validator
-	url = https://gerrit.googlesource.com/plugins/commit-message-length-validator
diff --git a/.pydevproject b/.pydevproject
new file mode 100644
index 0000000..be43141
--- /dev/null
+++ b/.pydevproject
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<?eclipse-pydev version="1.0"?>
+
+<pydev_project>
+<pydev_property name="org.python.pydev.PYTHON_PROJECT_INTERPRETER">Default</pydev_property>
+<pydev_property name="org.python.pydev.PYTHON_PROJECT_VERSION">python 2.6.5</pydev_property>
+</pydev_project>
diff --git a/.settings/org.eclipse.core.resources.prefs b/.settings/org.eclipse.core.resources.prefs
new file mode 100644
index 0000000..29abf99
--- /dev/null
+++ b/.settings/org.eclipse.core.resources.prefs
@@ -0,0 +1,6 @@
+eclipse.preferences.version=1
+encoding//src/main/java=UTF-8
+encoding//src/main/resources=UTF-8
+encoding//src/test/java=UTF-8
+encoding//src/test/resources=UTF-8
+encoding/<project>=UTF-8
diff --git a/.settings/org.eclipse.core.runtime.prefs b/.settings/org.eclipse.core.runtime.prefs
new file mode 100644
index 0000000..8667cfd
--- /dev/null
+++ b/.settings/org.eclipse.core.runtime.prefs
@@ -0,0 +1,3 @@
+#Tue Sep 02 16:59:24 PDT 2008
+eclipse.preferences.version=1
+line.separator=\n
diff --git a/.settings/org.eclipse.jdt.core.prefs b/.settings/org.eclipse.jdt.core.prefs
new file mode 100644
index 0000000..dbc83d5
--- /dev/null
+++ b/.settings/org.eclipse.jdt.core.prefs
@@ -0,0 +1,346 @@
+eclipse.preferences.version=1
+org.eclipse.jdt.core.compiler.annotation.missingNonNullByDefaultAnnotation=ignore
+org.eclipse.jdt.core.compiler.annotation.nonnull=org.eclipse.jdt.annotation.NonNull
+org.eclipse.jdt.core.compiler.annotation.nonnullbydefault=org.eclipse.jdt.annotation.NonNullByDefault
+org.eclipse.jdt.core.compiler.annotation.nullable=org.eclipse.jdt.annotation.Nullable
+org.eclipse.jdt.core.compiler.annotation.nullanalysis=disabled
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6
+org.eclipse.jdt.core.compiler.compliance=1.6
+org.eclipse.jdt.core.compiler.problem.annotationSuperInterface=ignore
+org.eclipse.jdt.core.compiler.problem.autoboxing=ignore
+org.eclipse.jdt.core.compiler.problem.comparingIdentical=warning
+org.eclipse.jdt.core.compiler.problem.deadCode=warning
+org.eclipse.jdt.core.compiler.problem.deprecation=warning
+org.eclipse.jdt.core.compiler.problem.deprecationInDeprecatedCode=disabled
+org.eclipse.jdt.core.compiler.problem.deprecationWhenOverridingDeprecatedMethod=disabled
+org.eclipse.jdt.core.compiler.problem.discouragedReference=warning
+org.eclipse.jdt.core.compiler.problem.emptyStatement=ignore
+org.eclipse.jdt.core.compiler.problem.explicitlyClosedAutoCloseable=ignore
+org.eclipse.jdt.core.compiler.problem.fallthroughCase=ignore
+org.eclipse.jdt.core.compiler.problem.fatalOptionalError=disabled
+org.eclipse.jdt.core.compiler.problem.fieldHiding=ignore
+org.eclipse.jdt.core.compiler.problem.finalParameterBound=warning
+org.eclipse.jdt.core.compiler.problem.finallyBlockNotCompletingNormally=warning
+org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning
+org.eclipse.jdt.core.compiler.problem.hiddenCatchBlock=warning
+org.eclipse.jdt.core.compiler.problem.includeNullInfoFromAsserts=disabled
+org.eclipse.jdt.core.compiler.problem.incompatibleNonInheritedInterfaceMethod=warning
+org.eclipse.jdt.core.compiler.problem.incompleteEnumSwitch=warning
+org.eclipse.jdt.core.compiler.problem.indirectStaticAccess=ignore
+org.eclipse.jdt.core.compiler.problem.localVariableHiding=ignore
+org.eclipse.jdt.core.compiler.problem.methodWithConstructorName=warning
+org.eclipse.jdt.core.compiler.problem.missingDefaultCase=ignore
+org.eclipse.jdt.core.compiler.problem.missingDeprecatedAnnotation=ignore
+org.eclipse.jdt.core.compiler.problem.missingEnumCaseDespiteDefault=disabled
+org.eclipse.jdt.core.compiler.problem.missingHashCodeMethod=ignore
+org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotation=ignore
+org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotationForInterfaceMethodImplementation=enabled
+org.eclipse.jdt.core.compiler.problem.missingSerialVersion=warning
+org.eclipse.jdt.core.compiler.problem.missingSynchronizedOnInheritedMethod=ignore
+org.eclipse.jdt.core.compiler.problem.noEffectAssignment=warning
+org.eclipse.jdt.core.compiler.problem.noImplicitStringConversion=warning
+org.eclipse.jdt.core.compiler.problem.nonExternalizedStringLiteral=ignore
+org.eclipse.jdt.core.compiler.problem.nullAnnotationInferenceConflict=error
+org.eclipse.jdt.core.compiler.problem.nullReference=warning
+org.eclipse.jdt.core.compiler.problem.nullSpecViolation=error
+org.eclipse.jdt.core.compiler.problem.nullUncheckedConversion=warning
+org.eclipse.jdt.core.compiler.problem.overridingPackageDefaultMethod=warning
+org.eclipse.jdt.core.compiler.problem.parameterAssignment=ignore
+org.eclipse.jdt.core.compiler.problem.possibleAccidentalBooleanAssignment=ignore
+org.eclipse.jdt.core.compiler.problem.potentialNullReference=ignore
+org.eclipse.jdt.core.compiler.problem.potentiallyUnclosedCloseable=ignore
+org.eclipse.jdt.core.compiler.problem.rawTypeReference=warning
+org.eclipse.jdt.core.compiler.problem.redundantNullAnnotation=warning
+org.eclipse.jdt.core.compiler.problem.redundantNullCheck=ignore
+org.eclipse.jdt.core.compiler.problem.redundantSpecificationOfTypeArguments=ignore
+org.eclipse.jdt.core.compiler.problem.redundantSuperinterface=ignore
+org.eclipse.jdt.core.compiler.problem.reportMethodCanBePotentiallyStatic=ignore
+org.eclipse.jdt.core.compiler.problem.reportMethodCanBeStatic=ignore
+org.eclipse.jdt.core.compiler.problem.specialParameterHidingField=disabled
+org.eclipse.jdt.core.compiler.problem.staticAccessReceiver=warning
+org.eclipse.jdt.core.compiler.problem.suppressOptionalErrors=disabled
+org.eclipse.jdt.core.compiler.problem.suppressWarnings=enabled
+org.eclipse.jdt.core.compiler.problem.syntheticAccessEmulation=ignore
+org.eclipse.jdt.core.compiler.problem.typeParameterHiding=warning
+org.eclipse.jdt.core.compiler.problem.unavoidableGenericTypeProblems=enabled
+org.eclipse.jdt.core.compiler.problem.uncheckedTypeOperation=warning
+org.eclipse.jdt.core.compiler.problem.unclosedCloseable=warning
+org.eclipse.jdt.core.compiler.problem.undocumentedEmptyBlock=ignore
+org.eclipse.jdt.core.compiler.problem.unhandledWarningToken=warning
+org.eclipse.jdt.core.compiler.problem.unnecessaryElse=ignore
+org.eclipse.jdt.core.compiler.problem.unnecessaryTypeCheck=ignore
+org.eclipse.jdt.core.compiler.problem.unqualifiedFieldAccess=ignore
+org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownException=ignore
+org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionExemptExceptionAndThrowable=enabled
+org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionIncludeDocCommentReference=enabled
+org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionWhenOverriding=disabled
+org.eclipse.jdt.core.compiler.problem.unusedImport=warning
+org.eclipse.jdt.core.compiler.problem.unusedLabel=warning
+org.eclipse.jdt.core.compiler.problem.unusedLocal=warning
+org.eclipse.jdt.core.compiler.problem.unusedObjectAllocation=ignore
+org.eclipse.jdt.core.compiler.problem.unusedParameter=ignore
+org.eclipse.jdt.core.compiler.problem.unusedParameterIncludeDocCommentReference=enabled
+org.eclipse.jdt.core.compiler.problem.unusedParameterWhenImplementingAbstract=disabled
+org.eclipse.jdt.core.compiler.problem.unusedParameterWhenOverridingConcrete=disabled
+org.eclipse.jdt.core.compiler.problem.unusedPrivateMember=warning
+org.eclipse.jdt.core.compiler.problem.unusedWarningToken=warning
+org.eclipse.jdt.core.compiler.problem.varargsArgumentNeedCast=warning
+org.eclipse.jdt.core.compiler.source=1.6
+org.eclipse.jdt.core.formatter.align_type_members_on_columns=false
+org.eclipse.jdt.core.formatter.alignment_for_arguments_in_allocation_expression=16
+org.eclipse.jdt.core.formatter.alignment_for_arguments_in_enum_constant=16
+org.eclipse.jdt.core.formatter.alignment_for_arguments_in_explicit_constructor_call=16
+org.eclipse.jdt.core.formatter.alignment_for_arguments_in_method_invocation=16
+org.eclipse.jdt.core.formatter.alignment_for_arguments_in_qualified_allocation_expression=16
+org.eclipse.jdt.core.formatter.alignment_for_assignment=16
+org.eclipse.jdt.core.formatter.alignment_for_binary_expression=16
+org.eclipse.jdt.core.formatter.alignment_for_compact_if=16
+org.eclipse.jdt.core.formatter.alignment_for_conditional_expression=16
+org.eclipse.jdt.core.formatter.alignment_for_enum_constants=16
+org.eclipse.jdt.core.formatter.alignment_for_expressions_in_array_initializer=16
+org.eclipse.jdt.core.formatter.alignment_for_multiple_fields=16
+org.eclipse.jdt.core.formatter.alignment_for_parameters_in_constructor_declaration=16
+org.eclipse.jdt.core.formatter.alignment_for_parameters_in_method_declaration=16
+org.eclipse.jdt.core.formatter.alignment_for_selector_in_method_invocation=16
+org.eclipse.jdt.core.formatter.alignment_for_superclass_in_type_declaration=16
+org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_enum_declaration=16
+org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_type_declaration=16
+org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_constructor_declaration=16
+org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_method_declaration=16
+org.eclipse.jdt.core.formatter.blank_lines_after_imports=1
+org.eclipse.jdt.core.formatter.blank_lines_after_package=1
+org.eclipse.jdt.core.formatter.blank_lines_before_field=0
+org.eclipse.jdt.core.formatter.blank_lines_before_first_class_body_declaration=0
+org.eclipse.jdt.core.formatter.blank_lines_before_imports=0
+org.eclipse.jdt.core.formatter.blank_lines_before_member_type=0
+org.eclipse.jdt.core.formatter.blank_lines_before_method=1
+org.eclipse.jdt.core.formatter.blank_lines_before_new_chunk=1
+org.eclipse.jdt.core.formatter.blank_lines_before_package=0
+org.eclipse.jdt.core.formatter.blank_lines_between_import_groups=1
+org.eclipse.jdt.core.formatter.blank_lines_between_type_declarations=2
+org.eclipse.jdt.core.formatter.brace_position_for_annotation_type_declaration=end_of_line
+org.eclipse.jdt.core.formatter.brace_position_for_anonymous_type_declaration=end_of_line
+org.eclipse.jdt.core.formatter.brace_position_for_array_initializer=end_of_line
+org.eclipse.jdt.core.formatter.brace_position_for_block=end_of_line
+org.eclipse.jdt.core.formatter.brace_position_for_block_in_case=end_of_line
+org.eclipse.jdt.core.formatter.brace_position_for_constructor_declaration=end_of_line
+org.eclipse.jdt.core.formatter.brace_position_for_enum_constant=end_of_line
+org.eclipse.jdt.core.formatter.brace_position_for_enum_declaration=end_of_line
+org.eclipse.jdt.core.formatter.brace_position_for_method_declaration=end_of_line
+org.eclipse.jdt.core.formatter.brace_position_for_switch=end_of_line
+org.eclipse.jdt.core.formatter.brace_position_for_type_declaration=end_of_line
+org.eclipse.jdt.core.formatter.comment.clear_blank_lines_in_block_comment=false
+org.eclipse.jdt.core.formatter.comment.clear_blank_lines_in_javadoc_comment=false
+org.eclipse.jdt.core.formatter.comment.format_block_comments=true
+org.eclipse.jdt.core.formatter.comment.format_header=true
+org.eclipse.jdt.core.formatter.comment.format_html=true
+org.eclipse.jdt.core.formatter.comment.format_javadoc_comments=true
+org.eclipse.jdt.core.formatter.comment.format_line_comments=true
+org.eclipse.jdt.core.formatter.comment.format_source_code=true
+org.eclipse.jdt.core.formatter.comment.indent_parameter_description=false
+org.eclipse.jdt.core.formatter.comment.indent_root_tags=true
+org.eclipse.jdt.core.formatter.comment.insert_new_line_before_root_tags=insert
+org.eclipse.jdt.core.formatter.comment.insert_new_line_for_parameter=do not insert
+org.eclipse.jdt.core.formatter.comment.line_length=80
+org.eclipse.jdt.core.formatter.compact_else_if=true
+org.eclipse.jdt.core.formatter.continuation_indentation=2
+org.eclipse.jdt.core.formatter.continuation_indentation_for_array_initializer=2
+org.eclipse.jdt.core.formatter.format_guardian_clause_on_one_line=false
+org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_annotation_declaration_header=true
+org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_enum_constant_header=true
+org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_enum_declaration_header=true
+org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_type_header=true
+org.eclipse.jdt.core.formatter.indent_breaks_compare_to_cases=true
+org.eclipse.jdt.core.formatter.indent_empty_lines=false
+org.eclipse.jdt.core.formatter.indent_statements_compare_to_block=true
+org.eclipse.jdt.core.formatter.indent_statements_compare_to_body=true
+org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_cases=true
+org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_switch=true
+org.eclipse.jdt.core.formatter.indentation.size=4
+org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_local_variable=insert
+org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_member=insert
+org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_parameter=do not insert
+org.eclipse.jdt.core.formatter.insert_new_line_after_opening_brace_in_array_initializer=do not insert
+org.eclipse.jdt.core.formatter.insert_new_line_at_end_of_file_if_missing=insert
+org.eclipse.jdt.core.formatter.insert_new_line_before_catch_in_try_statement=do not insert
+org.eclipse.jdt.core.formatter.insert_new_line_before_closing_brace_in_array_initializer=do not insert
+org.eclipse.jdt.core.formatter.insert_new_line_before_else_in_if_statement=do not insert
+org.eclipse.jdt.core.formatter.insert_new_line_before_finally_in_try_statement=do not insert
+org.eclipse.jdt.core.formatter.insert_new_line_before_while_in_do_statement=do not insert
+org.eclipse.jdt.core.formatter.insert_new_line_in_empty_annotation_declaration=insert
+org.eclipse.jdt.core.formatter.insert_new_line_in_empty_anonymous_type_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_new_line_in_empty_block=insert
+org.eclipse.jdt.core.formatter.insert_new_line_in_empty_enum_constant=do not insert
+org.eclipse.jdt.core.formatter.insert_new_line_in_empty_enum_declaration=insert
+org.eclipse.jdt.core.formatter.insert_new_line_in_empty_method_body=insert
+org.eclipse.jdt.core.formatter.insert_new_line_in_empty_type_declaration=insert
+org.eclipse.jdt.core.formatter.insert_space_after_and_in_type_parameter=insert
+org.eclipse.jdt.core.formatter.insert_space_after_assignment_operator=insert
+org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation_type_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_binary_operator=insert
+org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_arguments=insert
+org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_parameters=insert
+org.eclipse.jdt.core.formatter.insert_space_after_closing_brace_in_block=insert
+org.eclipse.jdt.core.formatter.insert_space_after_closing_paren_in_cast=insert
+org.eclipse.jdt.core.formatter.insert_space_after_colon_in_assert=insert
+org.eclipse.jdt.core.formatter.insert_space_after_colon_in_case=insert
+org.eclipse.jdt.core.formatter.insert_space_after_colon_in_conditional=insert
+org.eclipse.jdt.core.formatter.insert_space_after_colon_in_for=insert
+org.eclipse.jdt.core.formatter.insert_space_after_colon_in_labeled_statement=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_allocation_expression=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_annotation=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_array_initializer=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_constructor_declaration_parameters=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_constructor_declaration_throws=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_enum_constant_arguments=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_enum_declarations=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_explicitconstructorcall_arguments=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_for_increments=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_for_inits=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_declaration_parameters=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_declaration_throws=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_invocation_arguments=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_multiple_field_declarations=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_multiple_local_declarations=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_parameterized_type_reference=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_superinterfaces=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_arguments=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_parameters=insert
+org.eclipse.jdt.core.formatter.insert_space_after_ellipsis=insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_parameterized_type_reference=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_arguments=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_parameters=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_brace_in_array_initializer=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_bracket_in_array_allocation_expression=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_bracket_in_array_reference=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_annotation=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_cast=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_catch=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_constructor_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_enum_constant=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_for=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_if=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_method_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_method_invocation=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_parenthesized_expression=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_switch=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_synchronized=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_while=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_postfix_operator=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_prefix_operator=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_question_in_conditional=insert
+org.eclipse.jdt.core.formatter.insert_space_after_question_in_wildcard=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_semicolon_in_for=insert
+org.eclipse.jdt.core.formatter.insert_space_after_unary_operator=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_and_in_type_parameter=insert
+org.eclipse.jdt.core.formatter.insert_space_before_assignment_operator=insert
+org.eclipse.jdt.core.formatter.insert_space_before_at_in_annotation_type_declaration=insert
+org.eclipse.jdt.core.formatter.insert_space_before_binary_operator=insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_parameterized_type_reference=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_arguments=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_parameters=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_brace_in_array_initializer=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_bracket_in_array_allocation_expression=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_bracket_in_array_reference=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_annotation=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_cast=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_catch=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_constructor_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_enum_constant=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_for=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_if=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_method_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_method_invocation=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_parenthesized_expression=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_switch=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_synchronized=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_while=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_colon_in_assert=insert
+org.eclipse.jdt.core.formatter.insert_space_before_colon_in_case=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_colon_in_conditional=insert
+org.eclipse.jdt.core.formatter.insert_space_before_colon_in_default=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_colon_in_for=insert
+org.eclipse.jdt.core.formatter.insert_space_before_colon_in_labeled_statement=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_allocation_expression=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_annotation=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_array_initializer=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_constructor_declaration_parameters=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_constructor_declaration_throws=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_enum_constant_arguments=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_enum_declarations=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_explicitconstructorcall_arguments=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_for_increments=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_for_inits=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_declaration_parameters=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_declaration_throws=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_invocation_arguments=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_multiple_field_declarations=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_multiple_local_declarations=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_parameterized_type_reference=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_superinterfaces=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_arguments=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_parameters=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_ellipsis=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_parameterized_type_reference=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_arguments=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_parameters=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_annotation_type_declaration=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_anonymous_type_declaration=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_array_initializer=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_block=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_constructor_declaration=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_enum_constant=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_enum_declaration=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_method_declaration=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_switch=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_type_declaration=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_allocation_expression=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_reference=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_type_reference=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_annotation=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_annotation_type_member_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_catch=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_constructor_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_enum_constant=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_for=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_if=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_method_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_method_invocation=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_parenthesized_expression=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_switch=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_synchronized=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_while=insert
+org.eclipse.jdt.core.formatter.insert_space_before_parenthesized_expression_in_return=insert
+org.eclipse.jdt.core.formatter.insert_space_before_parenthesized_expression_in_throw=insert
+org.eclipse.jdt.core.formatter.insert_space_before_postfix_operator=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_prefix_operator=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_question_in_conditional=insert
+org.eclipse.jdt.core.formatter.insert_space_before_question_in_wildcard=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_semicolon=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_semicolon_in_for=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_unary_operator=do not insert
+org.eclipse.jdt.core.formatter.insert_space_between_brackets_in_array_type_reference=do not insert
+org.eclipse.jdt.core.formatter.insert_space_between_empty_braces_in_array_initializer=do not insert
+org.eclipse.jdt.core.formatter.insert_space_between_empty_brackets_in_array_allocation_expression=do not insert
+org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_annotation_type_member_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_constructor_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_enum_constant=do not insert
+org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_method_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_method_invocation=do not insert
+org.eclipse.jdt.core.formatter.join_lines_in_comments=true
+org.eclipse.jdt.core.formatter.join_wrapped_lines=true
+org.eclipse.jdt.core.formatter.keep_else_statement_on_same_line=false
+org.eclipse.jdt.core.formatter.keep_empty_array_initializer_on_one_line=false
+org.eclipse.jdt.core.formatter.keep_imple_if_on_one_line=true
+org.eclipse.jdt.core.formatter.keep_then_statement_on_same_line=false
+org.eclipse.jdt.core.formatter.lineSplit=80
+org.eclipse.jdt.core.formatter.never_indent_block_comments_on_first_column=false
+org.eclipse.jdt.core.formatter.never_indent_line_comments_on_first_column=false
+org.eclipse.jdt.core.formatter.number_of_blank_lines_at_beginning_of_method_body=0
+org.eclipse.jdt.core.formatter.number_of_empty_lines_to_preserve=3
+org.eclipse.jdt.core.formatter.put_empty_statement_on_new_line=false
+org.eclipse.jdt.core.formatter.tabulation.char=space
+org.eclipse.jdt.core.formatter.tabulation.size=2
+org.eclipse.jdt.core.formatter.use_tabs_only_for_leading_indentations=false
+org.eclipse.jdt.core.formatter.wrap_before_binary_operator=true
diff --git a/.settings/org.eclipse.jdt.ui.prefs b/.settings/org.eclipse.jdt.ui.prefs
new file mode 100644
index 0000000..d4218a5
--- /dev/null
+++ b/.settings/org.eclipse.jdt.ui.prefs
@@ -0,0 +1,61 @@
+#Wed Jul 29 11:31:38 PDT 2009
+eclipse.preferences.version=1
+editor_save_participant_org.eclipse.jdt.ui.postsavelistener.cleanup=true
+formatter_profile=_Google Format
+formatter_settings_version=11
+org.eclipse.jdt.ui.ignorelowercasenames=true
+org.eclipse.jdt.ui.importorder=com.google;com;junit;net;org;java;javax;
+org.eclipse.jdt.ui.ondemandthreshold=99
+org.eclipse.jdt.ui.staticondemandthreshold=99
+org.eclipse.jdt.ui.text.custom_code_templates=<?xml version\="1.0" encoding\="UTF-8" standalone\="no"?><templates/>
+sp_cleanup.add_default_serial_version_id=true
+sp_cleanup.add_generated_serial_version_id=false
+sp_cleanup.add_missing_annotations=false
+sp_cleanup.add_missing_deprecated_annotations=true
+sp_cleanup.add_missing_methods=false
+sp_cleanup.add_missing_nls_tags=false
+sp_cleanup.add_missing_override_annotations=true
+sp_cleanup.add_serial_version_id=false
+sp_cleanup.always_use_blocks=true
+sp_cleanup.always_use_parentheses_in_expressions=false
+sp_cleanup.always_use_this_for_non_static_field_access=false
+sp_cleanup.always_use_this_for_non_static_method_access=false
+sp_cleanup.convert_to_enhanced_for_loop=false
+sp_cleanup.correct_indentation=false
+sp_cleanup.format_source_code=false
+sp_cleanup.format_source_code_changes_only=false
+sp_cleanup.make_local_variable_final=true
+sp_cleanup.make_parameters_final=true
+sp_cleanup.make_private_fields_final=true
+sp_cleanup.make_type_abstract_if_missing_method=false
+sp_cleanup.make_variable_declarations_final=false
+sp_cleanup.never_use_blocks=false
+sp_cleanup.never_use_parentheses_in_expressions=true
+sp_cleanup.on_save_use_additional_actions=true
+sp_cleanup.organize_imports=false
+sp_cleanup.qualify_static_field_accesses_with_declaring_class=false
+sp_cleanup.qualify_static_member_accesses_through_instances_with_declaring_class=true
+sp_cleanup.qualify_static_member_accesses_through_subtypes_with_declaring_class=true
+sp_cleanup.qualify_static_member_accesses_with_declaring_class=false
+sp_cleanup.qualify_static_method_accesses_with_declaring_class=false
+sp_cleanup.remove_private_constructors=true
+sp_cleanup.remove_trailing_whitespaces=true
+sp_cleanup.remove_trailing_whitespaces_all=true
+sp_cleanup.remove_trailing_whitespaces_ignore_empty=false
+sp_cleanup.remove_unnecessary_casts=false
+sp_cleanup.remove_unnecessary_nls_tags=false
+sp_cleanup.remove_unused_imports=false
+sp_cleanup.remove_unused_local_variables=false
+sp_cleanup.remove_unused_private_fields=true
+sp_cleanup.remove_unused_private_members=false
+sp_cleanup.remove_unused_private_methods=true
+sp_cleanup.remove_unused_private_types=true
+sp_cleanup.sort_members=false
+sp_cleanup.sort_members_all=false
+sp_cleanup.use_blocks=false
+sp_cleanup.use_blocks_only_for_return_and_throw=false
+sp_cleanup.use_parentheses_in_expressions=false
+sp_cleanup.use_this_for_non_static_field_access=false
+sp_cleanup.use_this_for_non_static_field_access_only_if_necessary=true
+sp_cleanup.use_this_for_non_static_method_access=false
+sp_cleanup.use_this_for_non_static_method_access_only_if_necessary=true
diff --git a/BUCK b/BUCK
new file mode 100644
index 0000000..616a0fe
--- /dev/null
+++ b/BUCK
@@ -0,0 +1,78 @@
+include_defs('//tools/build.defs')
+
+gerrit_war(name = 'gerrit')
+gerrit_war(name = 'chrome',   ui = 'ui_chrome')
+gerrit_war(name = 'firefox',  ui = 'ui_firefox')
+gerrit_war(name = 'withdocs', context = DOCS)
+gerrit_war(name = 'release',  context = DOCS + ['//plugins:core.zip'])
+
+API_DEPS = [
+  ':extension-api',
+  ':extension-api-src',
+  ':plugin-api',
+  ':plugin-api-src',
+]
+
+genrule(
+  name = 'api',
+  cmd = ';'.join(
+    ['cd $TMP'] +
+    ['ln -s $(location %s) .' % n for n in API_DEPS] +
+    ['zip -q0 $OUT *']),
+  deps = API_DEPS,
+  out = 'api.zip',
+)
+
+java_binary(
+  name = 'extension-api',
+  deps = [':extension-lib'],
+  visibility = ['//tools/maven:'],
+)
+
+java_library(
+  name = 'extension-lib',
+  deps = [
+    '//gerrit-extension-api:api',
+    '//lib/guice:guice',
+    '//lib/guice:guice-servlet',
+    '//lib:servlet-api-3_0',
+  ],
+  export_deps = True,
+  visibility = ['PUBLIC'],
+)
+
+genrule(
+  name = 'extension-api-src',
+  cmd = 'ln -s $(location //gerrit-extension-api:api-src) $OUT',
+  deps = ['//gerrit-extension-api:api-src'],
+  out = 'extension-api-src.jar',
+  visibility = ['//tools/maven:'],
+)
+
+PLUGIN_API = [
+  '//gerrit-server:server',
+  '//gerrit-pgm:init-api',
+  '//gerrit-sshd:sshd',
+  '//gerrit-httpd:httpd',
+]
+
+java_binary(
+  name = 'plugin-api',
+  deps = [':plugin-lib'],
+  visibility = ['//tools/maven:'],
+)
+
+java_library(
+  name = 'plugin-lib',
+  deps = PLUGIN_API + ['//lib:servlet-api-3_0'],
+  export_deps = True,
+  visibility = ['PUBLIC'],
+)
+
+java_binary(
+  name = 'plugin-api-src',
+  deps = [
+    '//gerrit-extension-api:api-src',
+  ] + [d + '-src' for d in PLUGIN_API],
+  visibility = ['//tools/maven:'],
+)
diff --git a/Documentation/.gitignore b/Documentation/.gitignore
deleted file mode 100644
index 8a3da24..0000000
--- a/Documentation/.gitignore
+++ /dev/null
@@ -1,2 +0,0 @@
-*.html
-/.published
diff --git a/Documentation/BUCK b/Documentation/BUCK
new file mode 100644
index 0000000..71d8664
--- /dev/null
+++ b/Documentation/BUCK
@@ -0,0 +1,81 @@
+include_defs('//Documentation/asciidoc.defs')
+include_defs('//Documentation/config.defs')
+include_defs('//tools/git.defs')
+
+DOC_DIR = 'Documentation'
+INDEX_DIR = DOC_DIR + '/.index'
+MAIN = ['//gerrit-pgm:pgm', '//gerrit-gwtui:ui_module']
+SRCS = glob(['*.txt'], excludes = ['licenses.txt'])
+
+genrule(
+  name = 'html',
+  cmd = 'cd $TMP;' +
+    'mkdir -p %s/images;' % DOC_DIR +
+    'unzip -q $SRCDIR/index.zip -d %s/;' % INDEX_DIR +
+    'unzip -q $SRCDIR/only_html.zip -d %s/;' % DOC_DIR +
+    'for s in $SRCS;do ln -s $s %s;done;' % DOC_DIR +
+    'mv %s/*.{jpg,png} %s/images;' % (DOC_DIR, DOC_DIR) +
+    'rm %s/only_html.zip;' % DOC_DIR +
+    'rm %s/index.zip;' % DOC_DIR +
+    'rm %s/licenses.txt;' % DOC_DIR +
+    'cp $SRCDIR/licenses.txt LICENSES.txt;' +
+    'zip -qr $OUT *',
+  srcs = glob([
+      'images/*.jpg',
+      'images/*.png',
+    ]) + [
+      'doc.css',
+      genfile('licenses.txt'),
+      genfile('only_html.zip'),
+      genfile('index.zip'),
+    ],
+  deps = [
+    ':generate_html',
+    ':index',
+    ':licenses.txt',
+  ],
+  out = 'html.zip',
+  visibility = ['PUBLIC'],
+)
+
+genasciidoc(
+  name = 'generate_html',
+  srcs = SRCS + [genfile('licenses.txt')],
+  deps = [':licenses.txt'],
+  attributes = documentation_attributes(git_describe()),
+  backend = 'html5',
+  out = 'only_html.zip',
+)
+
+genrule(
+  name = 'licenses.txt',
+  cmd = '$(exe :gen_licenses) >$OUT',
+  deps = [':gen_licenses'] + MAIN,
+  out = 'licenses.txt',
+)
+
+python_binary(
+  name = 'gen_licenses',
+  main = 'gen_licenses.py',
+)
+
+python_binary(
+  name = 'replace_macros',
+  main = 'replace_macros.py',
+)
+
+genrule(
+  name = 'index',
+  cmd = '$(exe //lib/asciidoctor:doc_indexer) ' +
+      '-z $OUT ' +
+      '--prefix "%s/" ' % DOC_DIR +
+      '--in-ext ".txt" ' +
+      '--out-ext ".html" ' +
+      '$SRCS',
+  srcs = SRCS + [genfile('licenses.txt')],
+  deps = [
+    ':licenses.txt',
+    '//lib/asciidoctor:doc_indexer',
+  ],
+  out = 'index.zip',
+)
diff --git a/Documentation/GEN-DOC-VERSION b/Documentation/GEN-DOC-VERSION
deleted file mode 100755
index 973bfa8..0000000
--- a/Documentation/GEN-DOC-VERSION
+++ /dev/null
@@ -1,19 +0,0 @@
-#!/bin/sh
-
-V=$(git describe HEAD)
-
-case "$V" in
-'')
-	echo >&2 "fatal: no annotated tags, cannot determine version"
-	exit 1
-	;;
-
-*-g*)
-	echo >&2 "fatal: snapshot $V, cannot determine version"
-	exit 1
-	;;
-
-v*)
-	echo "$V" | perl -lne 'print $1 if /^v(\d+\.\d+(?:\.\d+)?)/'
-	;;
-esac
diff --git a/Documentation/Makefile b/Documentation/Makefile
deleted file mode 100644
index 59de209..0000000
--- a/Documentation/Makefile
+++ /dev/null
@@ -1,95 +0,0 @@
-# Copyright (C) 2009 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.
-
-ASCIIDOC       ?= asciidoc
-ASCIIDOC_EXTRA ?=
-ASCIIDOC_VER   ?= 8.6.3
-SVN            ?= svn
-PUB_ROOT       ?= https://gerrit-documentation.googlecode.com/svn/Documentation
-
-all: html
-
-clean:
-	rm -f *.html
-	rm -rf $(LOCAL_ROOT)
-
-ASCIIDOC_EXE := $(shell which $(ASCIIDOC))
-ifeq ($(wildcard $(ASCIIDOC_EXE)),)
-  $(error $(ASCIIDOC) must be available)
-else
-  ASCIIDOC_OK := $(shell expr `asciidoc --version | cut -f2 -d' '` \>= $(ASCIIDOC_VER))
-  ifeq ($(ASCIIDOC_OK),0)
-    $(error $(ASCIIDOC) version $(ASCIIDOC_VER) or higher is required)
-  endif
-endif
-
-ifeq ($(origin VERSION), undefined)
-  VERSION := $(shell ./GEN-DOC-VERSION 2>/dev/null)
-endif
-
-DOC_HTML      := $(patsubst %.txt,%.html,$(wildcard *.txt))
-LOCAL_ROOT    := .published
-COMMIT        := $(shell git describe HEAD | sed s/^v//)
-PUB_DIR       := $(PUB_ROOT)/$(VERSION)
-PRIOR          = PRIOR
-
-ifeq ($(VERSION),)
-  REVISION = $(COMMIT)
-else
-  ifeq ($(VERSION),$(COMMIT))
-    REVISION := $(VERSION)
-  else
-    REVISION := $(VERSION) (from v$(COMMIT))
-  endif
-endif
-
-html: $(DOC_HTML)
-
-update: html
-ifeq ($(VERSION),)
-	./GEN-DOC-VERSION
-endif
-	@-rm -rf $(LOCAL_ROOT)
-	@echo "Checking out current $(VERSION)"
-	@if ! $(SVN) checkout $(PUB_DIR) $(LOCAL_ROOT) 2>/dev/null ; then \
-		echo "Copying $(PRIOR) to $(VERSION) ..." && \
-		$(SVN) cp -m "Create $(VERSION) documentation" $(PUB_ROOT)/$(PRIOR) $(PUB_DIR) && \
-		$(SVN) checkout $(PUB_DIR) $(LOCAL_ROOT) ; \
-	fi
-	@rm -f $(LOCAL_ROOT)/*.html
-	@cp *.html $(LOCAL_ROOT)
-	@cd $(LOCAL_ROOT) && \
-	  r=`$(SVN) status | perl -ne 'print if s/^!  *//' ` && \
-	  if [ -n "$$r" ]; then $(SVN) rm $$r; fi && \
-	  a=`$(SVN) status | perl -ne 'print if s/^\?  *//' ` && \
-	  if [ -n "$$a" ]; then \
-	    $(SVN) add $$a && \
-	    $(SVN) propset svn:mime-type text/html $$a ; \
-	    fi && \
-	  echo "Committing $(VERSION) at v$(COMMIT)" && \
-	  $(SVN) commit -m "Updated $(VERSION) documentation to v$(COMMIT)"
-	@-rm -rf $(LOCAL_ROOT)
-
-$(DOC_HTML): %.html : %.txt
-	@echo "FORMAT $@"
-	@rm -f $@+ $@
-	@$(ASCIIDOC) -a toc \
-		-a data-uri \
-		-a 'revision=$(REVISION)' \
-		-a 'newline=\n' \
-		-b xhtml11 \
-		-f asciidoc.conf \
-		$(ASCIIDOC_EXTRA) \
-		-o $@+ $<
-	@mv $@+ $@
diff --git a/Documentation/access-control.txt b/Documentation/access-control.txt
index ab32d78..189316c 100644
--- a/Documentation/access-control.txt
+++ b/Documentation/access-control.txt
@@ -348,7 +348,7 @@
 
 This is where the Gerrit configuration of each project is residing.  This
 branch contains several files of importance: +project.config+, +groups+ and
-+rules.pl+.  Torgether they control access and behaviour during the change
++rules.pl+.  Torgether they control access and behavior during the change
 review process.
 
 
@@ -374,7 +374,6 @@
 These are references with added functionality to them compared to a regular
 git push operation.
 
-
 refs/for/<branch ref>
 ^^^^^^^^^^^^^^^^^^^^^
 
@@ -410,10 +409,6 @@
 Gerrit has several permission categories that can be granted to groups
 within projects, enabling functionality for that group's members.
 
-With the release of the Gerrit 2.2.x series, the web GUI for ACL
-configuration was rewritten from scratch.  Use this
-<<conversion_table,table>> to better understand the access rights
-conversions from the Gerrit 2.1.x to the Gerrit 2.2.x series.
 
 
 [[category_abandon]]
@@ -424,8 +419,9 @@
 to projects in Gerrit. It can give permission to abandon a specific
 change to a given ref.
 
-This also grants the permission to restore a change if the change
-can be uploaded.
+This also grants the permission to restore a change if the user also
+has link:#category_push[push permission] on the change's destination
+ref.
 
 
 [[category_create]]
@@ -604,7 +600,7 @@
 
 [[category_push_merge]]
 Push Merge Commits
-~~~~~~~~~~~~~~~~~~~~
+~~~~~~~~~~~~~~~~~~
 
 The `Push Merge Commit` access right permits the user to upload merge
 commits.  It's an add-on to the <<category_push,Push>> access right, and
@@ -752,7 +748,8 @@
 
 For every configured label `My-Name` in the project, there is a
 corresponding permission `label-My-Name` with a range corresponding to
-the defined values.
+the defined values. There is also a corresponding `labelAs-My-Name`
+permission that enables editing another user's label.
 
 Gerrit comes pre-configured with a default 'Code-Review' label that can
 be granted to groups within projects, enabling functionality for that
@@ -825,6 +822,10 @@
 can always edit the topic name (even without having the `Edit Topic Name`
 access right assigned).
 
+Whether the topic can be edited on closed changes can be controlled
+by the 'Force Edit' flag. If this flag is not set the topic can only be
+edited on open changes.
+
 
 Examples of typical roles in a project
 --------------------------------------
@@ -875,7 +876,7 @@
 * xref:category_push_merge[`Push merge commit`] to 'refs/for/refs/heads/*'
 * xref:category_forge_author[`Forge Author Identity`] to 'refs/heads/*'
 * link:config-labels.html#label_Code-Review[`Label: Code-Review`] with range '-2' to '+2' for 'refs/heads/*'
-* link:config-labels.html#label_Verified[`Label: Verify`] with range '-1' to '+1' for 'refs/heads/*'
+* link:config-labels.html#label_Verified[`Label: Verified`] with range '-1' to '+1' for 'refs/heads/*'
 * xref:category_submit[`Submit`]
 
 If the project is small or the developers are seasoned it might make
@@ -903,15 +904,15 @@
 * An unstable build (tests fails)
 * A failed build
 
-Usually the range chosen for this verdict is the verify label.  Depending on
+Usually the range chosen for this verdict is the `Verified` label.  Depending on
 the size of your project and discipline of involved developers you might want
-to limit access right to the +1 `Verify` label to the CI system only.  That
+to limit access right to the +1 `Verified` label to the CI system only.  That
 way it's guaranteed that submitted commits always get built and pass tests
 successfully.
 
 If the build doesn't complete successfully the CI system can set the
-`Verify` label to -1.  However that means that a failed build will block
-submit of the change even if someone else sets `Verify` +1.  Depending on the
+`Verified` label to -1.  However that means that a failed build will block
+submit of the change even if someone else sets `Verified` +1.  Depending on the
 project and how much the CI system can be trusted for accurate results, a
 blocking label might not be feasible.  A recommended alternative is to set the
 label `Code-review` to -1 instead, as it isn't a blocking label but still
@@ -928,7 +929,7 @@
 
 * xref:category_read[`Read`] on 'refs/heads/\*' and 'refs/tags/*'
 * link:config-labels.html#label_Code-Review[`Label: Code-Review`] with range '-1' to '0' for 'refs/heads/*'
-* link:config-labels.html#label_Verified[`Label: Verify`] with range '0' to '+1' for 'refs/heads/*'
+* link:config-labels.html#label_Verified[`Label: Verified`] with range '0' to '+1' for 'refs/heads/*'
 
 Optional access rights to grant:
 
@@ -1118,43 +1119,6 @@
     label-Release-Process = -1..+1 group Release Engineers
 ====
 
-
-[[conversion_table]]
-Conversion table from 2.1.x series to 2.2.x series
---------------------------------------------------
-
-[options="header"]
-|=================================================================================
-|Gerrit 2.1.x                 |Gerrit 2.2.x
-|Code review                  |link:config-labels.html#label_Code-Review[Label: Code-Review]
-|Verify                       |link:config-labels.html#label_Verified[Label: Verify]
-|Forge Identity +1            |Forge <<category_forge_author,author>> identity
-|Forge Identity +2            |Forge <<category_forge_committer,committer>> & <<category_forge_author,author>> identity
-|Forge Identity +3            |Forge <<category_forge_server,server>> & <<category_forge_committer,committer>> & <<category_forge_author,author>> identity
-|Owner                        |<<category_owner,Owner>>
-|Push branch +1               |<<category_push_direct,Push>>
-|Push branch +2               |<<category_create,Create reference>> & <<category_push_direct,Push>>
-|Push branch +3               |<<category_push_direct,Push>> (with force) & <<category_create,Create reference>>
-|Push tag +1 & Push Branch +2 |No support to limit to push signed tag
-|Push tag +2 & Push Branch +2 |<<category_push_annotated,Push annotated tag>>
-|Push Branch +2 (refs/tags/*) |<<category_create,Create reference>> (refs/tags/...)
-|Push Branch +3 (refs/tags/*) |<<category_push_direct,Push>> (with force on refs/tags/...)
-|Read +1                      |<<category_read,Read>>
-|Read +2                      |<<category_read,Read>> & <<category_push_review,Push>> (refs/for/refs/...)
-|Read +3                      |<<category_read,Read>> & <<category_push_review,Push>> (refs/for/refs/...) & <<category_push_merge,Push Merge Commit>>
-|Submit                       |<<category_submit,Submit>>
-|=================================================================================
-
-
-[NOTE]
-In Gerrit 2.2.x, the way to set permissions for upload has changed entirely.
-To upload a change for review is no longer a separate permission type,
-instead you grant ordinary push permissions to the actual
-receiving reference. In practice this means that you set push permissions
-on `refs/for/refs/heads/<branch>` rather than permissions to upload changes
-on `refs/heads/<branch>`.
-
-
 [[global_capabilities]]
 Global Capabilities
 -------------------
@@ -1176,6 +1140,13 @@
 Below you find a list of capabilities available:
 
 
+[[capability_accessDatabase]]
+Access Database
+~~~~~~~~~~~~~~~
+
+Allow users to access the database using the `gsql` command.
+
+
 [[capability_administrateServer]]
 Administrate Server
 ~~~~~~~~~~~~~~~~~~~
@@ -1238,6 +1209,14 @@
 you need the <<capability_viewCaches,view caches capability>>.
 
 
+[[capability_generateHttpPassword]]
+Generate HTTP Password
+~~~~~~~~~~~~~~~~~~~~~~
+
+Allow the user to generate HTTP passwords for other users.  Typically this would
+be assigned to a non-interactive users group.
+
+
 [[capability_kill]]
 Kill Task
 ~~~~~~~~~
@@ -1283,8 +1262,8 @@
 
 Allow site administrators to configure the query limit for users to
 be above the default hard-coded value of 500.  Administrators can add
-a global block to `All-Projects` with group(s) that
-should have different limits:
+a global block to `All-Projects` with group(s) that should have different
+limits.
 
 When applying a query limit to a user the largest value granted by
 any of their groups is used.
@@ -1293,11 +1272,25 @@
 command, but also to the web UI results pagination size.
 
 
-[[capability_accessDatabase]]
-Access Database
-~~~~~~~~~~~~~~~
+[[capability_runAs]]
+Run As
+~~~~~~
 
-Allow users to access the database using the `gsql` command.
+Allow users to impersonate any other user with the `X-Gerrit-RunAs`
+HTTP header on REST API calls, or the link:cmd-suexec.html[suexec]
+SSH command.
+
+When impersonating an administrator the Administrate Server capability
+is not honored.  This security feature tries to prevent a role with
+Run As capability from modifying the access controls in All-Projects,
+however modification may still be possible if the impersonated user
+has permission to push or submit changes on `refs/meta/config`.  Run
+As also blocks using most capabilities including Create User, Run
+Garbage Collection, etc., unless the capability is also explicitly
+granted to a group the administrator is a member of.
+
+Administrators do not automatically inherit this capability; it must
+be explicitly granted.
 
 
 [[capability_runGC]]
@@ -1308,14 +1301,6 @@
 all projects.
 
 
-[[capability_startReplication]]
-Start Replication
-~~~~~~~~~~~~~~~~~
-
-Allow access to execute `replication start` command, if the
-replication plugin is installed on the server.
-
-
 [[capability_streamEvents]]
 Stream Events
 ~~~~~~~~~~~~~
diff --git a/Documentation/asciidoc.conf b/Documentation/asciidoc.conf
deleted file mode 100644
index 2fe6213..0000000
--- a/Documentation/asciidoc.conf
+++ /dev/null
@@ -1,29 +0,0 @@
-[attributes]
-asterisk=&#42;
-plus=&#43;
-caret=&#94;
-startsb=&#91;
-endsb=&#93;
-tilde=&#126;
-
-[specialsections]
-GERRIT=gerrituplink
-
-[gerrituplink]
-<hr style="
-  height: 2px;
-  color: silver;
-  margin-top: 1.2em;
-  margin-bottom: 0.5em;
-">
-
-[macros]
-(?u)^(?P<name>get)::(?P<target>\S*?)$=#
-
-[get-blockmacro]
-<a id="{target}" onmousedown="javascript:
-  var i =  document.URL.lastIndexOf('/Documentation/');
-  var url = document.URL.substring(0, i) + '{target}';
-  document.getElementById('{target}').href = url;">
-    GET {target} HTTP/1.0
-</a>
diff --git a/Documentation/asciidoc.defs b/Documentation/asciidoc.defs
new file mode 100644
index 0000000..44313d2
--- /dev/null
+++ b/Documentation/asciidoc.defs
@@ -0,0 +1,67 @@
+# 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.
+
+def genasciidoc(
+    name,
+    out,
+    srcs = [],
+    deps = [],
+    attributes = [],
+    backend = None,
+    visibility = []):
+  EXPN = '.expn'
+
+  asciidoc = [
+      'cd $SRCDIR;',
+      '$(exe //lib/asciidoctor:asciidoc)',
+      '-z', '$OUT',
+      '--in-ext', '".txt%s"' % EXPN,
+      '--out-ext', '".html"',
+  ]
+  if backend:
+    asciidoc.extend(['-b', backend])
+  for attribute in attributes:
+    asciidoc.extend(['-a', attribute])
+  asciidoc.append('$SRCS')
+  newsrcs = ["doc.css"]
+  newdeps = deps + ['//lib/asciidoctor:asciidoc']
+
+  for src in srcs:
+    tx = []
+    fn = src
+    if fn.startswith('BUCKGEN:') :
+      fn = src[8:]
+      tx = [':' + fn]
+    ex = fn + EXPN
+
+    genrule(
+      name = ex,
+      cmd = '$(exe :replace_macros) --suffix=' + EXPN +
+            ' -s $SRCDIR/%s' % fn +
+            ' -o $OUT',
+      srcs = [src],
+      deps = tx + [':replace_macros'],
+      out = ex,
+    )
+    newdeps.append(':' + ex)
+    newsrcs.append(genfile(ex))
+
+  genrule(
+    name = name,
+    cmd = ' '.join(asciidoc),
+    srcs = newsrcs,
+    deps = newdeps,
+    out = out,
+    visibility = visibility,
+  )
diff --git a/Documentation/cmd-cherry-pick.txt b/Documentation/cmd-cherry-pick.txt
index d051a9a..15a8524 100644
--- a/Documentation/cmd-cherry-pick.txt
+++ b/Documentation/cmd-cherry-pick.txt
@@ -39,7 +39,7 @@
 ====
   $ scp -p -P 29418 john.doe@review.example.com:bin/gerrit-cherry-pick ~/bin/
 
-  $ curl -o ~/bin/gerrit-cherry-pick http://review.example.com/tools/bin/gerrit-cherry-pick
+  $ curl -Lo ~/bin/gerrit-cherry-pick http://review.example.com/tools/bin/gerrit-cherry-pick
 ====
 
 GERRIT
diff --git a/Documentation/cmd-create-account.txt b/Documentation/cmd-create-account.txt
index 85b9b56..3ecb764 100644
--- a/Documentation/cmd-create-account.txt
+++ b/Documentation/cmd-create-account.txt
@@ -3,7 +3,7 @@
 
 NAME
 ----
-gerrit create-account - Create a new batch/role account.
+gerrit create-account - Create a new user account.
 
 SYNOPSIS
 --------
@@ -24,6 +24,10 @@
 used for batch/role access, such as from an automated build system
 or event monitoring over link:cmd-stream-events.html[gerrit stream-events].
 
+Note, however, that in this case the account is not implicitly added
+to the 'Non-Interactive Users' group.  The account must be explicitly
+added to the group with the `--group` option.
+
 If LDAP authentication is being used, the user account is created
 without checking the LDAP directory.  Consequently users can be
 created in Gerrit that do not exist in the underlying LDAP directory.
@@ -67,10 +71,11 @@
 
 EXAMPLES
 --------
-Create a new user account called `watcher`:
+Create a new batch/role access user account called `watcher` in
+the 'Non-Interactive Users' group.
 
 ====
-	$ cat ~/.ssh/id_watcher.pub | ssh -p 29418 review.example.com gerrit create-account --ssh-key - watcher
+	$ cat ~/.ssh/id_watcher.pub | ssh -p 29418 review.example.com gerrit create-account --group "'Non-Interactive Users'" --ssh-key - watcher
 ====
 
 GERRIT
diff --git a/Documentation/cmd-create-project.txt b/Documentation/cmd-create-project.txt
index d0e56fd..e3ad834 100644
--- a/Documentation/cmd-create-project.txt
+++ b/Documentation/cmd-create-project.txt
@@ -21,6 +21,7 @@
   [--require-change-id | --id]
   [[--branch <REF> | -b <REF>] ...]
   [--empty-commit]
+  [--max-object-size-limit <N>]
   { <NAME> | --name <NAME> }
 
 DESCRIPTION
@@ -108,6 +109,7 @@
 +
 * FAST_FORWARD_ONLY: produces a strictly linear history.
 * MERGE_IF_NECESSARY: create a merge commit when required.
+* REBASE_IF_NECESSARY: rebase the commit when required.
 * MERGE_ALWAYS: always create a merge commit.
 * CHERRY_PICK: always cherry-pick the commit.
 
@@ -144,6 +146,15 @@
 	Creates an initial empty commit for the Git repository of the
 	project that is newly created.
 
+--max-object-size-limit::
+	Define maximum Git object size for this project. Pushes containing an
+	object larger than this limit will be rejected. This can be used to
+	further limit the global
+  link:config-gerrit.html#receive.maxObjectSizeLimit[receive.maxObjectSizeLimit]
+	and cannot be used to increase that globally set limit.
++
+Common unit suffixes of 'k', 'm', or 'g' are supported.
+
 
 EXAMPLES
 --------
diff --git a/Documentation/cmd-gsql.txt b/Documentation/cmd-gsql.txt
index 7ddc41f..3c1fd31 100644
--- a/Documentation/cmd-gsql.txt
+++ b/Documentation/cmd-gsql.txt
@@ -9,7 +9,7 @@
 --------
 [verse]
 'ssh' -p <port> <host> 'gerrit gsql'
-  [--format {PRETTY | JSON}]
+  [--format {PRETTY | JSON | JSON_SINGLE}]
   [-c QUERY]
 
 DESCRIPTION
@@ -26,6 +26,8 @@
 	for reading by a human on a sufficiently wide terminal.
 	In JSON mode records are output as JSON objects using the
 	column names as the property names, one object per line.
+	In JSON_SINGLE mode the whole result set is output as a
+	single JSON object.
 
 -c::
 	Execute the single query statement supplied, and then exit.
@@ -38,7 +40,8 @@
 
 SCRIPTING
 ---------
-Intended for interactive use only, unless format is JSON.
+Intended for interactive use only, unless format is JSON, or
+JSON_SINGLE.
 
 EXAMPLES
 --------
diff --git a/Documentation/cmd-hook-commit-msg.txt b/Documentation/cmd-hook-commit-msg.txt
index bd602c1..c0c1e6c 100644
--- a/Documentation/cmd-hook-commit-msg.txt
+++ b/Documentation/cmd-hook-commit-msg.txt
@@ -1,17 +1,21 @@
 commit-msg Hook
 ===============
 
+
 NAME
 ----
+
+
 commit-msg - Edit commit messages to insert a `Change-Id` tag.
 
 DESCRIPTION
 -----------
 
+
 A Git hook automatically invoked by `git commit`, and most other
 commit creation tools such as `git citool` or `git gui`.  The Gerrit
 Code Review supplied implementation of this hook is a short shell
-script which automatically inserts a globally unique Change-Id tag
+script which automatically inserts a globally unique `Change-Id` tag
 in the footer of a commit message.  When present, Gerrit uses this
 tag to track commits across cherry-picks and rebases.
 
@@ -40,28 +44,33 @@
 ----
 
 The hook implementation is reasonably intelligent at inserting the
-Change-Id line before any Signed-off-by or Acked-by lines placed
+`Change-Id` line before any `Signed-off-by` or `Acked-by` lines placed
 at the end of the commit message by the author, but if no such
 lines are present then it will just insert a blank line, and add
-the Change-Id at the bottom of the message.
+the `Change-Id` at the bottom of the message.
 
-If a Change-Id line is already present in the message footer, the
-script will do nothing, leaving the existing Change-Id unmodified.
+If a `Change-Id` line is already present in the message footer, the
+script will do nothing, leaving the existing `Change-Id` unmodified.
 This permits amending an existing commit, or allows the user to
 insert the Change-Id manually after copying it from an existing
 change viewed on the web.
 
+The `Change-Id` will not be added if `gerrit.createChangeId` is set
+to `false` in the git config.
+
 OBTAINING
 ---------
-To obtain the 'commit-msg' script use scp, wget or curl to download it
-to your local system from your Gerrit server.
+
+
+To obtain the `commit-msg` script use `scp`, `wget` or `curl` to download
+it to your local system from your Gerrit server.
 
 You can use either of the below commands:
 
 ====
   $ scp -p -P 29418 <your username>@<your Gerrit review server>:hooks/commit-msg <local path to your git>/.git/hooks/
 
-  $ curl -o <local path to your git>/.git/hooks/commit-msg <your Gerrit http URL>/tools/hooks/commit-msg
+  $ curl -Lo <local path to your git>/.git/hooks/commit-msg <your Gerrit http URL>/tools/hooks/commit-msg
 ====
 
 A specific example of this might look something like this:
@@ -70,7 +79,7 @@
 ====
   $ scp -p -P 29418 john.doe@review.example.com:hooks/commit-msg ~/duhproject/.git/hooks/
 
-  $ curl -o ~/duhproject/.git/hooks/commit-msg http://review.example.com/tools/hooks/commit-msg
+  $ curl -Lo ~/duhproject/.git/hooks/commit-msg http://review.example.com/tools/hooks/commit-msg
 ====
 
 Make sure the hook file is executable:
@@ -82,6 +91,7 @@
 SEE ALSO
 --------
 
+
 * link:user-changeid.html[Change-Id Lines]
 * link:http://www.kernel.org/pub/software/scm/git/docs/git-commit.html[git-commit(1)]
 * link:http://www.kernel.org/pub/software/scm/git/docs/githooks.html[githooks(5)]
@@ -89,7 +99,8 @@
 IMPLEMENTATION
 --------------
 
-The hook generates unique Change-Id lines by creating a virtual
+
+The hook generates unique `Change-Id` lines by creating a virtual
 commit object within the local Git repository, and obtaining the
 SHA-1 hash from it.  Like any other Git commit, the following
 properties are included in the computation:
@@ -98,12 +109,14 @@
 * SHA-1 of the parent commit
 * Name, email address, timestamp of the author
 * Name, email address, timestamp of the committer
-* Proposed commit message (before Change-Id was inserted)
+* Proposed commit message (before `Change-Id` was inserted)
 
 Because the names of the tree and parent commit, as well as the
 committer timestamp are included in the hash computation, the output
-Change-Id is sufficiently unique.
+`Change-Id` is sufficiently unique.
 
 GERRIT
 ------
+
+
 Part of link:index.html[Gerrit Code Review]
diff --git a/Documentation/cmd-index.txt b/Documentation/cmd-index.txt
index 780231c..3ba66a8 100644
--- a/Documentation/cmd-index.txt
+++ b/Documentation/cmd-index.txt
@@ -12,8 +12,8 @@
   $ scp -p -P 29418 john.doe@review.example.com:bin/gerrit-cherry-pick ~/bin/
   $ scp -p -P 29418 john.doe@review.example.com:hooks/commit-msg .git/hooks/
 
-  $ curl -o ~/bin/gerrit-cherry-pick http://review.example.com/tools/bin/gerrit-cherry-pick
-  $ curl -o .git/hooks/commit-msg http://review.example.com/tools/hooks/commit-msg
+  $ curl -Lo ~/bin/gerrit-cherry-pick http://review.example.com/tools/bin/gerrit-cherry-pick
+  $ curl -Lo .git/hooks/commit-msg http://review.example.com/tools/hooks/commit-msg
 
 For more details on how to determine the correct SSH port number,
 see link:user-upload.html#test_ssh[Testing Your SSH Connection].
@@ -60,6 +60,9 @@
 link:cmd-ls-groups.html[gerrit ls-groups]::
 	List groups visible to the caller.
 
+link:cmd-ls-members.html[gerrit ls-members]::
+	List the membership of a group visible to the caller.
+
 link:cmd-ls-projects.html[gerrit ls-projects]::
 	List projects visible to the caller.
 
@@ -97,7 +100,7 @@
 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 
 link:cmd-create-account.html[gerrit create-account]::
-	Create a new batch/role account.
+	Create a new user account.
 
 link:cmd-set-account.html[gerrit set-account]::
 	Change an account's settings.
@@ -120,6 +123,9 @@
 link:cmd-gsql.html[gerrit gsql]::
 	Administrative interface to active database.
 
+link:cmd-set-members.html[gerrit set-members]::
+	Set group members.
+
 link:cmd-set-project-parent.html[gerrit set-project-parent]::
 	Change the project permissions are inherited from.
 
diff --git a/Documentation/cmd-ls-members.txt b/Documentation/cmd-ls-members.txt
new file mode 100644
index 0000000..9814ff2
--- /dev/null
+++ b/Documentation/cmd-ls-members.txt
@@ -0,0 +1,64 @@
+gerrit ls-members
+================
+
+NAME
+----
+gerrit ls-members - Show members of a given group
+
+SYNOPSIS
+--------
+[verse]
+'ssh' -p <port> <host> 'gerrit ls-members GROUPNAME'
+  [--recursive]
+
+DESCRIPTION
+-----------
+Displays the members of the given group, one per line, so long as the given
+group is visible to the user. The users' id, username, full name and email are
+shown tab-separated.
+
+ACCESS
+------
+Any user who has configured an SSH key.
+
+SCRIPTING
+---------
+This command is intended to be used in scripts. Output is either an error
+message or a heading followed by zero or more lines, one for each member of the
+group. If any field is not set, or if the field is the user's full name and the
+name is empty, "n/a" is emitted as the field value.
+
+All non-printable characters (ASCII value 31 or less) are escaped
+according to the conventions used in languages like C, Python, and Perl,
+employing standard sequences like `\n` and `\t`, and `\xNN` for all
+others. In shell scripts, the `printf` command can be used to unescape
+the output.
+
+OPTIONS
+-------
+--recursive::
+	If a member of the group is itself a group, the sub-group's
+	members are included in the list. Otherwise members of any sub-group
+	are not shown and no indication is given that a sub-group is present
+
+EXAMPLES
+--------
+
+List members of the Administrators group:
+=====
+	$ ssh -p 29418 review.example.com gerrit ls-members Administrators
+	id      username  full name    email
+	100000  jim     Jim Bob somebody@example.com
+	100001  johnny  John Smith      n/a
+	100002  mrnoname        n/a     someoneelse@example.com
+=====
+
+List members of a non-existent group:
+=====
+	$ ssh -p 29418 review.example.com gerrit ls-members BadlySpelledGroup
+	Group not found or not visible
+=====
+
+GERRIT
+------
+Part of link:index.html[Gerrit Code Review]
diff --git a/Documentation/cmd-plugin-install.txt b/Documentation/cmd-plugin-install.txt
index 79d1f4a..719c2bc 100644
--- a/Documentation/cmd-plugin-install.txt
+++ b/Documentation/cmd-plugin-install.txt
@@ -41,7 +41,9 @@
 
 --name::
 -n::
-	The name under which the plugin should be installed.
+	The name under which the plugin should be installed. Note: if the plugin
+	provides its own name in the MANIFEST file, then the plugin name from the
+	MANIFEST file has precedence over this option.
 
 EXAMPLES
 --------
diff --git a/Documentation/cmd-review.txt b/Documentation/cmd-review.txt
index 65c21db..70213da 100644
--- a/Documentation/cmd-review.txt
+++ b/Documentation/cmd-review.txt
@@ -11,7 +11,6 @@
 'ssh' -p <port> <host> 'gerrit review'
   [--project <PROJECT> | -p <PROJECT>]
   [--message <MESSAGE> | -m <MESSAGE>]
-  [--force-message]
   [--submit | -s]
   [--abandon | --restore]
   [--publish]
@@ -51,22 +50,6 @@
 	Optional cover letter to include as part of the message
 	sent to reviewers when the approval states are updated.
 
---force-message::
-	Option which allows Gerrit to publish the --message, even
-	when the labels could not be applied due to the change being
-	closed.
-+
-Used by some scripts/CI-systems, where the results (or links
-to the result) are posted as a message after completion of a
-build (often together with a label-change, indicating the success
-of the build).
-+
-If the message is posted successfully, the command will return
-successfully, even if the label could not be changed.
-+
-This option will not force the message to be posted if the command
-fails because the user is not permitted to change the label.
-
 --help::
 -h::
 	Display site-specific usage information, including the
diff --git a/Documentation/cmd-set-members.txt b/Documentation/cmd-set-members.txt
new file mode 100644
index 0000000..7524893
--- /dev/null
+++ b/Documentation/cmd-set-members.txt
@@ -0,0 +1,82 @@
+gerrit set-members
+==================
+
+NAME
+----
+gerrit set-members - Set group members
+
+SYNOPSIS
+--------
+[verse]
+'ssh' -p <port> <host> 'gerrit set-members'
+  [--add USER ...]
+  [--remove USER ...]
+  [--include GROUP ...]
+  [--exclude GROUP ...]
+  [--]
+  <GROUP> ...
+
+DESCRIPTION
+-----------
+Set the group members for the specified groups.
+
+OPTIONS
+-------
+<GROUP>::
+	Required; name of the group for which the members should be set.
+	The members for multiple groups can be set at once by specifying
+	multiple groups.
+
+--add::
+-a::
+	A user that should be added to the specified groups. Multiple
+	users can be added at once by using this option multiple times.
+
+--remove::
+-r::
+	Remove this user from the specified groups. Multiple users can be
+	removed at once by using this option multiple times.
+
+--include::
+-i::
+	A group that should be included to the specified groups. Multiple
+	groups can be included at once by using this option multiple
+	times.
+
+--exclude::
+-e::
+	Exclude this group from the specified groups. Multiple groups can
+	be excluded at once by using this option multiple times.
+
+The `set-members` command is processing the options in the following
+order: `--remove`, `--exclude`, `--add`, `--include`
+
+ACCESS
+------
+Any user who has configured an SSH key.
+
+SCRIPTING
+---------
+This command is intended to be used in scripts.
+
+EXAMPLES
+--------
+
+Add alice and bob, but remove eve from the groups my-committers and
+my-verifiers.
+=====
+	$ ssh -p 29418 review.example.com gerrit set-members \
+	  -a alice@example.com -a bob@example.com \
+	  -r eve@example.com my-committers my-verifiers
+=====
+
+Include the group my-friends into the group my-committers, but
+exclude the included group my-testers from the group my-committers.
+=====
+	$ ssh -p 29418 review.example.com gerrit set-members \
+	  -i my-friends -e my-testers my-committers
+=====
+
+GERRIT
+------
+Part of link:index.html[Gerrit Code Review]
diff --git a/Documentation/cmd-set-project.txt b/Documentation/cmd-set-project.txt
index a0af910..af20006 100644
--- a/Documentation/cmd-set-project.txt
+++ b/Documentation/cmd-set-project.txt
@@ -16,6 +16,7 @@
   [--content-merge <true|false|inherit>]
   [--change-id <true|false|inherit>]
   [--project-state <STATE> | --ps <STATE>]
+  [--max-object-size-limit <N>]
   <NAME>
 
 DESCRIPTION
@@ -56,6 +57,7 @@
 +
 * FAST_FORWARD_ONLY: produces a strictly linear history.
 * MERGE_IF_NECESSARY: create a merge commit when required.
+* REBASE_IF_NECESSARY: rebase the commit when required.
 * MERGE_ALWAYS: always create a merge commit.
 * CHERRY_PICK: always cherry-pick the commit.
 
@@ -93,6 +95,15 @@
 is granted, but all modification operations are disabled.
 * HIDDEN: the project is not visible for those who are not owners
 
+--max-object-size-limit::
+	Define maximum Git object size for this project. Pushes containing an
+	object larger than this limit will be rejected. This can be used to
+	further limit the global
+  link:config-gerrit.html#receive.maxObjectSizeLimit[receive.maxObjectSizeLimit]
+	and cannot be used to increase that globally set limit.
++
+Common unit suffixes of 'k', 'm', or 'g' are supported.
+
 EXAMPLES
 --------
 Change project `example` to be hidden, require change id, don't use content merge
@@ -105,4 +116,4 @@
 
 GERRIT
 ------
-Part of link:index.html[Gerrit Code Review]
\ No newline at end of file
+Part of link:index.html[Gerrit Code Review]
diff --git a/Documentation/cmd-show-caches.txt b/Documentation/cmd-show-caches.txt
index 126b2a0..d426508 100644
--- a/Documentation/cmd-show-caches.txt
+++ b/Documentation/cmd-show-caches.txt
@@ -25,6 +25,10 @@
 	operating system, and other details about the environment
 	that Gerrit Code Review is running in.
 
+--width::
+-w::
+	Width of the output table.
+
 ACCESS
 ------
 Caller must be a member of the privileged 'Administrators' group,
diff --git a/Documentation/cmd-show-connections.txt b/Documentation/cmd-show-connections.txt
index 8404a97..ab9fadf 100644
--- a/Documentation/cmd-show-connections.txt
+++ b/Documentation/cmd-show-connections.txt
@@ -32,6 +32,11 @@
 -n::
 	Show client hostnames as IP addresses instead of DNS hostname.
 
+--wide::
+-w::
+	Do not format the output to the terminal width (default of
+	80 columns).
+
 DISPLAY
 -------
 
diff --git a/Documentation/cmd-show-queue.txt b/Documentation/cmd-show-queue.txt
index f99e342..4ab3097 100644
--- a/Documentation/cmd-show-queue.txt
+++ b/Documentation/cmd-show-queue.txt
@@ -18,7 +18,7 @@
 Gerrit contains an internal scheduler, similar to cron, that it
 uses to queue and dispatch both short and long term activity.
 
-Tasks that are completed or cancelled exit the queue very quickly
+Tasks that are completed or canceled exit the queue very quickly
 once they enter this state, but it can be possible to observe tasks
 in these states.
 
@@ -37,6 +37,13 @@
 ---------
 Intended for interactive use only.
 
+OPTIONS
+-------
+--wide::
+-w::
+	Do not format the output to the terminal width (default of
+	80 columns).
+
 DISPLAY
 -------
 
diff --git a/Documentation/cmd-stream-events.txt b/Documentation/cmd-stream-events.txt
index 6da0ef0..2a3265e 100644
--- a/Documentation/cmd-stream-events.txt
+++ b/Documentation/cmd-stream-events.txt
@@ -14,7 +14,7 @@
 -----------
 
 Provides a portal into the major events occurring on the server,
-outputing activity data in real-time to the client.  Events are
+outputting activity data in real-time to the client.  Events are
 filtered by the caller's access permissions, ensuring the caller
 only receives events for changes they can view on the web, or in
 the project repository.
@@ -52,6 +52,7 @@
 Note that any field may be missing in the JSON messages, so consumers of
 this JSON stream should deal with that appropriately.
 
+[[events]]
 Events
 ~~~~~~
 Patchset Created
@@ -70,7 +71,7 @@
 
 change:: link:json.html#change[change attribute]
 
-patchset:: link:json.html#patchSet[patchset attribute]
+patchSet:: link:json.html#patchSet[patchSet attribute]
 
 uploader:: link:json.html#account[account attribute]
 
@@ -148,10 +149,19 @@
 
 change:: link:json.html#change[change attribute]
 
-patchset:: link:json.html#patchSet[patchset attribute]
+patchSet:: link:json.html#patchSet[patchSet attribute]
 
 reviewer:: link:json.html#account[account attribute]
 
+Topic Changed
+^^^^^^^^^^^^^
+type:: "topic-changed"
+
+change:: link:json.html#change[change attribute]
+
+changer:: link:json.html#account[account attribute]
+
+oldTopic:: Topic name before it was changed.
 
 SEE ALSO
 --------
diff --git a/Documentation/cmd-suexec.txt b/Documentation/cmd-suexec.txt
index baffd53..78fc361 100644
--- a/Documentation/cmd-suexec.txt
+++ b/Documentation/cmd-suexec.txt
@@ -19,10 +19,14 @@
 
 DESCRIPTION
 -----------
-The suexec command can only be invoked by the magic user `Gerrit
-Code Review` and permits executing any other command as any other
+The suexec command permits executing any other command as any other
 registered user account.
 
+suexec can only be invoked by the magic user `Gerrit Code Review`,
+or any user granted granted the link:access-control.html#capability_runAs[Run As]
+capability. The run as capability is permitted to be used only if
+link:config-gerrit.html[auth.enableRunAs] is true.
+
 OPTIONS
 -------
 
@@ -39,7 +43,8 @@
 ACCESS
 ------
 Caller must be the magic user Gerrit Code Review using the SSH
-daemon's host key or a key on this daemon's peer host key ring.
+daemon's host key, or a key on this daemon's peer host key ring,
+or a user granted the Run As capability.
 
 SCRIPTING
 ---------
diff --git a/Documentation/cmd-version.txt b/Documentation/cmd-version.txt
index d1f94ea..aa08848 100644
--- a/Documentation/cmd-version.txt
+++ b/Documentation/cmd-version.txt
@@ -1,5 +1,5 @@
 gerrit version
-================
+==============
 
 NAME
 ----
diff --git a/Documentation/config-auto-site-initialization.txt b/Documentation/config-auto-site-initialization.txt
new file mode 100644
index 0000000..4c204fd
--- /dev/null
+++ b/Documentation/config-auto-site-initialization.txt
@@ -0,0 +1,82 @@
+Gerrit Code Review - Automatic Site Initialization on Startup
+=============================================================
+
+Description
+-----------
+
+Gerrit supports automatic site initialization on server startup
+when Gerrit runs in a servlet container. Both creation of a new site
+and upgrade of an existing site are supported. Installation of
+plugins during the site creation/initialization is not yet supported.
+
+This feature may be useful for such setups where Gerrit administrators
+don't have direct access to the database and the file system of the
+server where Gerrit should be deployed and, therefore, cannot perform
+the init from their local machine prior to deploying Gerrit on such a
+server. It may also make deployment and testing in a local servlet
+container faster to setup as the init step could be skipped.
+
+Gerrit Configuration
+--------------------
+
+The site initialization will be performed only if the `gerrit.init`
+system property exists (the value of the property is not used, only the
+existence of the property matters).
+
+If the `gerrit.site_path` system property is defined then the init is
+run for that site. The database connectivity, in that case, is defined
+in the `etc/gerrit.config`.
+
+If `gerrit.site_path` is not defined then Gerrit will try to find an
+existing site by looking into the `system_config` table in the database
+defined via the `jdbc/ReviewDb` JNDI property. If the `system_config`
+table exists then the `site_path` from that table is used for the
+initialization. The database connectivity is defined by the
+`jdbc/ReviewDb` JNDI property.
+
+Finally, if neither the `gerrit.site_path` property nor the
+`system_config` table exists, the `gerrit.init_path` system property,
+if defined, will be used to determine the site path. The database
+connectivity, also for this case, is defined by the `jdbc/ReviewDb`
+JNDI property.
+
+Example 1
+~~~~~~~~~
+
+Prepare Tomcat so that a site is initialized at a given path using
+the H2 database (if the site doesn't exist yet) or using whatever
+database is defined in `etc/gerrit.config` of that site:
+
+----
+  $ export CATALINA_OPTS='-Dgerrit.init -Dgerrit.site_path=/path/to/site'
+  $ catalina.sh start
+----
+
+Example 2
+~~~~~~~~~
+
+Prepare Tomcat so that an existing site with the path defined in the
+`system_config` table is initialized (upgraded) on Gerrit startup. The
+assumption is that the `jdbc/ReviewDb` JNDI property is defined in
+Tomcat:
+
+----
+  $ export CATALINA_OPTS='-Dgerrit.init'
+  $ catalina.sh start
+----
+
+Example 3
+~~~~~~~~~
+
+Assuming the database schema doesn't exist in the database defined
+via the `jdbc/ReviewDb` JNDI property, initialize a new site using that
+database and a given path:
+
+----
+  $ export CATALINA_OPTS='-Dgerrit.init -Dgerrit.init_path=/path/to/site'
+  $ catalina.sh start
+----
+
+GERRIT
+------
+Part of link:index.html[Gerrit Code Review]
diff --git a/Documentation/config-gerrit.txt b/Documentation/config-gerrit.txt
index 93492ba..6d00dfa 100644
--- a/Documentation/config-gerrit.txt
+++ b/Documentation/config-gerrit.txt
@@ -119,6 +119,8 @@
 Therefore, the "_LDAP" suffix in the name of this authentication type.
 This authentication type can only be used under hosted daemon mode, and
 the httpd.listenUrl must use https:// as the protocol.
+Optionally, certificate revocation list file can be used
+at <review-site>/etc/crl.pem. For details, see httpd.sslCrl.
 +
 * `LDAP`
 +
@@ -140,8 +142,8 @@
 <<ldap.server,ldap.server>>.  In this configuration the web server
 is not involved in the user authentication process.
 +
-Unlike LDAP above, the username used to perform the LDAP simple bind
-request is the exact string supplied by in the dialog by the user.
+Unlike `LDAP` above, the username used to perform the LDAP simple bind
+request is the exact string supplied in the dialog by the user.
 The configured <<ldap.username,ldap.username>> identity is not used to obtain
 account information.
 +
@@ -165,7 +167,7 @@
 +
 List of permitted OpenID providers.  A user may only authenticate
 with an OpenID that matches this list.  Only used if `auth.type`
-is set to OpenID (the default).
+is set to `OpenID` (the default).
 +
 Patterns may be either a
 link:http://download.oracle.com/javase/6/docs/api/java/util/regex/Pattern.html[standard
@@ -178,7 +180,7 @@
 [[auth.trustedOpenID]]auth.trustedOpenID::
 +
 List of trusted OpenID providers.  Only used if `auth.type` is
-set to OpenID (the default).
+set to `OpenID` (the default).
 +
 In order for a user to take advantage of permissions beyond those
 granted to the `Anonymous Users` and `Registered Users` groups,
@@ -196,7 +198,7 @@
 [[auth.openIdDomain]]auth.openIdDomain::
 +
 List of allowed OpenID email address domains. Only used if
-`auth.type` is set to "OPENID" or "OPENID_SSO".
+`auth.type` is set to `OPENID` or `OPENID_SSO`.
 +
 Domain is case insensitive and must be in the same form as it
 appears in the email address, for example, "example.com".
@@ -245,15 +247,61 @@
 
 [[auth.openIdSsoUrl]]auth.openIdSsoUrl::
 +
-The SSO entry point URL.  Only used if `auth.type` was set to
-OpenID_SSO.
+The SSO entry point URL.  Only used if `auth.type` is set to
+`OpenID_SSO`.
 +
 The "Sign In" link will send users directly to this URL.
 
 [[auth.httpHeader]]auth.httpHeader::
 +
 HTTP header to trust the username from, or unset to select HTTP basic
-or digest authentication.  Only used if `auth.type` is set to HTTP.
+or digest authentication.  Only used if `auth.type` is set to `HTTP`.
+
+[[auth.httpDisplaynameHeader]]auth.httpDisplaynameHeader::
++
+HTTP header to retrieve the user's display name from.  Only used if `auth.type`
+is set to `HTTP`.
++
+If set, Gerrit trusts and enforces the user's full name using the HTTP header
+and disables the ability to manually modify the user's full name
+from the contact information page.
+
+[[auth.httpEmailHeader]]auth.httpEmailHeader::
++
+HTTP header to retrieve the user's e-mail from.  Only used if `auth.type`
+is set to `HTTP`.
++
+If set, Gerrit trusts and enforces the user's e-mail using the HTTP header
+and disables the ability to manually modify or register other e-mails
+from the contact information page.
+
+[[auth.loginUrl]]auth.loginUrl::
++
+URL to redirect a browser to after the end-user has clicked on the
+login link in the upper right corner. Only used if `auth.type` is set
+to `HTTP` or `HTTP_LDAP`.
+Organizations using an enterprise single-sign-on solution may want to
+redirect the browser to the SSO product's sign-in page for completing the
+login process and validate their credentials.
++
+If set, Gerrit allows anonymous access until the end-user performs the login
+and provides a trusted identity through the HTTP header.
+If not set, Gerrit requires the HTTP header with a trusted identity
+and returns the error page 'LoginRedirect.html' if such a header is not
+present.
+
+[[auth.loginText]]auth.loginText::
++
+Text displayed in the loginUrl link. Only used if `auth.loginUrl` is set.
++
+If not set, the "Sign In" text is used.
+
+[[auth.registerPageUrl]]auth.registerPageUrl::
++
+URL of the registration page to use when a new user logs in to Gerrit for
+the first time. Used only when `auth.type` is set to `HTTP`.
++
+If not set, the standard Gerrit registration page `/#/register/` is displayed.
 
 [[auth.logoutUrl]]auth.logoutUrl::
 +
@@ -267,14 +315,14 @@
 [[auth.registerUrl]]auth.registerUrl::
 +
 Target for the "Register" link in the upper right corner.  Used only
-when auth.type is `LDAP`.
+when `auth.type` is `LDAP`.
 +
 If not set, no "Register" link is displayed.
 
 [[auth.registerText]]auth.registerText::
 +
 Text for the "Register" link in the upper right corner.  Used only
-when auth.type is `LDAP`.
+when `auth.type` is `LDAP`.
 +
 If not set, defaults to "Register".
 
@@ -285,9 +333,19 @@
 
 [[auth.httpPasswordUrl]]auth.httpPasswordUrl::
 +
-Target for the "Obtain Password" link.  Used only when auth.type is
+Target for the "Obtain Password" link.  Used only when `auth.type` is
 `LDAP`, `LDAP_BIND` or `CUSTOM_EXTENSION`.
+
+[[auth.switchAccountUrl]]auth.switchAccountUrl::
 +
+URL to switch user identities and login as a different account than
+the currently active account.  This is disabled by default except when
+`auth.type` is `OPENID` and `DEVELOPMENT_BECOME_ANY_ACCOUNT`.  If set
+the "Switch Account" link is displayed next to "Sign Out".
++
+When `auth.type` does not normally enable this URL administrators may
+set this to `login/` or `$canonicalWebUrl/login`, allowing users to
+begin a new web session.
 
 [[auth.cookiePath]]auth.cookiePath::
 +
@@ -305,7 +363,7 @@
 [[auth.emailFormat]]auth.emailFormat::
 +
 Optional format string to construct user email addresses out of
-user login names.  Only used if auth.type is `HTTP`, `HTTP_LDAP`
+user login names.  Only used if `auth.type` is `HTTP`, `HTTP_LDAP`
 or `LDAP`.
 +
 This value can be set to a format string, where `{0}` is replaced
@@ -330,6 +388,10 @@
 more agreements.
 +
 By default this is false (no agreements are used).
++
+To enable the actual usage of contributor agreement the project
+specific config option in the `project.config` must be set:
+link:config-project-config.html[receive.requireContributorAgreement].
 
 auth.allowGoogleAccountUpgrade::
 +
@@ -390,6 +452,18 @@
 +
 By default this is set to false.
 
+[[auth.enableRunAs]]auth.enableRunAs::
++
+If true HTTP REST APIs will accept the `X-Gerrit-RunAs` HTTP request
+header from any users granted the link:access-control.html#capability_runAs[Run As]
+capability. The header and capability permit the authenticated user
+to impersonate another account.
++
+If false the feature is disabled and cannot be re-enabled without
+editing gerrit.config and restarting the server.
++
+Default is true.
+
 [[cache]]Section cache
 ~~~~~~~~~~~~~~~~~~~~~~
 
@@ -497,7 +571,7 @@
 cache `"adv_bases"`::
 +
 Used only for push over smart HTTP when branch level access controls
-are enabled.  The cache entry contains all commits that are avaliable
+are enabled.  The cache entry contains all commits that are available
 for the client to use as potential delta bases.  Push over smart HTTP
 requires two HTTP requests, and this cache tries to carry state from
 the first request into the second to ensure it can complete.
@@ -671,7 +745,7 @@
 Boolean to enable or disable the computation of intraline differences
 when populating a diff cache entry.  This flag is provided primarily
 as a backdoor to disable the intraline difference feature if
-necessary.  To maintain backwards compatability with prior versions,
+necessary.  To maintain backwards compatibility with prior versions,
 this setting will fallback to `cache.diff.intraline` if not set in the
 configuration.
 +
@@ -693,6 +767,28 @@
 +
 Default is 5 minutes.
 
+[[change]]Section change
+~~~~~~~~~~~~~~~~~~~~~~~~
+
+[[change.updateDelay]]change.updateDelay::
++
+How often in seconds the web interface should poll for updates to the
+currently open change.  The poller relies on the client's browser
+cache to use If-Modified-Since and respect `304 Not Modified` HTTP
+reponses.  This allows for fast polls, often under 8 milliseconds.
++
+With a configured 30 second delay a server with 4900 active users will
+typically need to dedicate 1 CPU to the update check.  4900 users
+divided by an average delay of 30 seconds is 163 requests arriving per
+second.  If requests are served at ~6 ms response time, 1 CPU is
+necessary to keep up with the update request traffic.  On a smaller
+user base of 500 active users, the default 30 second delay is only 17
+requests per second and requires ~10% CPU.
++
+If 0 the update polling is disabled.
++
+Default is 30 seconds.
+
 [[changeMerge]]Section changeMerge
 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 
@@ -843,6 +939,13 @@
 values are configured, they are passed in order on the command line,
 separated by spaces.  These options are appended onto 'JAVA_OPTIONS'.
 
+For example, it is possible to overwrite Gerrit's default log4j
+configuration:
+
+----
+  javaOptions = -Dlog4j.configuration=file:///home/gerrit/site/etc/log4j.properties
+----
+
 [[container.slave]]container.slave::
 +
 Used on Gerrit slave installations. If set to true the Gerrit JVM is
@@ -923,7 +1026,7 @@
 Largest object size, in bytes, that JGit will allocate as a
 contiguous byte array.  Any file revision larger than this threshold
 will have to be streamed, typically requiring the use of temporary
-files under '$GIT_DIR/objects' to implement psuedo-random access
+files under '$GIT_DIR/objects' to implement pseudo-random access
 during delta decompression.
 +
 Servers with very high traffic should set this to be larger than
@@ -948,7 +1051,7 @@
 can be made by the JVM native code.
 +
 In server applications (such as Gerrit) that need to access many
-pack files, setting this to true risks artifically running out
+pack files, setting this to true risks artificially running out
 of virtual address space, as the garbage collector cannot reclaim
 unused mapped spaces fast enough.
 +
@@ -1235,6 +1338,20 @@
 by the system administrator, and might not even be running on the
 same host as Gerrit.
 
+[[gerrit.installCommitMsgHookCommand]]gerrit.installCommitMsgHookCommand::
++
+Optional command to install the `commit-msg` hook. Typically of the
+form:
+----
+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,
+or curl from the canonical HTTP URL for the server.  Only necessary if a
+proxy or other server/network configuration prevents clients from
+fetching from the default location.
+
 [[gerrit.gitHttpUrl]]gerrit.gitHttpUrl::
 +
 Optional base URL for repositories available over the HTTP
@@ -1252,6 +1369,11 @@
 Code Review's own bug tracker but could be directed to the system
 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
 ~~~~~~~~~~~~~~~~~~~~~~~~
 
@@ -1342,6 +1464,19 @@
 +
 Valid values are the characters '*', '(' and ')'.
 
+[[gitweb.linkDrafts]]gitweb.urlEncode::
++
+Whether or not Gerrit should encode the generated viewer URL.
++
+Gerrit composes the viewer URL using information about the project, branch, file
+or commit of the target object to be displayed. Typically viewers such as CGit
+and GitWeb do need those parts to be encoded, including the '/' in project's name,
+for being correctly parsed.
+However other viewers could instead require an unencoded URL (e.g. GitHub web
+based viewer)
++
+Valid values are "true" and "false," default is "true."
+
 [[gitweb.linkDrafts]]gitweb.linkDrafts::
 +
 Whether or not Gerrit should provide links to gitweb on draft patch sets.
@@ -1350,7 +1485,7 @@
 only allows publicly viewable references, set this to false to remove
 the links to draft patch sets from the change review screen.
 +
-Valid values are "true" and "false," default is "true."
+Valid values are "true" and "false," default is "true".
 
 [[groups]]Section groups
 ~~~~~~~~~~~~~~~~~~~~~~~~
@@ -1416,6 +1551,11 @@
 Optional filename for the reviewer added hook, if not specified then
 `reviewer-added` will be used.
 
+[[hooks.topicChangedHook]]hooks.topicChangedHook::
++
+Optional filename for the topic changed hook, if not specified then
+`topic-changed` will be used.
+
 [[hooks.claSignedHook]]hooks.claSignedHook::
 +
 Optional filename for the CLA signed hook, if not specified then
@@ -1535,6 +1675,23 @@
 By default, 16384 (16 K), which is sufficient for most OpenID and
 other web-based single-sign-on integrations.
 
+[[httpd.sslCrl]]httpd.sslCrl::
++
+Path of the certificate revocation list file in PEM format. This
+crl file is optional, and available for CLIENT_SSL_CERT_LDAP
+authentication.
++
+To create and view a crl using openssl:
++
+----
+openssl ca -gencrl -out crl.pem
+openssl crl -in crl.pem -text
+----
++
+If not absolute, the path is resolved relative to `$site_path`.
++
+By default, `$site_path/etc/crl.pem`.
+
 [[httpd.sslKeyStore]]httpd.sslKeyStore::
 +
 Path of the Java keystore containing the server's SSL certificate
@@ -1582,7 +1739,7 @@
 +
 Minimum number of spare threads to keep in the worker thread pool.
 This number must be at least 1 larger than httpd.acceptorThreads
-multipled by the number of httpd.listenUrls configured.
+multiplied by the number of httpd.listenUrls configured.
 +
 By default, 5, suitable for most lower-volume traffic sites.
 
@@ -1623,13 +1780,81 @@
 +
 By default, 5 minutes.
 
+[[httpd.filterClass]]httpd.filterClass::
++
+Class that implements the javax.servlet.Filter interface
+for filtering any HTTP related traffic going through the Gerrit
+HTTP protocol.
+Class is loaded and configured in the Gerrit Jetty container
+and run in front of all Gerrit URL handlers, allowing the filter
+to inspect, modify, allow or reject each request.
+It needs to be provided as JAR library
+under $GERRIT_SITE/lib as it is resolved using the default Gerrit class
+loader and cannot be dynamically loaded by a plugin.
++
+Failing to load the Filter class would result in a Gerrit start-up
+failure, as this class is supposed to provide mandatory filtering
+in front of Gerrit HTTP protocol.
++
+Typical usage is in conjunction with the `auth.type=HTTP` as replacement
+of an Apache HTTP proxy layer as security enforcement on top of Gerrit
+by returning a trusted username as HTTP Header.
++
+Example of using a security library secure.jar under $GERRIT_SITE/lib
+that provides a org.anyorg.MySecureFilter Servlet Filter that enforces
+a trusted username in the `TRUSTED_USER` HTTP Header:
+
+----
+[auth]
+	type = HTTP
+	httpHeader = TRUSTED_USER
+
+[http]
+	filterClass = org.anyorg.MySecureFilter
+----
+
+[[httpd.robotsFile]]httpd.robotsFile::
++
+Location of an external robots.txt file to be used instead of the one
+bundled with the .war of the application.
++
+If not absolute, the path is resolved relative to `$site_path`.
++
+If the file doesn't exist or can't be read the default robots.txt file
+bundled with the .war will be used instead.
+
+[[index]]Section index
+~~~~~~~~~~~~~~~~~~~~~~
+
+The index section configures the secondary index.
+
+[[index.type]]index.type::
++
+Type of secondary indexing employed by Gerrit.  The supported
+values are:
++
+* `LUCENE`
++
+A link:http://lucene.apache.org/[Lucene] index is used.
++
+* `SOLR`
++
+A link:http://lucene.apache.org/solr/[Solr] index is used.
++
+* `SQL`
++
+No secondary index.  Not all query operators are supported.  Other
+query operators are routed through the standard SQL query engine.
+
++
+By default, `SQL`.
 
 [[ldap]]Section ldap
 ~~~~~~~~~~~~~~~~~~~~
 
 LDAP integration is only enabled if `auth.type` is set to
 `HTTP_LDAP`, `LDAP` or `CLIENT_SSL_CERT_LDAP`.  See above for a
-detailed description of the auth.type settings and their
+detailed description of the `auth.type` settings and their
 implications.
 
 An example LDAP configuration follows, and then discussion of
@@ -1658,7 +1883,7 @@
 and group membership from.  Must be of the form `ldap://host` or
 `ldaps://host` to bind with either a plaintext or SSL connection.
 +
-If auth.type is `LDAP` this setting should use `ldaps://` to
+If `auth.type` is `LDAP` this setting should use `ldaps://` to
 ensure the end user's plaintext password is transmitted only over
 an encrypted connection.
 
@@ -1720,9 +1945,9 @@
 +
 Query pattern to use when searching for a user account.  This may be
 any valid LDAP query expression, including the standard `(&...)` and
-`(|...)` operators.  If auth.type is `HTTP_LDAP` then the variable
+`(|...)` operators.  If `auth.type` is `HTTP_LDAP` then the variable
 `${username}` is replaced with a parameter set to the username
-that was supplied by the HTTP server.  If auth.type is `LDAP` then
+that was supplied by the HTTP server.  If `auth.type` is `LDAP` then
 the variable `${username}` is replaced by the string entered by
 the end user.
 +
@@ -1834,7 +2059,7 @@
 account is currently a member of.  This may be any valid LDAP query
 expression, including the standard `(&...)` and `(|...)` operators.
 +
-If auth.type is `HTTP_LDAP` then the variable `${username}` is
+If `auth.type` is `HTTP_LDAP` then the variable `${username}` is
 replaced with a parameter set to the username that was supplied
 by the HTTP server.  Other variables appearing in the pattern,
 such as `${fooBarAttribute}`, are replaced with the value of the
@@ -1905,7 +2130,7 @@
 Note the `renewTGT` property to make sure the TGT does not expire,
 and `useTicketCache` to use the TGT supplied by the operating system. As
 the whole point of using GSSAPI is to have passwordless authentication
-to the LDAP service, this option does not aquire a new TGT on its own.
+to the LDAP service, this option does not acquire a new TGT on its own.
 
 On Windows servers the registry key `HKEY_LOCAL_MACHINE\System\CurrentControlSet\Control\Lsa\Kerberos\Parameters`
 must have the DWORD value `allowtgtsessionkey` set to 1 and the account must not
@@ -2042,6 +2267,11 @@
 Gerrit administrators can use this setting to prevent developers
 from pushing objects which are too large to Gerrit.
 +
+This setting can also be set in the `project.config`
+link:config-project-config.html[receive.maxObjectSizeLimit] in order
+to further reduce the global setting. The project specific setting is
+only honored when it further reduces the global limit.
++
 Default is zero.
 +
 Common unit suffixes of 'k', 'm', or 'g' are supported.
@@ -2062,7 +2292,7 @@
 set update.
 +
 Defaults to 1, using only the main receive thread. This feature is for
-databases with very high latency that can benfit from concurrent
+databases with very high latency that can benefit from concurrent
 operations when multiple changes are impacted at once.
 
 [[receive.timeout]]receive.timeout::
@@ -2073,7 +2303,7 @@
 be specified using standard time unit abbreviations ('ms', 'sec',
 'min', etc.).
 +
-Default is 2 minutes. If no unit is specified, millisconds
+Default is 2 minutes. If no unit is specified, milliseconds
 is assumed.
 
 
@@ -2128,7 +2358,7 @@
 * `USER`
 +
 Gerrit will set the From header to use the current user's
-Full Name and Preferred Email.  This may cause messsages to be
+Full Name and Preferred Email.  This may cause messages to be
 classified as spam if the user's domain has SPF or DKIM enabled
 and <<sendemail.smtpServer,sendemail.smtpServer>> is not a trusted
 relay for that domain.
@@ -2262,28 +2492,6 @@
 and text results for changes. If false, the URL is disabled and
 returns 404 to clients. Default is true, enabling `/query`.
 
-[[site.upgradeSchemaOnStartup]]site.upgradeSchemaOnStartup::
-+
-Control whether schema upgrade should be done on Gerrit startup. The following
-values are supported:
-+
-* `OFF`
-+
-No automatic schema upgrade on startup.
-+
-* `AUTO`
-+
-Perform schema migration on startup, if necessary.  If, as a result of
-schema migration, there would be any unused database objects they will
-be dropped automatically.
-+
-* `AUTO_NO_PRUNE`
-+
-Like `AUTO` but unused database objects will not be pruned.
-
-+
-The default is `OFF`.
-
 [[ssh-alias]] Section ssh-alias
 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 
@@ -2376,7 +2584,7 @@
 +
 If the number of threads requested for non-interactive users is larger
 than the total number of threads allocated in sshd.threads, then the
-value of sshd.threads is increased to accomodate the requested value.
+value of sshd.threads is increased to accommodate the requested value.
 +
 By default, 0.
 
@@ -2498,6 +2706,13 @@
 +
 By default, `host/canonical.host.name`
 
+[[sshd.requestLog]]sshd.requestLog::
++
+Enable (or disable) the `'$site_path'/logs/sshd_log` request log.
+If enabled, a request log file is written out by the SSH daemon.
++
+By default, true.
+
 [[suggest]] Section suggest
 ~~~~~~~~~~~~~~~~~~~~~~~~~~~
 
@@ -2609,14 +2824,32 @@
   backgroundColor = 00FFFF
 ----
 
+As example, here is the theme configuration to have the old green look:
+
+----
+[theme]
+  backgroundColor = FCFEEF
+  textColor = 000000
+  trimColor = D4E9A9
+  selectionColor = FFFFCC
+  topMenuColor = D4E9A9
+  changeTableOutdatedColor = F08080
+[theme "signed-in"]
+  backgroundColor = FFFFFF
+----
+
 [[trackingid]] Section trackingid
 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 
 Tagged footer lines containing references to external
 tracking systems, parsed out of the commit message and
-saved in Gerrit's database.  After making changes to
-this section, existing changes must be reindexed with the
-link:pgm-ScanTrackingIds.html[ScanTrackingIds] program.
+saved in Gerrit's database.
+
+After making changes to this section, existing changes
+must be reindexed with link:pgm-reindex.html[reindex]
+if index.type is `LUCENE` or `SOLR`; or with
+link:pgm-ScanTrackingIds.html[ScanTrackingIds] if index.type
+is unset or `SQL`.
 
 The tracking ids are searchable using tr:<tracking id> or
 bug:<tracking id>.
@@ -2722,7 +2955,7 @@
 
 [[user.anonymousCoward]]user.anonymousCoward::
 +
-Username that this displayed in the Gerrit WebUI and in e-mail
+Username that is displayed in the Gerrit WebUI and in e-mail
 notifications if the full name of the user is not set.
 +
 By default "Anonymous Coward" is used.
diff --git a/Documentation/config-gitweb.txt b/Documentation/config-gitweb.txt
index e5edda8..7ba15b8 100644
--- a/Documentation/config-gitweb.txt
+++ b/Documentation/config-gitweb.txt
@@ -116,7 +116,7 @@
 # logo to use
 $logo = "git-logo.png";
 
-# the ‘favicon’
+# the favicon
 $favicon = "git-favicon.png";
 ----
 
diff --git a/Documentation/config-hooks.txt b/Documentation/config-hooks.txt
index 1236077..5875837 100644
--- a/Documentation/config-hooks.txt
+++ b/Documentation/config-hooks.txt
@@ -90,7 +90,7 @@
 Called whenever a change has been abandoned.
 
 ====
-  change-abandoned --change <change id> --change-url <change url> --project <project name> --branch <branch> --topic <topic> --abandoner <abandoner> --reason <reason>
+  change-abandoned --change <change id> --change-url <change url> --project <project name> --branch <branch> --topic <topic> --abandoner <abandoner> --commit <sha1> --reason <reason>
 ====
 
 change-restored
@@ -99,7 +99,7 @@
 Called whenever a change has been restored.
 
 ====
-  change-restored --change <change id> --change-url <change url> --project <project name> --branch <branch> --topic <topic> --restorer <restorer> --reason <reason>
+  change-restored --change <change id> --change-url <change url> --project <project name> --branch <branch> --topic <topic> --restorer <restorer> --commit <sha1> --reason <reason>
 ====
 
 ref-updated
@@ -120,6 +120,15 @@
   reviewer-added --change <change id> --change-url <change url> --project <project name> --branch <branch> --reviewer <reviewer>
 ====
 
+topic-changed
+~~~~~~~~~~~~~
+
+Called whenever a change's topic is changed from the Web UI or via the REST API.
+
+====
+  topic-changed --change <change id> --project <project name> --branch <branch> --changer <changer> --old-topic <old topic> --new-topic <new topic>
+====
+
 cla-signed
 ~~~~~~~~~~
 
diff --git a/Documentation/config-labels.txt b/Documentation/config-labels.txt
index 1ff7e24..c08d484 100644
--- a/Documentation/config-labels.txt
+++ b/Documentation/config-labels.txt
@@ -177,7 +177,7 @@
 
 [[label_abbreviation]]
 `label.Label-Name.abbreviation`
-~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 
 An abbreviated name for a label shown as a compact column header, for
 example on project dashboards. Defaults to all the uppercase characters
@@ -203,6 +203,12 @@
 must be at least one positive value, or else submit will never be
 enabled. To permit blocking submits, ensure a negative value is defined.
 
+* `AnyWithBlock`
++
+The lowest possible negative value, if present, blocks a submit, Any
+other value enables a submit. To permit blocking submits, ensure
+that a negative value is defined.
+
 * `MaxNoBlock`
 +
 The highest possible positive value is required to enable submit, but
@@ -230,6 +236,30 @@
 sticky approvals, reducing turn-around for trivial cleanups prior to
 submitting a change.
 
+[[label_copyAllScoresOnTrivialRebase]]
+`label.Label-Name.copyAllScoresOnTrivialRebase`
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+If true, all scores for the label are copied forward when a new patch
+set is uploaded that is a trivial rebase. A new patch set is considered
+as trivial rebase if the commit message is the same as in the previous
+patch set and if it has the same code delta as the previous patch set.
+This is the case if the change was rebased onto a different parent.
+This can be used to enable sticky approvals, reducing turn-around for
+trivial rebases prior to submitting a change. Defaults to false.
+
+[[label_copyAllScoresIfNoCodeChange]]
+`label.Label-Name.copyAllScoresIfNoCodeChange`
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+If true, all scores for the label are copied forward when a new patch
+set is uploaded that has the same parent commit as the previous patch
+set and the same code delta as the previous patch set. This means only
+the commit message is different. This can be used to enable sticky
+approvals on labels that only depend on the code, reducing turn-around
+if only the commit message is changed prior to submitting a change.
+Defaults to false.
+
 [[label_canOverride]]
 `label.Label-Name.canOverride`
 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
@@ -238,6 +268,30 @@
 configuration for this label in child projects will be ignored. Defaults
 to true.
 
+[[label_branch]]
+`label.Label-Name.branch`
+~~~~~~~~~~~~~~~~~~~~~~~~~
+
+By default a given project's label applicable scope is all changes
+on all branches of this project and its child projects.
+
+Label's applicable scope can be branch specific via configuration.
+E.g. create a label `Video-Qualify` on parent project and configure
+the `branch` as:
+
+====
+  [label "Video-Qualify"]
+      branch = refs/heads/video-1.0/*
+      branch = refs/heads/video-1.1/Kino
+====
+
+Then *only* changes in above branch scope of parent project and child
+projects will be affected by `Video-Qualify`.
+
+NOTE: The `branch` is independent from the branch scope defined in `access`
+parts in `project.config` file. That means from the UI a user can always
+assign permissions for that label on a branch, but this permission is then
+ignored if the label doesn't apply for that branch.
 
 [[label_example]]
 Example
diff --git a/Documentation/config-login-register.txt b/Documentation/config-login-register.txt
index d0e0fc5..867f0d4 100644
--- a/Documentation/config-login-register.txt
+++ b/Documentation/config-login-register.txt
@@ -135,4 +135,9 @@
   git clone ssh://user@localhost:29418/REPOSITORY_NAME.git
 
   user@host:~$
-----
\ No newline at end of file
+----
+
+
+GERRIT
+------
+Part of link:index.html[Gerrit Code Review]
diff --git a/Documentation/config-mail.txt b/Documentation/config-mail.txt
index 8de8e59..3b8bffa 100644
--- a/Documentation/config-mail.txt
+++ b/Documentation/config-mail.txt
@@ -65,6 +65,13 @@
 related to a user editing the commit message through the Gerrit UI.  It is a
 `ChangeEmail`: see `ChangeSubject.vm` and `ChangeFooter.vm`.
 
+Footer.vm
+~~~~~~~~~
+
+The `Footer.vm` template will determine the contents of the footer text
+appended to the end of all outgoing emails after the ChangeFooter and
+CommentFooter.
+
 Merged.vm
 ~~~~~~~~~
 
@@ -83,15 +90,10 @@
 ~~~~~~~~~~~~
 
 The `NewChange.vm` template will determine the contents of the email related
-to a user submitting a new change for review. It is a `ChangeEmail`: see
-`ChangeSubject.vm` and `ChangeFooter.vm`.
-
-RebasedPatchSet.vm
-~~~~~~~~~~~~~~~~~~
-
-The `RebasedPatchSet.vm` template will determine the contents of the email
-related to a user rebasing a patchset for a change through the Gerrit UI.
-It is a `ChangeEmail`: see `ChangeSubject.vm` and `ChangeFooter.vm`.
+to a user submitting a new change for review. This includes changes created
+by actions made by the user in the Web UI such as cherry picking a commit or
+reverting a change.  It is a `ChangeEmail`: see `ChangeSubject.vm` and
+`ChangeFooter.vm`.
 
 RegisterNewEmail.vm
 ~~~~~~~~~~~~~~~~~~~
@@ -103,7 +105,9 @@
 ~~~~~~~~~~~~~~~~~~
 
 The `ReplacePatchSet.vm` template will determine the contents of the email
-related to a user submitting a new patchset for a change.  It is a
+related to a user submitting a new patchset for a change.  This includes
+patchsets created by actions made by the user in the Web UI such as editing
+the commit message, cherry picking a commit, or rebasing a change.  It is a
 `ChangeEmail`: see `ChangeSubject.vm` and `ChangeFooter.vm`.
 
 Restored.vm
diff --git a/Documentation/config-project-config.txt b/Documentation/config-project-config.txt
new file mode 100644
index 0000000..8529b67
--- /dev/null
+++ b/Documentation/config-project-config.txt
@@ -0,0 +1,225 @@
+Gerrit Code Review - Project Configuration File Format
+======================================================
+
+This page explains the storage format of Gerrit's project configuration
+and access control models.
+
+The web UI access control panel is a front end for human-readable
+configuration files under the +refs/meta/config+ namespace in the
+affected project.  Direct manipulation of these files is mainly
+relevant in an automation scenario of the access controls.
+
+
+The +refs/meta/config+ namespace
+--------------------------------
+
+The namespace contains three different files that play different
+roles in the permission model.  With read permission to that reference,
+it is possible to fetch the +refs/meta/config+ reference to a local
+repository.  A nice side effect is that you can also upload changes
+to project permissions and review them just like with regular code
+changes. The preview changes option is also provided on the UI. Please note
+that you will have to configure push rights for the +refs/meta/config+ name
+space if you'd like to use the possibility to automate permission updates.
+
+
+[[file-project_config]]
+The file +project.config+
+-------------------------
+
+The +project.config+ file contains the link between groups and their
+permitted actions on reference patterns in this project and any projects
+that inherit its permissions.
+
+The format in this file corresponds to the Git config file format, so
+if you want to automate your permissions it is a good idea to use the
++git config+ command when writing to the file. This way you know you
+don't accidentally break the format of the file.
+
+Here follows a +git config+ command example:
+
+----
+$ git config -f project.config project.description "Rights inherited by all other projects"
+----
+
+Below you will find an example of the +project.config+ file format:
+
+----
+[project]
+       description = Rights inherited by all other projects
+[access "refs/*"]
+       read = group Administrators
+[capability]
+       administrateServer = group Administrators
+[receive]
+       requireContributorAgreement = false
+----
+
+As you can see, there are several sections.
+
+The link:#project-section[+project+ section] appears once per project.
+
+The link:#access-section[+access+ section] appears once per reference pattern,
+such as `refs/*` or `refs/heads/*`.  Only one access section per pattern is
+allowed.  You will find examples of keys and values in each category section
+<<access_category,below>>.
+
+The link:#receive-section[+receive+ section] appears once per project.
+
+The link:#submit-section[+submit+ section] appears once per project.
+
+The link:#capability-section[+capability+] section only appears once, and only
+in the +All-Projects+ repository.  It controls core features that are configured
+on a global level.  You can find examples of these
+<<capability_category,below>>.
+
+
+[[project-section]]
+Project section
+~~~~~~~~~~~~~~~
+
+The project section includes configuration of project settings.
+
+These are the keys:
+
+- Description
+
+
+[[receive-section]]
+Receive section
+~~~~~~~~~~~~~~~
+
+The receive section includes configuration of project-specific
+receive settings:
+
+[[receive.requireContributorAgreement]]receive.requireContributorAgreement::
++
+Controls whether or not a user must complete a contributor agreement before
+they can upload changes. Default is `INHERIT`. If `All-Project` enables this
+option then the dependent project must set it to false if users are not
+required to sign a contributor agreement prior to submitting changes for that
+specific project. To use that feature the global option in `gerrit.config`
+must be enabled:
+link:config-gerrit.html#auth.contributorAgreements[auth.contributorAgreements].
+
+[[receive.requireSignedOffBy]]receive.requireSignedOffBy::
++
+Sign-off can be a requirement for some projects (for example Linux kernel uses
+it). Sign-off is a line at the end of the commit message which certifies who
+is the author of the commit. Its main purpose is to improve tracking of who
+did  what, especially with patches. Default is `INHERIT`, which means that this
+property is inherited from the parent project.
+
+[[receive.requireChangeId]]receive.requireChangeId::
++
+Controls whether or not the Change-Id must be included in the commit message
+in the last paragraph. Default is `INHERIT`, which means that this property
+is inherited from the parent project.
+
+[[receive.maxObjectSizeLimit]]receive.maxObjectSizeLimit::
++
+Maximum allowed Git object size that receive-pack will accept. If an object
+is larger than the given size the pack-parsing will abort and the push
+operation will fail. If set to zero then there is no limit.
++
+Project owners can use this setting to prevent developers from pushing
+objects which are too large to Gerrit. This setting can also be set it
+`gerrit.config` globally link:config-gerrit.html#receive.maxObjectSizeLimit[
+receive.maxObjectSizeLimit].
++
+The project specific setting in `project.config` is only honored when it
+further reduces the global limit.
++
+Default is zero.
++
+Common unit suffixes of k, m, or g are supported.
+
+[[submit-section]]
+Submit section
+~~~~~~~~~~~~~~
+
+The submit section includes configuration of project-specific
+submit settings:
+
+- 'mergeContent': Defines whether to automatically merge changes.  Valid values
+are 'true', 'false', or 'INHERIT'.  Default is 'INHERIT'.
+
+- 'action': defines the link:project-setup.html#submit_type[submit type].  Valid
+values are 'fast forward only', 'merge if necessary', 'rebase if necessary',
+'merge always' and 'cherry pick'.  The default is 'merge if necessary'.
+
+Merge strategy
+
+
+[[access-section]]
+Access section
+~~~~~~~~~~~~~~
+
+Each +access+ section includes a reference and access rights connected
+to groups.  Each group listed must exist in the link:#file-groups[+groups+ file].
+
+Please refer to the
+link:access-control.html#access_categories[Access Categories]
+documentation for a full list of available access rights.
+
+
+[[capability-section]]
+Capability section
+~~~~~~~~~~~~~~~~~~
+
+The +capability+ section only appears once, and only in the +All-Projects+
+repository.  It controls Gerrit administration capabilities that are configured
+on a global level.
+
+Please refer to the
+link:access-control.html#global_capabilities[Global Capabilities]
+documentation for a full list of available capabilities.
+
+
+[[file-groups]]
+The file +groups+
+-----------------
+
+Each group in this list is linked with its UUID so that renaming of
+groups is possible without having to rewrite every +groups+ file
+in every repository where it's used.
+
+This is what the default groups file for +All-Projects.git+ looks like:
+
+----
+# UUID                                         Group Name
+#
+3d6da7dc4e99e6f6e5b5196e21b6f504fc530bba       Administrators
+global:Anonymous-Users                         Anonymous Users
+global:Project-Owners                          Project Owners
+global:Registered-Users                        Registered Users
+----
+
+This file can't be written to by the +git config+ command.
+
+In order to reference a group in +project.config+, it must be listed in
+the +groups+ file.  When editing permissions through the web UI this
+file is maintained automatically, but when pushing updates to
++refs/meta/config+ this must be dealt with by hand.  Gerrit will refuse
++project.config+ files that refer to groups not listed in +groups+.
+
+The UUID of a group can be found on the General tab of the group's page
+in the web UI or via the +-v+ option to
+link:cmd-ls-groups.html[the +ls-groups+ SSH command].
+
+
+[[file-rules_pl]]
+The file +rules.pl+
+-------------------
+
+The +rules.pl+ files allows you to replace or amend the default Prolog
+rules that control e.g. what conditions need to be fulfilled for a
+change to be submittable.  This file content should be
+interpretable by the 'Prolog Cafe' interpreter.
+
+You can read more about the +rules.pl+ file and the prolog rules on
+link:prolog-cookbook.html[the Prolog cookbook page].
+
+GERRIT
+------
+Part of link:index.html[Gerrit Code Review]
diff --git a/Documentation/config-validation.txt b/Documentation/config-validation.txt
index ab5d04a..1b09d19 100644
--- a/Documentation/config-validation.txt
+++ b/Documentation/config-validation.txt
@@ -2,18 +2,39 @@
 ======================================
 
 Gerrit supports link:dev-plugins.html[plugin-based] validation of
-uploaded commits.
+commits.
 
-This allows plugins to perform additional validation checks against
-uploaded commits, and send back a warning or error message to the git
-client.
+[[new-commit-validation]]
+New commit validation
+---------------------
 
-To make use of this feature, a plugin must implement the `CommitValidationListener`
-interface.
+
+Plugins implementing the `CommitValidationListener` interface can
+perform additional validation checks against new commits.
+
+If the commit fails the validation, the plugin can either provide a
+message that will be sent back to the git client, or throw an exception
+which will cause the commit to be rejected.
+
+Validation applies to both commits uploaded via `git push`, and new
+commits generated via Gerrit's Web UI features such as the rebase, revert
+and cherry-pick buttons.
 
 Out of the box, Gerrit includes a plugin that checks the length of the
 subject and body lines of commit messages on uploaded commits.
 
+[[pre-merge-validation]]
+Pre-merge validation
+--------------------
+
+
+Plugins implementing the `MergeValidationListener` interface can
+perform additional validation checks against commits before they
+are merged to the git repository.
+
+If the commit fails the validation, the plugin can throw an exception
+which will cause the merge to fail.
+
 
 GERRIT
 ------
diff --git a/Documentation/config.defs b/Documentation/config.defs
new file mode 100644
index 0000000..642b915
--- /dev/null
+++ b/Documentation/config.defs
@@ -0,0 +1,20 @@
+DOCUMENTATION_DEPS = {
+  "install-quick.txt": ["config-login-register.txt"],
+  "install.txt": ["database-setup.txt"],
+}
+
+def documentation_attributes(revision):
+  return [
+    'toc',
+    'newline="\\n"',
+    'asterisk="&#42;"',
+    'plus="&#43;"',
+    'caret="&#94;"',
+    'startsb="&#91;"',
+    'endsb="&#93;"',
+    'tilde="&#126;"',
+    'last-update-label!',
+    'source-highlighter=prettify',
+    'stylesheet=doc.css',
+    'revnumber="%s"' % revision,
+  ]
diff --git a/Documentation/database-setup.txt b/Documentation/database-setup.txt
index c559b0e..3800473 100644
--- a/Documentation/database-setup.txt
+++ b/Documentation/database-setup.txt
@@ -63,3 +63,53 @@
 
 Visit MySQL's link:http://dev.mysql.com/doc/[documentation] for further
 information regarding using MySQL.
+
+[[createdb_oracle]]
+Oracle
+~~~~~~
+
+PostgreSQL or H2 is the recommended database for Gerrit Code Review.
+Oracle is supported for environments where running on an existing Oracle
+installation simplifies administrative overheads, such as database backups.
+
+Create a user for the web application within sqlplus, assign it a
+password, and grant the user full rights on the newly created database:
+
+----
+  SQL> create user gerrit2 identified by secret_password default tablespace users;
+  SQL> grant connect, resources to gerrit2;
+----
+
+JDBC driver ojdbc6.jar must be obtained from your Oracle distribution. Gerrit
+initialization process tries to copy it from a known location:
+
+----
+/u01/app/oracle/product/11.2.0/xe/jdbc/lib/ojdbc6.jar
+----
+
+If this file can not be located at this place, then the alternative location
+can be provided.
+
+Instance name is the Oracle SID. Sample database section in
+$site_path/etc/gerrit.config:
+
+----
+[database]
+        type = oracle
+        instance = xe
+        hostname = localhost
+        username = gerrit2
+        port = 1521
+----
+
+Sample database section in $site_path/etc/secure.config:
+
+----
+[database]
+        password = secret_pasword
+----
+
+
+GERRIT
+------
+Part of link:index.html[Gerrit Code Review]
diff --git a/Documentation/dev-buck.txt b/Documentation/dev-buck.txt
new file mode 100644
index 0000000..15c145a
--- /dev/null
+++ b/Documentation/dev-buck.txt
@@ -0,0 +1,376 @@
+Gerrit Code Review - Building with Buck
+=======================================
+
+
+Installation
+------------
+
+There is currently no binary distribution of Buck, so it has to be manually
+built and installed.  Apache Ant is required.  Currently only Linux and Mac
+OS are supported.
+
+Clone the git and build it:
+
+----
+  git clone https://gerrit.googlesource.com/buck
+  cd buck
+  ant
+----
+
+Make sure you have a `bin/` directory in your home directory and that
+it is included in your path:
+
+----
+  mkdir ~/bin
+  PATH=~/bin:$PATH
+----
+
+Add a symbolic link in `~/bin` to the buck executable:
+
+----
+  ln -s `pwd`/bin/buck ~/bin/
+----
+
+Verify that `buck` is accessible:
+
+----
+  which buck
+----
+
+If you plan to use the link:#buck-daemon[Buck daemon] add a symbolic
+link in `~/bin` to the buckd executable:
+
+----
+  ln -s `pwd`/bin/buckd ~/bin/
+----
+
+To enable autocompletion of buck commands, install the autocompletion
+script from `./scripts/bash_completion` in the buck project.  Refer to
+the script's header comments for installation instructions.
+
+
+[[eclipse]]
+Eclipse Integration
+-------------------
+
+
+Generating the Eclipse Project
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+Create the Eclipse project:
+
+----
+  tools/eclipse/project.py
+----
+
+In Eclipse, choose 'Import existing project' and select the `gerrit` project
+from the current working directory.
+
+Expand the `gerrit` project, right-click on the `buck-out` folder, select
+'Properties', and then under 'Attributes' check 'Derived'.
+
+Note that if you make any changes in the project configuration
+that get saved to the `.project` file, for example adding Resource
+Filters on a folder, they will be overwritten the next time you run
+`tools/eclipse/project.py`.
+
+
+Refreshing the Classpath
+~~~~~~~~~~~~~~~~~~~~~~~~
+
+If an updated classpath is needed, the Eclipse project can be
+refreshed and missing dependency JARs can be downloaded:
+
+----
+  tools/eclipse/project.py
+----
+
+
+Attaching Sources
+~~~~~~~~~~~~~~~~~
+
+To save time and bandwidth source JARs are only downloaded by the buck
+build where necessary to compile Java source into JavaScript using the
+GWT compiler.  Additional sources may be obtained, allowing Eclipse to
+show documentation or dive into the implementation of a library JAR:
+
+----
+  tools/eclipse/project.py --src
+----
+
+
+[[build]]
+Building on the Command Line
+----------------------------
+
+
+Gerrit Development WAR File
+~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+To build the Gerrit web application:
+
+----
+  buck build gerrit
+----
+
+The output executable WAR will be placed in:
+
+----
+  buck-out/gen/gerrit.war
+----
+
+
+Extension and Plugin API JAR Files
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+To build the extension and plugin API JAR files:
+
+----
+  buck build api
+----
+
+The output JAR files will be placed in:
+
+----
+  buck-out/gen/{extension,plugin}-api.jar
+----
+
+Install {extension,plugin}-api to the local maven repository:
+
+----
+  buck build api_install
+----
+
+Deploy {extension,plugin}-api to the remote maven repository
+
+----
+  buck build api_deploy
+----
+
+The type of the repo is induced from the Gerrit version name, i.e.
+* 2.8-SNAPSHOT: snapshot repo
+* 2.8: release repo
+
+Plugins
+~~~~~~~
+
+To build all core plugins:
+
+----
+  buck build plugins:core
+----
+
+The output JAR files for individual plugins will be placed in:
+
+----
+  buck-out/gen/plugins/<name>/<name>.jar
+----
+
+The JAR files will also be packaged in:
+
+----
+  buck-out/gen/plugins/core.zip
+----
+
+To build a specific plugin:
+
+----
+  buck build plugins/<name>
+----
+
+The output JAR file will be be placed in:
+
+----
+  buck-out/gen/plugins/<name>/<name>.jar
+----
+
+Note that when building an individual plugin, the `core.zip` package
+is not regenerated.
+
+
+[[documentation]]
+Documentation
+~~~~~~~~~~~~~
+
+To build the documentation:
+
+----
+  buck build docs
+----
+
+The generated html files will be placed in:
+
+----
+  buck-out/gen/Documentation/html__tmp/Documentation
+----
+
+The html files will also be bundled into `html.zip` in this location:
+
+----
+  buck-out/gen/Documentation/html.zip
+----
+
+[[release]]
+Gerrit Release WAR File
+~~~~~~~~~~~~~~~~~~~~~~~
+
+To build the release of the Gerrit web application, including documentation and
+all core plugins:
+
+----
+  buck build release
+----
+
+The output release WAR will be placed in:
+
+----
+  buck-out/gen/release.war
+----
+
+[[tests]]
+Running Unit Tests
+------------------
+
+To run all tests including acceptance tests:
+
+----
+  buck test --all
+----
+
+To exclude slow tests:
+
+----
+  buck test --all --exclude slow
+----
+
+To run a specific test, e.g. the acceptance test
+`com.google.gerrit.acceptance.git.HttpPushForReviewIT`:
+
+----
+  buck test //gerrit-acceptance-tests/src/test/java/com/google/gerrit/acceptance/git:HttpPushForReviewIT
+----
+
+
+Dependencies
+------------
+
+Dependency JARs are normally downloaded automatically, but Buck can inspect
+its graph and download any missing JAR files.  This is useful to enable
+subsequent builds to run without network access:
+
+----
+  tools/download_all.py
+----
+
+When downloading from behind a proxy (which is common in some corporate
+environments), it might be necessary to explicitly specify the proxy that
+is then used by `curl`:
+
+----
+  export http_proxy=http://<proxy_user_id>:<proxy_password>@<proxy_server>:<proxy_port>
+----
+
+Redirection to local mirrors of Maven Central and the Gerrit storage
+bucket is supported by defining specific properties in
+`local.properties`, a file that is not tracked by Git:
+
+----
+  echo download.GERRIT = http://nexus.my-company.com/ >>local.properties
+  echo download.MAVEN_CENTRAL = http://nexus.my-company.com/ >>local.properties
+----
+
+The `local.properties` file may be placed in the root of the gerrit repository
+being built, or in `~/.gerritcodereview/`.  The file in the root of the gerrit
+repository has precedence.
+
+Building against unpublished Maven JARs
+---------------------------------------
+
+To build against unpublished Maven JARs, like gwtorm or PrologCafe, the custom
+JARs must be installed in the local Maven repository (`mvn clean install`) and
+`maven_jar()` must be updated to point to the `MAVEN_LOCAL` Maven repository for
+that artifact:
+
+[source,python]
+----
+ maven_jar(
+   name = 'gwtorm',
+   id = 'gwtorm:gwtorm:42',
+   license = 'Apache2.0',
+   repository = MAVEN_LOCAL,
+ )
+----
+
+Caching Build Results
+~~~~~~~~~~~~~~~~~~~~~
+
+Build results can be locally cached, saving rebuild time when
+switching between Git branches. Buck's documentation covers
+caching in link:http://facebook.github.io/buck/concept/buckconfig.html[buckconfig].
+The trivial case using a local directory is:
+
+----
+  cat >.buckconfig.local <<EOF
+  [cache]
+    mode = dir
+    dir = buck-cache
+  EOF
+----
+
+[[buck-daemon]]
+Using Buck daemon
+~~~~~~~~~~~~~~~~~
+
+Buck ships with a daemon command `buckd`, which uses the
+link:https://github.com/martylamb/nailgun[Nailgun] protocol for running
+Java programs from the command line without incurring the JVM startup
+overhead.
+
+Using a Buck daemon can save significant amounts of time as it avoids the
+overhead of starting a Java virtual machine, loading the buck class files
+and parsing the build files for each command.
+
+It is safe to run several buck daemons started from different project
+directories and they will not interfere with each other. Buck's documentation
+covers daemon in http://facebook.github.io/buck/command/buckd.html[buckd].
+
+The trivial use case is to run `buckd` from the project's root directory and
+run `buck` as usual:
+
+----
+  buckd
+  buck build gerrit
+  Using buckd.
+  [-] PARSING BUILD FILES...FINISHED 0.6s
+  [-] BUILDING...FINISHED 0.2s
+----
+
+Override Buck's settings
+~~~~~~~~~~~~~~~~~~~~~~~~
+
+User-specific configuration can be placed in one of the following files:
+`/etc/buck.conf`, `$HOME/.buck/buck.conf` or `$HOME/.buckrc`.
+
+For example to override Buck's default 1GB heap size:
+
+----
+  cat > $HOME/.buckrc <<EOF
+  export BUCK_EXTRA_JAVA_ARGS="\
+  -XX:MaxPermSize=512m \
+  -Xms8000m \
+  -Xmx16000m"
+  EOF
+----
+
+Or to debug BUCK, set `BUCK_DEBUG_MODE` to anything non-empty, then connect to
+port 8888:
+
+----
+  cat > $HOME/.buckrc <<EOF
+  export BUCK_DEBUG_MODE="yes"
+  EOF
+----
+
+GERRIT
+------
+Part of link:index.html[Gerrit Code Review]
diff --git a/Documentation/dev-contributing.txt b/Documentation/dev-contributing.txt
index 84cb1e0..edc072d 100644
--- a/Documentation/dev-contributing.txt
+++ b/Documentation/dev-contributing.txt
@@ -94,13 +94,22 @@
 ====
 
 The Change-Id is, as usual, created by a local git hook.  To install it, simply
-copy one from the checkout and make it executable:
+copy it from the checkout and make it executable:
 
 ====
   cp ./gerrit-server/src/main/resources/com/google/gerrit/server/tools/root/hooks/commit-msg .git/hooks/
   chmod +x .git/hooks/commit-msg
 ====
 
+If you are working on core plugins, you will also need to install the
+same hook in the submodules:
+
+====
+  export hook=$(pwd)/.git/hooks/commit-msg
+  git submodule foreach 'cp -p "$hook" "$(git rev-parse --git-dir)/hooks/"'
+====
+
+
 To set up git's remote for easy pushing, run the following:
 
 ====
@@ -127,7 +136,7 @@
     in the formatting guidelines.  This is especially true within the
     same file.
   * Review your change in Gerrit to see if it highlights
-    mistakingly deleted/added spaces on lines, trailing spaces.
+    mistakenly deleted/added spaces on lines, trailing spaces.
   * Line length should be 80 or less, unless the code reads
     better with something slightly longer.  Shorter lines not only
     help reviewers who may use a tablet to review the code, but future
@@ -271,6 +280,10 @@
 Developers concerned with stable branches are encouraged to backport or push
 patchsets to these branches, even if no new release is planned.
 
+Fixes that are known to be needed for a particular release should be pushed
+for review on that release's stable branch.  It will then be included in
+the master branch when the stable branch is merged back.
+
 
 GERRIT
 ------
diff --git a/Documentation/dev-design.txt b/Documentation/dev-design.txt
index 2e43b96..3cb58b1 100644
--- a/Documentation/dev-design.txt
+++ b/Documentation/dev-design.txt
@@ -66,7 +66,7 @@
 
 Gerrit 2.x is a complete rewrite of the Gerrit fork, completely
 changing the implementation from Python on Google App Engine, to Java
-on a J2EE servlet container and a SQL database.
+on a J2EE servlet container and an SQL database.
 
 * link:http://video.google.com/videoplay?docid=-8502904076440714866[Mondrian Code Review On The Web]
 * link:http://code.google.com/p/rietveld/[Rietveld - Code Review for Subversion]
@@ -445,7 +445,7 @@
 -------
 
 Gerrit targets for sub-250 ms per page request, mostly by using
-very compact JSON payloads bewteen client and server.  However, as
+very compact JSON payloads between client and server.  However, as
 most of the serving stack (network, hardware, metadata
 database) is out of control of the Gerrit developers, no real
 guarantees can be made about latency.
@@ -474,7 +474,7 @@
 Out of the box, Gerrit will handle the "Default Maximum". Site
 administrators may reconfigure their servers by editing gerrit.config
 to run closer to the estimated maximum if sufficient memory is made
-avaliable to the JVM and the relevant cache.*.memoryLimit variables
+available to the JVM and the relevant cache.*.memoryLimit variables
 are increased from their defaults.
 
 Discussion
@@ -671,7 +671,7 @@
 
 PostgreSQL and MySQL can be configured to replicate their data to
 other systems, where they are applied to a warm-standby backup in
-real time.  Gerrit instances which care about reduduncy will setup
+real time.  Gerrit instances which care about redundancy will setup
 this feature of PostgreSQL or MySQL to ensure the warm-standby is
 reasonably current should the master go offline.
 
@@ -699,7 +699,7 @@
 Changes submitted and merged into a branch also update the
 Git reflog.  These logs are available only to the Gerrit site
 administrator, and they are not replicated through the automatic
-replication noted earlier.  These logs are primarly recorded for an
+replication noted earlier.  These logs are primarily recorded for an
 "oh s**t" moment where the administrator has to rewind data.  In most
 installations they are a waste of disk space.  Future versions of
 JGit may allow disabling these logs, and Gerrit may take advantage
diff --git a/Documentation/dev-eclipse.txt b/Documentation/dev-eclipse.txt
index 019c78f..d2fc8f0 100644
--- a/Documentation/dev-eclipse.txt
+++ b/Documentation/dev-eclipse.txt
@@ -8,19 +8,6 @@
 runtime debugging environment.
 
 
-[[maven]]
-Maven Plugin
-------------
-
-Install the Maven Integration plugins.
-
-In Eclipse version 3.7 (Indigo) and later, these are available in the
-default update site and can be found under the 'Collaboration' category.
-
-For older versions the update site must be manually added; the link can
-be found on the http://www.eclipse.org/m2e/download/[m2eclipse download page].
-
-
 [[Formatting]]
 Code Formatter Settings
 -----------------------
@@ -32,23 +19,12 @@
 settings prefer when formatting source code.
 
 
-Import Projects
----------------
-
-Import the projects into Eclipse by going to File -> Import... -> Maven ->
-Existing Maven Projects and selecting the directory containing pom.xml.
-
-Some of the source code is generated with ANTLR sources.  To build
-these files, right click on the imported projects, Maven -> Update
-Project Configuration.  This will resolve compile errors identified
-after import.
-
-
 Site Initialization
 -------------------
 
-link:dev-readme.html#build[Build] once on the command line and
-then follow link:dev-readme.html#init[Site Initialization] in the
+Build once on the command line with
+link:dev-buck.html#build[Buck] and then follow
+link:dev-readme.html#init[Site Initialization] in the
 Developer Setup guide to configure a local site for testing.
 
 
@@ -58,10 +34,10 @@
 Running the Daemon
 ~~~~~~~~~~~~~~~~~~
 
-Duplicate the existing `pgm_daemon` launch configuration:
+Duplicate the existing launch configuration:
 
 * Run -> Debug Configurations ...
-* Java Application -> `pgm_daemon`
+* Java Application -> `buck_daemon_ui_*`
 * Right click, Duplicate
 
 * Modify the name to be unique.
@@ -73,25 +49,16 @@
 
 * Switch to Common tab.
 * Change Save as to be Local file.
+* Close the Debug Configurations dialog and save the changes when prompted.
 
 
-[[hosted-mode]]
 Running Hosted Mode
 ~~~~~~~~~~~~~~~~~~~
 
-To debug the GWT code executing in the web browser, two additional Git
-repositories need to be cloned.
-
-* https://gerrit.googlesource.com/gwtjsonrpc
-* https://gerrit.googlesource.com/gwtorm
-
-In Eclipse, import the pom.xml file in the root directory of each of
-these cloned gits via General -> Maven Projects.
-
-Duplicate the existing `gwtui_dbg` launch configuration:
+Duplicate the existing launch configuration:
 
 * Run -> Debug Configurations ...
-* Java Application -> `gwtui_dbg`
+* Java Application -> `buck_gwt_debug`
 * Right click, Duplicate
 
 * Modify the name to be unique.
@@ -103,23 +70,22 @@
 
 * Switch to Common tab.
 * Change Save as to be Local file.
+* Close the Debug Configurations dialog and save the changes when prompted.
 
 
 [[known-problems]]
 Known problems
 --------------
 
-* When running Gerrit under the Eclipse debugger, code that attempts
-to load Prolog code may erroneously raise ClassNotFoundException,
-claiming that classes in the `Gerrit` package can't be found. The
-error can often be resolved by rebuilding Gerrit with `mvn package`
-and restarting the debug session.
-
 * OpenID authentication won't work in hosted mode, so you need to change
 the link:config-gerrit.html#auth.type[auth.type] configuration parameter
 to `DEVELOPMENT_BECOME_ANY_ACCOUNT` to disable OpenID and allow you to
 impersonate whatever account you otherwise would've used.
 
+* Error "Cannot create ReviewDb" occurs if the test site is already running.
+Stop the test site with `gerrit.sh stop` before attempting to run hosted mode
+debugging.
+
 * Gerrit site doesn't appear, only directory listing is shown. Web toolkit
 developer browser plugin is missing. If there is no warning, that browser
 plugin is missing with the suggestion to install it, you can install the
diff --git a/Documentation/dev-plugins.txt b/Documentation/dev-plugins.txt
index 12838fe..717547b 100644
--- a/Documentation/dev-plugins.txt
+++ b/Documentation/dev-plugins.txt
@@ -38,7 +38,7 @@
 ----
 mvn archetype:generate -DarchetypeGroupId=com.google.gerrit \
     -DarchetypeArtifactId=gerrit-plugin-archetype \
-    -DarchetypeVersion=2.5-SNAPSHOT \
+    -DarchetypeVersion=2.8-SNAPSHOT \
     -DgroupId=com.google.gerrit \
     -DartifactId=testPlugin
 ----
@@ -49,14 +49,13 @@
 ask again for all properties including those with predefined default
 values.
 
-. clone the sample helloworld plugin:
+. clone the sample plugin:
 +
-This is a Maven project that adds an SSH command to Gerrit to print
-out a hello world message. It can be taken as an example to develop
-an own plugin.
+This is a project that demonstrates the various features of the
+plugin API. It can be taken as an example to develop an own plugin.
 +
 ----
-$ git clone https://gerrit.googlesource.com/plugins/helloworld
+$ git clone https://gerrit.googlesource.com/plugins/cookbook-plugin
 ----
 +
 When starting from this example one should take care to adapt the
@@ -64,7 +63,7 @@
 the plugin is developed. If the plugin is developed for a released
 Gerrit version (no `SNAPSHOT` version) then the URL for the
 `gerrit-api-repository` in the `pom.xml` needs to be changed to
-`https://gerrit-api.commondatastorage.googleapis.com/release/`.
+`https://gerrit-api.storage.googleapis.com/release/`.
 
 [[API]]
 API
@@ -133,6 +132,65 @@
   Gerrit-HttpModule: tld.example.project.HttpModuleClassName
 ====
 
+[[plugin_name]]
+Plugin Name
+~~~~~~~~~~~
+
+A plugin can optionally provide its own plugin name.
+
+====
+  Gerrit-PluginName: replication
+====
+
+This is useful for plugins that contribute plugin-owned capabilities that
+are stored in the `project.config` file. Another use case is to be able to put
+project specific plugin configuration section in `project.config`. In this
+case it is advantageous to reserve the plugin name to access the configuration
+section in the `project.config` file.
+
+If `Gerrit-PluginName` is omitted, then the plugin's name is determined from
+the plugin file name.
+
+If a plugin provides its own name, then that plugin cannot be deployed
+multiple times under different file names on one Gerrit site.
+
+For Maven driven plugins, the following line must be included in the pom.xml
+file:
+
+[source,xml]
+----
+<manifestEntries>
+  <Gerrit-PluginName>name</Gerrit-PluginName>
+</manifestEntries>
+----
+
+For Buck driven plugins, the following line must be included in the BUCK
+configuration file:
+
+[source,python]
+----
+manifest_entries = [
+   'Gerrit-PluginName: name',
+]
+----
+
+A plugin can get its own name injected at runtime:
+
+[source,java]
+----
+public class MyClass {
+
+  private final String pluginName;
+
+  @Inject
+  public MyClass(@PluginName String pluginName) {
+    this.pluginName = pluginName;
+  }
+
+  [...]
+}
+----
+
 [[reload_method]]
 Reload Method
 ~~~~~~~~~~~~~
@@ -193,7 +251,7 @@
 ====
 
 MyInitStep needs to follow the standard Gerrit InitStep syntax
-and behaviour: writing to the console using the injected ConsoleUI
+and behavior: writing to the console using the injected ConsoleUI
 and accessing / changing configuration settings using Section.Factory.
 
 In addition to the standard Gerrit init injections, plugins receive
@@ -210,13 +268,15 @@
 call the constructor of their connection class, passing in values obtained
 from the Section.Factory rather than from an injected Config object.
 
-Plugins InitStep are executing during the "Gerrit Plugin init" phase, after
-the extraction of the plugins embedded in Gerrit.war into $GERRIT_SITE/plugins
-and before the DB Schema initialization or upgrade.
-Plugins InitStep cannot refer to Gerrit DB Schema or any other Gerrit runtime
-objects injected at startup.
+Plugins' InitSteps are executed during the "Gerrit Plugin init" phase, after
+the extraction of the plugins embedded in the distribution .war file into
+`$GERRIT_SITE/plugins` and before the DB Schema initialization or upgrade.
 
-====
+A plugin's InitStep cannot refer to Gerrit's DB Schema or any other Gerrit
+runtime objects injected at startup.
+
+[source,java]
+----
 public class MyInitStep implements InitStep {
   private final ConsoleUI ui;
   private final Section.Factory sections;
@@ -237,7 +297,7 @@
     mySection.string("Link name", "linkname", "MyLink");
   }
 }
-====
+----
 
 [[classpath]]
 Classpath
@@ -255,6 +315,43 @@
 to package additional dependencies. Relocating (or renaming) classes
 should not be necessary due to the ClassLoader isolation.
 
+[[events]]
+Listening to Events
+-------------------
+
+Certain operations in Gerrit trigger events. Plugins may receive
+notifications of these events by implementing the corresponding
+listeners.
+
+* `com.google.gerrit.common.ChangeListener`:
++
+Allows to listen to change events. These are the same
+link:cmd-stream-events.html#events[events] that are also streamed by
+the link:cmd-stream-events.html[gerrit stream-events] command.
+
+* `com.google.gerrit.extensions.events.LifecycleListener`:
++
+Gerrit server startup and shutdown
+
+* `com.google.gerrit.extensions.events.NewProjectCreatedListener`:
++
+Project creation
+
+* `com.google.gerrit.extensions.events.ProjectDeletedListener`:
++
+Project deletion
+
+[[stream-events]]
+Sending Events to the Events Stream
+-----------------------------------
+
+Plugins may send events to the events stream where consumers of
+Gerrit's `stream-events` ssh command will receive them.
+
+To send an event, the plugin must invoke one of the `postEvent`
+methods in the `ChangeHookRunner` class, passing an instance of
+its own custom event class derived from `ChangeEvent`.
+
 [[ssh]]
 SSH Commands
 ------------
@@ -264,44 +361,47 @@
 
 Command implementations must extend the base class SshCommand:
 
-====
-  import com.google.gerrit.sshd.SshCommand;
+[source,java]
+----
+import com.google.gerrit.sshd.SshCommand;
 
-  class PrintHello extends SshCommand {
-    protected abstract void run() {
-      stdout.print("Hello\n");
-    }
+class PrintHello extends SshCommand {
+  protected abstract void run() {
+    stdout.print("Hello\n");
   }
-====
+}
+----
 
 If no Guice modules are declared in the manifest, SSH commands may
 use auto-registration by providing an `@Export` annotation:
 
-====
-  import com.google.gerrit.extensions.annotations.Export;
-  import com.google.gerrit.sshd.SshCommand;
+[source,java]
+----
+import com.google.gerrit.extensions.annotations.Export;
+import com.google.gerrit.sshd.SshCommand;
 
-  @Export("print")
-  class PrintHello extends SshCommand {
-    protected abstract void run() {
-      stdout.print("Hello\n");
-    }
+@Export("print")
+class PrintHello extends SshCommand {
+  protected abstract void run() {
+    stdout.print("Hello\n");
   }
-====
+}
+----
 
 If explicit registration is being used, a Guice module must be
 supplied to register the SSH command and declared in the manifest
 with the `Gerrit-SshModule` attribute:
 
-====
-  import com.google.gerrit.sshd.PluginCommandModule;
+[source,java]
+----
+import com.google.gerrit.sshd.PluginCommandModule;
 
-  class MyCommands extends PluginCommandModule {
-    protected void configureCommands() {
-      command("print").to(PrintHello.class);
-    }
+class MyCommands extends PluginCommandModule {
+  protected void configureCommands() {
+    command("print").to(PrintHello.class);
   }
-====
+}
+----
 
 For a plugin installed as name `helloworld`, the command implemented
 by PrintHello class will be available to users as:
@@ -310,6 +410,584 @@
 $ ssh -p 29418 review.example.com helloworld print
 ----
 
+Multiple SSH commands can be bound to the same implementation class. For
+example a Gerrit Shell plugin can bind different shell commands to the same
+implementation class:
+
+[source,java]
+----
+public class SshShellModule extends PluginCommandModule {
+  @Override
+  protected void configureCommands() {
+    command("ls").to(ShellCommand.class);
+    command("ps").to(ShellCommand.class);
+    [...]
+  }
+}
+----
+
+With the possible implementation:
+
+[source,java]
+----
+public class ShellCommand extends SshCommand {
+  @Override
+  protected void run() throws UnloggedFailure {
+    String cmd = getName().substring(getPluginName().length() + 1);
+    ProcessBuilder proc = new ProcessBuilder(cmd);
+    Process cmd = proc.start();
+    [...]
+  }
+}
+----
+
+And the call:
+
+----
+$ ssh -p 29418 review.example.com shell ls
+$ ssh -p 29418 review.example.com shell ps
+----
+
+[[configuration]]
+Configuration
+-------------
+
+In Gerrit, global configuration is stored in the `gerrit.config` file.
+If a plugin needs global configuration, this configuration should be
+stored in a `plugin` subsection in the `gerrit.config` file.
+
+This approach of storing the plugin configuration is only suitable for
+plugins that have a simple configuration that only consists of
+key-value pairs. With this approach it is not possible to have
+subsections in the plugin configuration. Plugins that require a complex
+configuration need to store their configuration in their own
+configuration file where they can make use of subsections. On the other
+hand storing the plugin configuration in a 'plugin' subsection in the
+`gerrit.config` file has the advantage that administrators have all
+configuration parameters in one file, instead of having one
+configuration file per plugin.
+
+To avoid conflicts with other plugins, it is recommended that plugins
+only use the `plugin` subsection with their own name. For example the
+`helloworld` plugin should store its configuration in the
+`plugin.helloworld` subsection:
+
+----
+[plugin "helloworld"]
+  language = Latin
+----
+
+Via the `com.google.gerrit.server.config.PluginConfigFactory` class a
+plugin can easily access its configuration and there is no need for a
+plugin to parse the `gerrit.config` file on its own:
+
+[source,java]
+----
+@Inject
+private com.google.gerrit.server.config.PluginConfigFactory cfg;
+
+[...]
+
+String language = cfg.getFromGerritConfig("helloworld")
+                     .getString("language", "English");
+----
+
+[[project-specific-configuration]]
+Project Specific Configuration
+------------------------------
+
+In Gerrit, project specific configuration is stored in the project's
+`project.config` file on the `refs/meta/config` branch.  If a plugin
+needs configuration on project level (e.g. to enable its functionality
+only for certain projects), this configuration should be stored in a
+`plugin` subsection in the project's `project.config` file.
+
+This approach of storing the plugin configuration is only suitable for
+plugins that have a simple configuration that only consists of
+key-value pairs. With this approach it is not possible to have
+subsections in the plugin configuration. Plugins that require a complex
+configuration need to store their configuration in their own
+configuration file where they can make use of subsections. On the other
+hand storing the plugin configuration in a 'plugin' subsection in the
+`project.config` file has the advantage that project owners have all
+configuration parameters in one file, instead of having one
+configuration file per plugin.
+
+To avoid conflicts with other plugins, it is recommended that plugins
+only use the `plugin` subsection with their own name. For example the
+`helloworld` plugin should store its configuration in the
+`plugin.helloworld` subsection:
+
+----
+  [plugin "helloworld"]
+    enabled = true
+----
+
+Via the `com.google.gerrit.server.config.PluginConfigFactory` class a
+plugin can easily access its project specific configuration and there
+is no need for a plugin to parse the `project.config` file on its own:
+
+[source,java]
+----
+@Inject
+private com.google.gerrit.server.config.PluginConfigFactory cfg;
+
+[...]
+
+boolean enabled = cfg.getFromProjectConfig(project, "helloworld")
+                     .getBoolean("enabled", false);
+----
+
+It is also possible to get missing configuration parameters inherited
+from the parent projects:
+
+[source,java]
+----
+@Inject
+private com.google.gerrit.server.config.PluginConfigFactory cfg;
+
+[...]
+
+boolean enabled = cfg.getFromProjectConfigWithInheritance(project, "helloworld")
+                     .getBoolean("enabled", false);
+----
+
+Project owners can edit the project configuration by fetching the
+`refs/meta/config` branch, editing the `project.config` file and
+pushing the commit back.
+
+[[capabilities]]
+Plugin Owned Capabilities
+-------------------------
+
+Plugins may provide their own capabilities and restrict usage of SSH
+commands to the users who are granted those capabilities.
+
+Plugins define the capabilities by overriding the `CapabilityDefinition`
+abstract class:
+
+[source,java]
+----
+public class PrintHelloCapability extends CapabilityDefinition {
+  @Override
+  public String getDescription() {
+    return "Print Hello";
+  }
+}
+----
+
+If no Guice modules are declared in the manifest, UI actions may
+use auto-registration by providing an `@Export` annotation:
+
+[source,java]
+----
+@Export("printHello")
+public class PrintHelloCapability extends CapabilityDefinition {
+  [...]
+}
+----
+
+Otherwise the capability must be bound in a plugin module:
+
+[source,java]
+----
+public class HelloWorldModule extends AbstractModule {
+  @Override
+  protected void configure() {
+    bind(CapabilityDefinition.class)
+      .annotatedWith(Exports.named("printHello"))
+      .to(PrintHelloCapability.class);
+  }
+}
+----
+
+With a plugin-owned capability defined in this way, it is possible to restrict
+usage of an SSH command or `UiAction` to members of the group that were granted
+this capability in the usual way, using the `RequiresCapability` annotation:
+
+[source,java]
+----
+@RequiresCapability("printHello")
+@CommandMetaData(name="print", description="Print greeting in different languages")
+public final class PrintHelloWorldCommand extends SshCommand {
+  [...]
+}
+----
+
+Or with `UiAction`:
+
+[source,java]
+----
+@RequiresCapability("printHello")
+public class SayHelloAction extends UiAction<RevisionResource>
+  implements RestModifyView<RevisionResource, SayHelloAction.Input> {
+  [...]
+}
+----
+
+Capability scope was introduced to differentiate between plugin-owned
+capabilities and core capabilities. Per default the scope of the
+`@RequiresCapability` annotation is `CapabilityScope.CONTEXT`, that means:
+
+* when `@RequiresCapability` is used within a plugin the scope of the
+capability is assumed to be that plugin.
+
+* If `@RequiresCapability` is used within the core Gerrit Code Review server
+(and thus is outside of a plugin) the scope is the core server and will use
+the `GlobalCapability` known to Gerrit Code Review server.
+
+If a plugin needs to use a core capability name (e.g. "administrateServer")
+this can be specified by setting `scope = CapabilityScope.CORE`:
+
+[source,java]
+----
+@RequiresCapability(value = "administrateServer", scope =
+    CapabilityScope.CORE)
+  [...]
+----
+
+[[ui_extension]]
+UI Extension
+------------
+
+Plugins can contribute UI actions on core Gerrit pages. This is useful
+for workflow customization or exposing plugin functionality through the
+UI in addition to SSH commands and the REST API.
+
+For instance a plugin to integrate Jira with Gerrit changes may
+contribute a "File bug" button to allow filing a bug from the change
+page or plugins to integrate continuous integration systems may
+contribute a "Schedule" button to allow a CI build to be scheduled
+manually from the patch set panel.
+
+Two different places on core Gerrit pages are supported:
+
+* Change screen
+* Project info screen
+
+Plugins contribute UI actions by implementing the `UiAction` interface:
+
+[source,java]
+----
+@RequiresCapability("printHello")
+class HelloWorldAction implements UiAction<RevisionResource>,
+    RestModifyView<RevisionResource, HelloWorldAction.Input> {
+  static class Input {
+    boolean french;
+    String message;
+  }
+
+  private Provider<CurrentUser> user;
+
+  @Inject
+  HelloWorldAction(Provider<CurrentUser> user) {
+    this.user = user;
+  }
+
+  @Override
+  public String apply(RevisionResource rev, Input input) {
+    final String greeting = input.french
+        ? "Bonjour"
+        : "Hello";
+    return String.format("%s %s from change %s, patch set %d!",
+        greeting,
+        Strings.isNullOrEmpty(input.message)
+            ? Objects.firstNonNull(user.get().getUserName(), "world")
+            : input.message,
+        rev.getChange().getId().toString(),
+        rev.getPatchSet().getPatchSetId());
+  }
+
+  @Override
+  public Description getDescription(
+      RevisionResource resource) {
+    return new Description()
+        .setLabel("Say hello")
+        .setTitle("Say hello in different languages");
+  }
+}
+----
+
+Sometimes plugins may want to be able to change the state of a patch set or
+change in the `UiAction.apply()` method and reflect these changes on the core
+UI. For example a buildbot plugin which exposes a 'Schedule' button on the
+patch set panel may want to disable that button after the build was scheduled
+and update the tooltip of that button. But because of Gerrit's caching
+strategy the following must be taken into consideration.
+
+The browser is allowed to cache the `UiAction` information until something on
+the change is modified. More accurately the change row needs to be modified in
+the database to have a more recent `lastUpdatedOn` or a new `rowVersion`, or
+the +refs/meta/config+ of the project or any parents needs to change to a new
+SHA-1. The ETag SHA-1 computation code can be found in the
+`ChangeResource.getETag()` method.
+
+The easiest way to accomplish this is to update `lastUpdatedOn` of the change:
+
+[source,java]
+----
+@Override
+public Object apply(RevisionResource rcrs, Input in) {
+  // schedule a build
+  [...]
+  // update change
+  ReviewDb db = dbProvider.get();
+  db.changes().beginTransaction(change.getId());
+  try {
+    change = db.changes().atomicUpdate(
+      change.getId(),
+      new AtomicUpdate<Change>() {
+        @Override
+        public Change update(Change change) {
+          ChangeUtil.updated(change);
+          return change;
+        }
+      });
+    db.commit();
+  } finally {
+    db.rollback();
+  }
+  [...]
+}
+----
+
+`UiAction` must be bound in a plugin module:
+
+[source,java]
+----
+public class Module extends AbstractModule {
+  @Override
+  protected void configure() {
+    install(new RestApiModule() {
+      @Override
+      protected void configure() {
+        post(REVISION_KIND, "say-hello")
+            .to(HelloWorldAction.class);
+      }
+    });
+  }
+}
+----
+
+The module above must be declared in the `pom.xml` for Maven driven
+plugins:
+
+[source,xml]
+----
+<manifestEntries>
+  <Gerrit-Module>com.googlesource.gerrit.plugins.cookbook.Module</Gerrit-Module>
+</manifestEntries>
+----
+
+or in the `BUCK` configuration file for Buck driven plugins:
+
+[source,python]
+----
+manifest_entries = [
+  'Gerrit-Module: com.googlesource.gerrit.plugins.cookbook.Module',
+]
+----
+
+In some use cases more user input must be gathered, for that `UiAction` can be
+combined with the JavaScript API. This would display a small popup near the
+activation button to gather additional input from the user. The JS file is
+typically put in the `static` folder within the plugin's directory:
+
+[source,javascript]
+----
+Gerrit.install(function(self) {
+  function onSayHello(c) {
+    var f = c.textfield();
+    var t = c.checkbox();
+    var b = c.button('Say hello', {onclick: function(){
+      c.call(
+        {message: f.value, french: t.checked},
+        function(r) {
+          c.hide();
+          window.alert(r);
+          c.refresh();
+        });
+    }});
+    c.popup(c.div(
+      c.prependLabel('Greeting message', f),
+      c.br(),
+      c.label(t, 'french'),
+      c.br(),
+      b));
+    f.focus();
+  }
+  self.onAction('revision', 'say-hello', onSayHello);
+});
+----
+
+The JS module must be exposed as a `WebUiPlugin` and bound as
+an HTTP Module:
+
+[source,java]
+----
+public class HttpModule extends HttpPluginModule {
+  @Override
+  protected void configureServlets() {
+    DynamicSet.bind(binder(), WebUiPlugin.class)
+        .toInstance(new JavaScriptPlugin("hello.js"));
+  }
+}
+----
+
+The HTTP module above must be declared in the `pom.xml` for Maven
+driven plugins:
+
+[source,xml]
+----
+<manifestEntries>
+  <Gerrit-HttpModule>com.googlesource.gerrit.plugins.cookbook.HttpModule</Gerrit-HttpModule>
+</manifestEntries>
+----
+
+or in the `BUCK` configuration file for Buck driven plugins
+
+[source,python]
+----
+manifest_entries = [
+  'Gerrit-HttpModule: com.googlesource.gerrit.plugins.cookbook.HttpModule',
+]
+----
+
+If `UiAction` is annotated with the `@RequiresCapability` annotation, then the
+capability check is done during the `UiAction` gathering, so the plugin author
+doesn't have to set `UiAction.Description.setVisible()` explicitly in this
+case.
+
+The following prerequisities must be met, to satisfy the capability check:
+
+* user is authenticated
+* user is a member of a group which has the `Administrate Server` capability, or
+* user is a member of a group which has the required capability
+
+The `apply` method is called when the button is clicked. If `UiAction` is
+combined with JavaScript API (its own JavaScript function is provided),
+then a popup dialog is normally opened to gather additional user input.
+A new button is placed on the popup dialog to actually send the request.
+
+Every `UiAction` exposes a REST API endpoint. The endpoint from the example above
+can be accessed from any REST client, i. e.:
+
+====
+  curl -X POST -H "Content-Type: application/json" \
+    -d '{message: "François", french: true}' \
+    --digest --user joe:secret \
+    http://host:port/a/changes/1/revisions/1/cookbook~say-hello
+  "Bonjour François from change 1, patch set 1!"
+====
+
+A special case is to bind an endpoint without a view name.  This is
+particularly useful for `DELETE` requests:
+
+[source,java]
+----
+public class Module extends AbstractModule {
+  @Override
+  protected void configure() {
+    install(new RestApiModule() {
+      @Override
+      protected void configure() {
+        delete(PROJECT_KIND)
+            .to(DeleteProject.class);
+      }
+    });
+  }
+}
+----
+
+For a `UiAction` bound this way, a JS API function can be provided.
+
+Currently only one restriction exists: per plugin only one `UiAction`
+can be bound per resource without view name. To define a JS function
+for the `UiAction`, "/" must be used as the name:
+
+[source,javascript]
+----
+Gerrit.install(function(self) {
+  function onDeleteProject(c) {
+    [...]
+  }
+  self.onAction('project', '/', onDeleteProject);
+});
+----
+
+[[top-menu-extensions]]
+Top Menu Extensions
+-------------------
+
+Plugins can contribute items to Gerrit's top menu.
+
+A single top menu extension can have multiple elements and will be put as
+the last element in Gerrit's top menu.
+
+Plugins define the top menu entries by implementing `TopMenu` interface:
+
+[source,java]
+----
+public class MyTopMenuExtension implements TopMenu {
+
+  @Override
+  public List<MenuEntry> getEntries() {
+    return Lists.newArrayList(
+               new MenuEntry("Top Menu Entry", Lists.newArrayList(
+                      new MenuItem("Gerrit", "http://gerrit.googlecode.com/"))));
+  }
+}
+----
+
+Plugins can also add additional menu items to Gerrit's top menu entries
+by defining a `MenuEntry` that has the same name as a Gerrit top menu
+entry:
+
+[source,java]
+----
+public class MyTopMenuExtension implements TopMenu {
+
+  @Override
+  public List<MenuEntry> getEntries() {
+    return Lists.newArrayList(
+               new MenuEntry(GerritTopMenu.PROJECTS, Lists.newArrayList(
+                      new MenuItem("Browse Repositories", "https://gerrit.googlesource.com/"))));
+  }
+}
+----
+
+If no Guice modules are declared in the manifest, the top menu extension may use
+auto-registration by providing an `@Listen` annotation:
+
+[source,java]
+----
+@Listen
+public class MyTopMenuExtension implements TopMenu {
+  [...]
+}
+----
+
+Otherwise the top menu extension must be bound in the plugin module used
+for the Gerrit system injector (Gerrit-Module entry in MANIFEST.MF):
+
+[source,java]
+----
+package com.googlesource.gerrit.plugins.helloworld;
+
+public class HelloWorldModule extends AbstractModule {
+  @Override
+  protected void configure() {
+    DynamicSet.bind(binder(), TopMenu.class).to(MyTopMenuExtension.class);
+  }
+}
+----
+
+[source,manifest]
+----
+Gerrit-ApiType: plugin
+Gerrit-Module: com.googlesource.gerrit.plugins.helloworld.HelloWorldModule
+----
+
 [[http]]
 HTTP Servlets
 -------------
@@ -319,38 +997,40 @@
 
 Servlets may use auto-registration to declare the URL they handle:
 
-====
-  import com.google.gerrit.extensions.annotations.Export;
-  import com.google.inject.Singleton;
-  import javax.servlet.http.HttpServlet;
-  import javax.servlet.http.HttpServletRequest;
-  import javax.servlet.http.HttpServletResponse;
+[source,java]
+----
+import com.google.gerrit.extensions.annotations.Export;
+import com.google.inject.Singleton;
+import javax.servlet.http.HttpServlet;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
 
-  @Export("/print")
-  @Singleton
-  class HelloServlet extends HttpServlet {
-    protected void doGet(HttpServletRequest req, HttpServletResponse res) throws IOException {
-      res.setContentType("text/plain");
-      res.setCharacterEncoding("UTF-8");
-      res.getWriter().write("Hello");
-    }
+@Export("/print")
+@Singleton
+class HelloServlet extends HttpServlet {
+  protected void doGet(HttpServletRequest req, HttpServletResponse res) throws IOException {
+    res.setContentType("text/plain");
+    res.setCharacterEncoding("UTF-8");
+    res.getWriter().write("Hello");
   }
-====
+}
+----
 
 The auto registration only works for standard servlet mappings like
 `/foo` or `/foo/*`. Regex style bindings must use a Guice ServletModule
 to register the HTTP servlets and declare it explicitly in the manifest
 with the `Gerrit-HttpModule` attribute:
 
-====
-  import com.google.inject.servlet.ServletModule;
+[source,java]
+----
+import com.google.inject.servlet.ServletModule;
 
-  class MyWebUrls extends ServletModule {
-    protected void configureServlets() {
-      serve("/print").with(HelloServlet.class);
-    }
+class MyWebUrls extends ServletModule {
+  protected void configureServlets() {
+    serve("/print").with(HelloServlet.class);
   }
-====
+}
+----
 
 For a plugin installed as name `helloworld`, the servlet implemented
 by HelloServlet class will be available to users as:
@@ -369,12 +1049,27 @@
 
 Plugins can use this to store any data they want.
 
-====
-  @Inject
-  MyType(@PluginData java.io.File myDir) {
-    new FileInputStream(new File(myDir, "my.config"));
-  }
-====
+[source,java]
+----
+@Inject
+MyType(@PluginData java.io.File myDir) {
+  new FileInputStream(new File(myDir, "my.config"));
+}
+----
+
+[[download-commands]]
+Download Commands
+-----------------
+
+Gerrit offers commands for downloading changes using different
+download schemes (e.g. for downloading via different network
+protocols). Plugins can contribute download schemes and download
+commands by implementing
+`com.google.gerrit.extensions.config.DownloadScheme` and
+`com.google.gerrit.extensions.config.DownloadCommand`.
+
+The download schemes and download commands which are used most often
+are provided by the Gerrit core plugin `download-commands`.
 
 [[documentation]]
 Documentation
@@ -384,11 +1079,11 @@
 `/Documentation/*` or `/static/*`, the core Gerrit server will
 automatically export these resources over HTTP from the plugin JAR.
 
-Static resources under `static/` directory in the JAR will be
+Static resources under the `static/` directory in the JAR will be
 available as `/plugins/helloworld/static/resource`. This prefix is
 configurable by setting the `Gerrit-HttpStaticPrefix` attribute.
 
-Documentation files under `Documentation/` directory in the JAR
+Documentation files under the `Documentation/` directory in the JAR
 will be available as `/plugins/helloworld/Documentation/resource`. This
 prefix is configurable by setting the `Gerrit-HttpDocumentationPrefix`
 attribute.
@@ -444,9 +1139,21 @@
 of the file, minus the `*.html` extension, as the link text. Any
 hyphens in the file name will be replaced with spaces.
 
+If a discovered file is named `about.md` or `about.html`, its
+content will be inserted in an 'About' section at the top of the
+auto-generated index page.  If both `about.md` and `about.html`
+exist, only the first discovered file will be used.
+
 If a discovered file name beings with `cmd-` it will be clustered
-into a 'Commands' section of the generated index page. All other
-files are clustered under a 'Documentation' section.
+into a 'Commands' section of the generated index page.
+
+If a discovered file name beings with `servlet-` it will be clustered
+into a 'Servlets' section of the generated index page.
+
+If a discovered file name beings with `rest-api-` it will be clustered
+into a 'REST APIs' section of the generated index page.
+
+All other files are clustered under a 'Documentation' section.
 
 Some optional information from the manifest is extracted and
 displayed as part of the index page, if present in the manifest:
@@ -481,6 +1188,12 @@
 Disabled plugins can be re-enabled using the
 link:cmd-plugin-enable.html[plugin enable] command.
 
+SEE ALSO
+--------
+
+* link:js-api.html[JavaScript API]
+* link:dev-rest-api.html[REST API Developers' Notes]
+
 GERRIT
 ------
 Part of link:index.html[Gerrit Code Review]
diff --git a/Documentation/dev-readme.txt b/Documentation/dev-readme.txt
index 67b4aad..ced8648 100644
--- a/Documentation/dev-readme.txt
+++ b/Documentation/dev-readme.txt
@@ -1,12 +1,13 @@
 Gerrit Code Review - Developer Setup
 ====================================
 
-Apache Maven is needed to compile the code, and a SQL database
-to house the review metadata.  H2 is recommended for development
+Facebook Buck is needed to compile the code, and an SQL database to
+house the review metadata.  H2 is recommended for development
 databases, as it requires no external server process.
 
-Get the Source
---------------
+
+Getting the Source
+------------------
 
 Create a new client workspace:
 
@@ -19,46 +20,27 @@
 the core plugins, which are included as git submodules, are also
 cloned.
 
+
+Compiling
+---------
+
+For details on how to build the source code with Buck, refer to:
+link:dev-buck.html#build[Building on the command line with Buck].
+
+
 Configuring Eclipse
 -------------------
 
 To use the Eclipse IDE for development, please see
-link:dev-eclipse.html[Eclipse Setup] for more details on how to
-configure the workspace with the Maven build scripts.
+link:dev-eclipse.html[Eclipse Setup].
 
+For details on how to configure the Eclipse workspace with Buck,
+refer to: link:dev-buck.html#eclipse[Eclipse integration with Buck].
 
-[[build]]
-Building
---------
-
-From the command line:
-
-----
-  mvn clean package
-----
-
-By default the build will run tests and build the documentation.
-
-To build without tests:
-
-----
-  mvn clean package -DskipTests
-----
-
-To build without documentation:
-
-----
-  mvn clean package -Dgerrit.documentation.skip
-----
-
-Output executable WAR will be placed in:
-
-----
-  gerrit-war/target/gerrit-*.war
-----
 
 Mac OS X
-~~~~~~~~
+--------
+
 On Mac OS X ensure "Java For Mac OS X 10.5 Upate 4" (or later) has
 been installed, and that `JAVA_HOME` is set to
 "/System/Library/Frameworks/JavaVM.framework/Versions/1.6/Home".
@@ -75,7 +57,7 @@
 testing site for development use:
 
 ----
-  java -jar gerrit-war/target/gerrit-*.war init -d ../test_site
+  java -jar buck-out/gen/gerrit.war init -d ../test_site
 ----
 
 Accept defaults by pressing Enter until 'init' completes, or add
@@ -97,7 +79,8 @@
 Testing
 -------
 
-[[run-acceptance-tests]]
+
+[[tests]]
 Running the Acceptance Tests
 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 
@@ -108,15 +91,10 @@
 started on that site. When the test has finished the Gerrit daemon is
 shutdown.
 
-Since the acceptance tests are too expensive to run every time
-Gerrit is built, they are only executed during the Maven verify phase
-if the Maven profile `acceptance` is enabled.
+For instructions on running the integration tests with Buck,
+please refer to:
+link:dev-buck.html#tests[Running integration tests with Buck].
 
-To execute the acceptance tests run:
-
-----
-  mvn clean verify -Pacceptance
-----
 
 Running the Daemon
 ~~~~~~~~~~~~~~~~~~
@@ -125,7 +103,7 @@
 copying to the test site:
 
 ----
-  java -jar gerrit-war/target/gerrit-*.war daemon -d ../test_site
+  java -jar buck-out/gen/gerrit.war daemon -d ../test_site
 ----
 
 
@@ -136,7 +114,7 @@
 command line.  If the daemon is not currently running:
 
 ----
-  java -jar gerrit-war/target/gerrit-*.war gsql -d ../test_site
+  java -jar buck-out/gen/gerrit.war gsql -d ../test_site
 ----
 
 Or, if it is running and the database is in use, connect over SSH
@@ -213,11 +191,6 @@
 
 * http://code.google.com/webtoolkit/download.html[Download]
 
-Apache Maven:
-
-* http://maven.apache.org/download.html[Download]
-* http://maven.apache.org/run-maven/index.html[Running]
-
 Apache SSHD:
 
 * http://mina.apache.org/sshd/[SSHD]
diff --git a/Documentation/dev-release-deploy-config.txt b/Documentation/dev-release-deploy-config.txt
index ffdb6ea..9c98fff 100644
--- a/Documentation/dev-release-deploy-config.txt
+++ b/Documentation/dev-release-deploy-config.txt
@@ -73,7 +73,7 @@
     <repository>
       <id>gerrit-maven-repository</id>
       <name>Gerrit Maven Repository</name>
-      <url>s3://gerrit-maven@commondatastorage.googleapis.com</url>
+      <url>gs://gerrit-maven</url>
       <uniqueVersion>true</uniqueVersion>
     </repository>
   </distributionManagement>
@@ -86,9 +86,9 @@
   <build>
     <extensions>
       <extension>
-        <groupId>net.anzix.aws</groupId>
-        <artifactId>s3-maven-wagon</artifactId>
-        <version>3.2</version>
+        <groupId>com.googlesource.gerrit</groupId>
+        <artifactId>gs-maven-wagon</artifactId>
+        <version>3.3</version>
       </extension>
     </extensions>
   </build>
@@ -107,7 +107,7 @@
     <repository>
       <id>gerrit-plugins-repository</id>
       <name>Gerrit Plugins Repository</name>
-      <url>s3://gerrit-plugins@commondatastorage.googleapis.com</url>
+      <url>gs://gerrit-plugins</url>
       <uniqueVersion>true</uniqueVersion>
     </repository>
   </distributionManagement>
@@ -120,9 +120,9 @@
   <build>
     <extensions>
       <extension>
-        <groupId>net.anzix.aws</groupId>
-        <artifactId>s3-maven-wagon</artifactId>
-        <version>3.2</version>
+        <groupId>com.googlesource.gerrit</groupId>
+        <artifactId>gs-maven-wagon</artifactId>
+        <version>3.3</version>
       </extension>
     </extensions>
   </build>
diff --git a/Documentation/dev-release-subproject.txt b/Documentation/dev-release-subproject.txt
index 5e3770d..956bd29 100644
--- a/Documentation/dev-release-subproject.txt
+++ b/Documentation/dev-release-subproject.txt
@@ -13,9 +13,9 @@
 `gerrit-api-repository` in the `pom.xml` is correct.
 +
 If `Gerrit-ApiVersion` references a released Gerrit version it must be
-`https://gerrit-api.commondatastorage.googleapis.com/release/`, if
+`https://gerrit-api.stoarge.googleapis.com/release/`, if
 `Gerrit-ApiVersion` references a snapshot Gerrit version it must be
-`https://gerrit-api.commondatastorage.googleapis.com/snapshot/`.
+`https://gerrit-api.storage.googleapis.com/snapshot/`.
 
 * Build the latest snapshot and install it into the local Maven
 repository:
diff --git a/Documentation/dev-release.txt b/Documentation/dev-release.txt
index cd7cd34..f9d0d0e 100644
--- a/Documentation/dev-release.txt
+++ b/Documentation/dev-release.txt
@@ -83,7 +83,7 @@
 
 
 Create the Actual Release
----------------------------
+-------------------------
 
 To create a Gerrit release the following steps have to be done:
 
@@ -157,7 +157,7 @@
 link:dev-release-deploy-config.html#deploy-configuration-settings-xml[
 configuration needed for deployment]
 
-* Push the Jars to `commondatastorage.googleapis.com`:
+* Push the Jars to `storage.googleapis.com`:
 +
 ----
   ./tools/deploy_api.sh
diff --git a/Documentation/dev-rest-api.txt b/Documentation/dev-rest-api.txt
new file mode 100644
index 0000000..0175a62
--- /dev/null
+++ b/Documentation/dev-rest-api.txt
@@ -0,0 +1,89 @@
+Gerrit Code Review - REST API Developers' Notes
+===============================================
+
+This document is about developing the REST API.  For details of the
+actual APIs available in Gerrit, please see the
+link:rest-api.html[REST API interface reference].
+
+
+Testing REST API Functionality
+------------------------------
+
+
+Basic Testing
+~~~~~~~~~~~~~
+
+Basic testing of REST API functionality can be done with `curl`:
+
+----
+  curl http://localhost:8080/path/to/api/
+----
+
+By default, `curl` sends `GET` requests.  To test APIs with `PUT`, `POST`,
+or `DELETE`, an additional argument is required:
+
+----
+ curl -X PUT http://localhost:8080/path/to/api/
+ curl -X POST http://localhost:8080/path/to/api/
+ curl -X DELETE http://localhost:8080/path/to/api/
+----
+
+
+Sending Data in the Request
+~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+Some REST APIs accept data in the request body of `PUT` and `POST` requests.
+
+Test data can be included from a local file:
+
+----
+  curl -X PUT -d@testdata.txt --header "Content-Type: application/json" http://localhost:8080/path/to/api/
+----
+
+Note that the `-d` option will remove the newlines from the content of the
+local file. If the content should be sent as-is then use the `--data-binary`
+option instead:
+
+----
+  curl -X PUT --data-binary @testdata.txt --header "Content-Type: text/plain" http://localhost:8080/path/to/api/
+----
+
+
+Authentication
+~~~~~~~~~~~~~~
+
+To test APIs that require authentication, the username and password must be specified on
+the command line:
+
+----
+ curl --digest --user username:password http://localhost:8080/a/path/to/api/
+----
+
+This makes it easy to switch users for testing of permissions.
+
+It is also possible to test with a username and password from the `.netrc`
+file (on Windows, `_netrc`):
+
+----
+ curl --digest -n http://localhost:8080/a/path/to/api/
+----
+
+In both cases, the password should be the user's link:user-upload.html#http[HTTP password].
+
+
+Verifying Header Content
+~~~~~~~~~~~~~~~~~~~~~~~~
+
+To verify the headers returned from a REST API call, use `curl` in verbose mode:
+
+----
+  curl -v -n --digest -X DELETE http://localhost:8080/a/path/to/api/
+----
+
+The headers on both the request and the response will be printed.
+
+
+GERRIT
+------
+Part of link:index.html[Gerrit Code Review]
+
diff --git a/Documentation/doc.css b/Documentation/doc.css
new file mode 100644
index 0000000..a1c2333
--- /dev/null
+++ b/Documentation/doc.css
@@ -0,0 +1,37 @@
+body {
+  margin: 1em;
+}
+
+#toctitle {
+  margin-top: 0.5em;
+  font-weight: bold;
+}
+
+h1, h2, h3, h4, h5, h6, #toctitle {
+  color: #527bbd;
+  font-family: sans-serif;
+}
+
+h1, h2, h3 {
+  border-bottom: 2px solid silver;
+}
+
+p {
+  margin: 0.5em 0 0.5em 0;
+}
+li p {
+  margin: 0.2em 0 0.2em 0;
+}
+
+.listingblock > .content {
+  border: 2px solid silver;
+  background: #ebebeb;
+  margin-left: 2em;
+  width: 100em;
+  color: darkgreen;
+  padding: 2px;
+}
+
+dl dt {
+  margin-top: 1em;
+}
diff --git a/Documentation/error-has-duplicates.txt b/Documentation/error-has-duplicates.txt
index e9e42f4..b5175c0 100644
--- a/Documentation/error-has-duplicates.txt
+++ b/Documentation/error-has-duplicates.txt
@@ -1,5 +1,5 @@
-... has duplicates
-==================
+\... has duplicates
+===================
 
 With this error message Gerrit rejects to push a commit if its commit
 message contains a Change-ID for which multiple changes can be found
diff --git a/Documentation/error-missing-changeid.txt b/Documentation/error-missing-changeid.txt
index b13f3b4..edbc63b 100644
--- a/Documentation/error-missing-changeid.txt
+++ b/Documentation/error-missing-changeid.txt
@@ -6,11 +6,12 @@
 message if the commit message of the pushed commit does not contain
 a Change-Id in the footer (the last paragraph).
 
-This error may happen for two reasons:
+This error may happen for different reasons:
 
 . missing Change-Id in the commit message
 . Change-Id is contained in the commit message but not in the last
   paragraph
+. Change-Id is the only line in the commit message
 
 You can see the commit messages for existing commits in the history
 by doing a link:http://www.kernel.org/pub/software/scm/git/docs/git-log.html[git log].
@@ -51,6 +52,20 @@
 Change-ID into the last paragraph. How to update the commit message
 is explained link:error-push-fails-due-to-commit-message.html[here].
 
+Change-Id is the only line in the commit message
+------------------------------------------------
+
+Gerrit does not parse the subject of a commit message for the
+Change-Id even if this is the only and last paragraph of the commit
+message.
+
+If the Change-Id is the only line in the commit message you must update
+the commit message and insert a subject as the first line in the commit
+message. The Change-Id must be in the last paragraph of the commit
+message, i.e. separated from the subject by a blank line. How to update
+the commit message is explained
+link:error-push-fails-due-to-commit-message.html[here].
+
 
 GERRIT
 ------
diff --git a/Documentation/gen_licenses.py b/Documentation/gen_licenses.py
new file mode 100755
index 0000000..fb03526
--- /dev/null
+++ b/Documentation/gen_licenses.py
@@ -0,0 +1,131 @@
+#!/usr/bin/python
+# 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.
+#
+# TODO(sop): Be more detailed: version, link to Maven Central
+
+from __future__ import print_function
+
+from collections import defaultdict, deque
+import re
+from shutil import copyfileobj
+from subprocess import Popen, PIPE
+from sys import stdout
+
+MAIN = ['//gerrit-pgm:pgm', '//gerrit-gwtui:ui_module']
+
+def parse_graph():
+  graph = defaultdict(list)
+  p = Popen(
+    ['buck', 'audit', 'classpath', '--dot'] + MAIN,
+    stdout = PIPE)
+  for line in p.stdout:
+    m = re.search(r'"(//.*?)" -> "(//.*?)";', line)
+    if not m:
+      continue
+    target, dep = m.group(1), m.group(2)
+    if not target.endswith('__compile'):
+      graph[target].append(dep)
+  r = p.wait()
+  if r != 0:
+    exit(r)
+  return graph
+
+graph = parse_graph()
+licenses = defaultdict(set)
+
+queue = deque(MAIN)
+while queue:
+  target = queue.popleft()
+  for dep in graph[target]:
+    if not dep.startswith('//lib:LICENSE-'):
+      continue
+    licenses[dep].add(target)
+  queue.extend(graph[target])
+used = sorted(licenses.keys())
+
+print("""\
+Gerrit Code Review - Licenses
+=============================
+
+Gerrit open source software is licensed under the <<Apache2_0,Apache
+License 2.0>>.  Executable distributions also include other software
+components that are provided under additional licenses.
+
+[[cryptography]]
+Cryptography Notice
+-------------------
+
+This distribution includes cryptographic software.  The country
+in which you currently reside may have restrictions on the import,
+possession, use, and/or re-export to another country, of encryption
+software.  BEFORE using any encryption software, please check
+your country's laws, regulations and policies concerning the
+import, possession, or use, and re-export of encryption software,
+to see if this is permitted.  See the
+link:http://www.wassenaar.org/[Wassenaar Arrangement]
+for more information.
+
+The U.S. Government Department of Commerce, Bureau of Industry
+and Security (BIS), has classified this software as Export
+Commodity Control Number (ECCN) 5D002.C.1, which includes
+information security software using or performing cryptographic
+functions with asymmetric algorithms.  The form and manner of
+this distribution makes it eligible for export under the License
+Exception ENC Technology Software Unrestricted (TSU) exception
+(see the BIS Export Administration Regulations, Section 740.13)
+for both object code and source code.
+
+Gerrit includes an SSH daemon (Apache SSHD), to support authenticated
+uploads of changes directly from `git push` command line clients.
+
+Gerrit includes an SSH client (JSch), to support authenticated
+replication of changes to remote systems, such as for automatic
+updates of mirror servers, or realtime backups.
+
+For either feature to function, Gerrit requires the
+link:http://java.sun.com/javase/technologies/security/[Java Cryptography extensions]
+and/or the
+link:http://www.bouncycastle.org/java.html[Bouncy Castle Crypto API]
+to be installed by the end-user.
+
+Licenses
+--------
+""")
+
+for n in used:
+  libs = sorted(licenses[n])
+  name = n[len('//lib:LICENSE-'):]
+  print()
+  print('[[%s]]' % name.replace('.', '_'))
+  print(name)
+  print('~' * len(name))
+  print()
+  for d in libs:
+    if d.startswith('//lib:') or d.startswith('//lib/'):
+      p = d[len('//lib:'):]
+    else:
+      p = d[d.index(':')+1:].lower()
+    print('* ' + p)
+  print()
+  print('----')
+  with open(n[2:].replace(':', '/')) as fd:
+    copyfileobj(fd, stdout)
+  print('----')
+
+print("""
+GERRIT
+------
+Part of link:index.html[Gerrit Code Review]
+""")
diff --git a/Documentation/index.txt b/Documentation/index.txt
index 88b50fa..58dae6e 100644
--- a/Documentation/index.txt
+++ b/Documentation/index.txt
@@ -1,72 +1,87 @@
 Gerrit Code Review for Git
 ==========================
 
-Getting Started
----------------
+Index
+-----
 
-* link:intro-quick.html[A Quick Introduction To Gerrit]
+. General info
+.. link:licenses.html[Licenses and Notices]
+. Installing
+.. link:intro-quick.html[A Quick Introduction To Gerrit]
+.. link:intro-change-screen.html[A Quick Introduction To The New Change Screen]
+.. link:install.html[Installation Guide]
+. Tutorial
+.. Get started
+... External link: link:http://source.android.com/submit-patches/workflow[Default Android Workflow]
+.. Web
+... Registering a new Gerrit account
+... link:user-search.html[Searching Changes]
+... link:user-notify.html[Subscribing to Email Notifications]
+.. Ssh
+... ssh connection details
+... link:cmd-index.html[Command Line Tools]
+.. Git
+... git connection details
+... Commands, scenarios
+.... link:user-upload.html[Uploading Changes]
+.... link:error-messages.html[Error Messages]
+... Changes
+.... link:user-changeid.html[Change-Id Lines]
+.... link:user-signedoffby.html[Signed-off-by Lines]
+... Patch sets
+. Project management
+.. link:project-setup.html[Project Setup]
+.. link:access-control.html[Access Controls]
+... link:config-labels.html[Review Labels]
+... link:config-project-config.html[Access Controls Configuration Format]
+.. Multi-project management
+... Submodules
+... Repo
+.. Prolog rules
+... link:prolog-cookbook.html[Prolog Cookbook]
+... link:prolog-change-facts.html[Prolog Facts for Gerrit Changes]
+.. link:user-submodules.html[Subscribing to Git Submodules]
+.. Project sunset
+. Customization and integration
+.. link:user-dashboards.html[Dashboards]
+.. link:rest-api.html[REST API]
+.. link:config-gitweb.html[Gitweb Integration]
+.. link:config-themes.html[Themes]
+.. link:config-sso.html[Single Sign-On Systems]
+.. link:config-hooks.html[Hooks]
+.. link:config-mail.html[Mail Templates]
+.. link:config-cla.html[Contributor Agreements]
+. Server administration
+.. link:config-gerrit.html[System Settings]
+.. Backup
+.. Performance tuning
+... link:cmd-index.html[Command Line Tools]
+... Reading show-caches efficiently
+... How to read stats from the JVM
+.. High availability
+.. Replication
+.. link:https://gerrit-review.googlesource.com/#/admin/projects/?filter=plugins%252F[Plugins]
+.. link:dev-design.html[System Design]
+.. link:config-contact.html[User Contact Information]
+.. link:config-reverseproxy.html[Reverse Proxy]
+.. link:config-auto-site-initialization.html[Automatic Site Initialization on Startup]
+.. link:pgm-index.html[Server Side Administrative Tools]
+. Developer
+.. link:dev-readme.html[Developer Setup]
+.. link:dev-buck.html[Building with Buck]
+.. link:dev-eclipse.html[Eclipse Setup]
+.. link:dev-contributing.html[Contributing to Gerrit]
+.. Documentation formatting guide for contributions
+.. link:dev-design.html[System Design]
+.. link:i18n-readme.html[i18n Support]
+.. Plugin development
+... link:dev-plugins.html[Developing Plugins]
+... link:js-api.html[JavaScript Plugin API]
+... link:config-validation.html[Commit Validation]
+. Maintainer
+.. link:dev-release.html[Developer Release]
+.. link:dev-release-subproject.html[Developer Subproject Release]
 
-End User Guide
---------------
-
-* External link: link:http://source.android.com/submit-patches/workflow[Default Android Workflow]
-* link:user-search.html[Searching Changes]
-* link:cmd-index.html[Command Line Tools]
-* link:user-upload.html[Uploading Changes]
-* link:user-changeid.html[Change-Id Lines]
-* link:user-signedoffby.html[Signed-off-by Lines]
-* link:error-messages.html[Error Messages]
-* link:user-notify.html[Subscribing to Email Notifications]
-
-Project Owner and Power User Guide
-----------------------------------
-
-* link:access-control.html[Access Controls]
-* link:rest-api.html[REST API]
-* link:user-dashboards.html[Dashboards]
-* link:user-submodules.html[Subscribing to Git Submodules]
-* link:prolog-cookbook.html[Prolog Cookbook]
-* link:prolog-change-facts.html[Prolog Facts for Gerrit Changes]
-* link:config-labels.html[Review Labels]
-
-Admin User Guide
-----------------
-
-* link:pgm-index.html[Server Side Administrative Tools]
-
-Installation
-~~~~~~~~~~~~
-
-* link:licenses.html[Licenses and Notices]
-* link:install.html[Installation Guide]
-* link:install-quick.html[Quick Installation in 10 Minutes]
-* link:project-setup.html[Project Setup]
-
-Configuration
-~~~~~~~~~~~~~
-
-* link:config-gerrit.html[System Settings]
-* link:config-contact.html[User Contact Information]
-* link:config-gitweb.html[Gitweb Integration]
-* link:config-themes.html[Themes]
-* link:config-sso.html[Single Sign-On Systems]
-* link:config-reverseproxy.html[Reverse Proxy]
-* link:config-hooks.html[Hooks]
-* link:config-mail.html[Mail Templates]
-* link:config-cla.html[Contributor Agreements]
-
-Gerrit Developer Documentation
-------------------------------
-
-* link:dev-readme.html[Developer Setup]
-* link:dev-eclipse.html[Eclipse Setup]
-* link:dev-contributing.html[Contributing to Gerrit]
-* link:dev-plugins.html[Developing Plugins]
-* link:config-validation.html[Commit Validation]
-* link:dev-design.html[System Design]
-* link:i18n-readme.html[i18n Support]
-* link:dev-release.html[Developer Release]
-* link:dev-release-subproject.html[Developer Subproject Release]
 
 Resources
 ---------
diff --git a/Documentation/install-j2ee.txt b/Documentation/install-j2ee.txt
index 4927041..5ba8cb1 100644
--- a/Documentation/install-j2ee.txt
+++ b/Documentation/install-j2ee.txt
@@ -21,7 +21,7 @@
   link:install.html#init[site initialization] tasks described
   in the standard installation documentation.
 
-* Stop the embedded deamon that was automatically started by 'init':
+* Stop the embedded daemon that was automatically started by 'init':
 +
 ----
   review_site/bin/gerrit.sh stop
@@ -46,6 +46,9 @@
 from `'$site_path'/lib` into your servlet container's extensions
 directory so it's available to Gerrit Code Review.
 
+* ('Optional') link:config-auto-site-initialization.html[
+Configure Automatic Site Initialization on Startup]
+
 
 Jetty 7.x
 ---------
diff --git a/Documentation/install.txt b/Documentation/install.txt
index a18a506..1d6d1bd 100644
--- a/Documentation/install.txt
+++ b/Documentation/install.txt
@@ -9,7 +9,7 @@
 
 * JDK, minimum version 1.6 http://www.oracle.com/technetwork/java/javase/downloads/index.html[Download]
 
-You'll also need a SQL database to house the review metadata. You have the
+You'll also need an SQL database to house the review metadata. You have the
 choice of either using the embedded H2 or to host your own MySQL or PostgreSQL.
 
 
@@ -18,9 +18,8 @@
 ---------------
 
 Current and past binary releases of Gerrit can be obtained from
-the downloads page at the project site:
-
-* http://code.google.com/p/gerrit/downloads/list[Gerrit Downloads]
+the link:https://gerrit-releases.storage.googleapis.com/index.html[
+Gerrit Releases site].
 
 Download any current `*.war` package. The war will be referred to as
 `gerrit.war` from this point forward, so you may find it easier to
@@ -121,14 +120,29 @@
   review_site/bin/gerrit.sh restart
 ====
 
-('Optional') Link the gerrit.sh script into rc3.d so the daemon
-automatically starts and stops with the operating system:
+('Optional') Configure the daemon to automatically start and stop
+with the operating system.
+
+Uncomment the following 3 lines in the `'$site_path/bin/gerrit.sh'`
+script:
+
+====
+ chkconfig: 3 99 99
+ description: Gerrit Code Review
+ processname: gerrit
+====
+
+Then link the `gerrit.sh` script into `rc3.d`:
 
 ====
   sudo ln -snf `pwd`/review_site/bin/gerrit.sh /etc/init.d/gerrit
   sudo ln -snf /etc/init.d/gerrit /etc/rc3.d/S90gerrit
 ====
 
+('Optional') To enable autocompletion of the gerrit.sh commands, install
+autocompletion from the `/contrib/bash_completion` script.  Refer to the
+script's header comments for installation instructions.
+
 To install Gerrit into an existing servlet container instead of using
 the embedded Jetty server, see
 link:install-j2ee.html[J2EE installation].
@@ -146,6 +160,7 @@
 * link:config-themes.html[Themes]
 * link:config-gitweb.html[Gitweb Integration]
 * link:config-gerrit.html[Other System Settings]
+* link:config-auto-site-initialization.html[Automatic Site Initialization on Startup]
 
 
 [[anonymous_access]]
diff --git a/Documentation/intro-change-screen.txt b/Documentation/intro-change-screen.txt
new file mode 100644
index 0000000..2913336
--- /dev/null
+++ b/Documentation/intro-change-screen.txt
@@ -0,0 +1,216 @@
+Change Screen - Introduction
+============================
+
+As of Gerrit 2.8 the change screen was redesigned from the ground up. The old
+change screen is deprecated and will be discontinued in one of the next Gerrit
+releases.
+
+The design spirit of the new change screen is simplicity: only one patch set is
+presented on the screen. The list of related changes is always visible and
+optional elements are moved to pop down boxes.
+
+This is not only a facelift. The main highlights are under the hood:
+
+* Old style RPC calls are replaced by the REST API
+* The prettify syntax highlighting library was replaced by Codemirror
+* Automatic refresh of open changes
+* Support to download a patch direct in browser: no local repo is needed
+* JS API integration: it was never so easy to add change/revision actions to
+the UI from a plugin.
+
+This document is intended to help users to switch to the new change screen.
+
+Further information on the topic can be found in the:
+link:https://groups.google.com/forum/#!topic/repo-discuss/6Ryz9p6AzgE[
+CodeScreen2 thread on the repo-discuss mailing list].
+
+[[configuration]]
+Configuration
+-------------
+
+The new change screen is deactivated by default. It can be activated system-wide
+by changing the link:config-gerrit.html[gerrit.changeScreen] setting to
+`CHANGE_SCREEN2`.  Users can deactivate it by setting `OLD_UI` on their user
+preferences page.
+
+[[switching-between-patch-sets]]
+Switching between patch sets
+----------------------------
+
+As already mentioned above, the main difference between the old and the new
+change screen is the fact that only one patch set is presented on the screen.
+
+To switch to other patch sets for the given change, the drop down 'Revisions'
+box is used on the right upper side of the change header.
+
+Patch sets are always sorted in descending order. The option to switch between
+ascending and reverse patch set sorting order is not supported on the new change
+screen.
+
+[[download-commands]]
+Download commands
+-----------------
+
+The download commands are moved to the 'Download' drop down box.  Patch files
+can be downloaded as base64 encoded or zipped versions.
+
+[[quick-approve]]
+Quick approve
+-------------
+
+The so called 'Quick approve' button is some times confusing. Normal users (i.e.
+non-maintainers) see this as 'Verified+1' button to the right of the 'Reply'
+button.
+
+The button is not always "Verified+1". The button appears if a user has
+permission to vote the max score in exactly one label that the rules have marked
+as NEED.
+
+For a maintainer with both 'Verified+1' and 'Code-Review+2' powers the button
+does not appear, as both categories are still marked NEED and the maintainer has
+permission to use both.  If another maintainer scores 'Code-Review+2', then the
+button displays as 'Verified+1'. If a verifier scores 'Verified+1' the button
+displays as 'Code-Review+2'.
+
+It is important to note that by design, the user cannot provide a comment when
+using this button, hence the name 'Quick approve'. To provide comments, the
+'Reply' button should be used.
+
+[[reply-button]]
+Reply button
+------------
+
+This button corresponds to the 'Review' button the on patch set panel on the old
+change screen.  The only new feature: the user can optionaly send an email
+during the vote.
+
+Key bindings: "a" to open the drop down. "ESC" to close it.
+
+
+[[edit-commit-message]]
+Edit commit message
+-------------------
+
+To edit the commit message use the 'Edit Message' button on the change header,
+which will open a drop-down editor box.
+
+Key bindings: "e" to open the drop down. "ESC" to close it.
+
+[[edit-change-topic]]
+Edit change topic
+-----------------
+
+To edit the topic use the edit icon to the right of the topic field.
+
+Key bindings: "t" to open the drop down. "ESC" to close it.
+
+[[abandon-restore]]
+Abandon or Restore changes
+--------------------------
+
+When a change is abandoned or restored, a panel appears and a comment message
+can be provided.
+
+[[working-with-drafts]]
+Working with draft changes and patch sets
+-----------------------------------------
+
+When a change or a patch set is a draft, then three additional buttons appear on
+the action panel: 'Publish', 'Delete Revision', and 'Delete Change'. In the
+'Revisions' drop down a "(DRAFT)" suffix is added to the patch set number to
+indicate that the patch set is a draft.
+
+[[draft-comments]]
+Highlight draft comments
+------------------------
+
+If a patch set has draft comments that weren't published yet, then that patch
+set is marked on the list in the 'Revisions' drop down list. In addition a red
+"draft" prefix appears on the filenames in the file table.
+
+[[codemirror]]
+Codemirror
+----------
+
+On the user preferences page, 'Side By Side' or 'Unified Diff' view can be
+configured.  Use the "/" key to start the CodeMirror search, like in vim.
+
+Key bindings are not customizable at the moment. They may be added in the future.
+
+Range comments are supported on Codemirror's 'Side By Side' screen.  Highlight
+lines with the mouse and then click the bottom-most line number to create a
+range comment for the highlighted lines.
+
+[[reviewers]]
+Reviewers
+---------
+
+Reviewer are split into two groups: Reviewers who actually voted on the change
+in the 'Reviewers' field, and reviewers, who were added to the change but didn't
+vote yet in the 'CC' field.
+
+The votes per category are listed above the File list.
+
+To add a reviewer, use the '[+]' button to the right of the 'CC' field. Typing
+into the pop-up text field activates auto completion of user or group names.
+
+To remove reviewers click on the 'x' icon in the reviewer's "chip".
+
+Key bindings:  "c" to add a reviewer. "ESC" to close the drop down.
+
+[[auto-refresh]]
+Auto refresh of change data
+---------------------------
+
+On the new change screen polling for updates to the currently open change is
+activated per default.  For example, if another user votes or comments on the
+same change, then a popup window appears on the bottom right corner of the
+screen to notify the user that the change was updated.
+
+The default delay is 30 seconds.  It can be configured with the
+link:config-gerrit.html[change.updateDelay] setting.
+
+[[depends-on-needed-by]]
+"Depends on" and "Needed by"
+----------------------------
+
+Dependencies and dependent changes are listed in the 'Related Changes' drop
+down.
+
+Key bindings:  "J" & "K" to navigate between the related changes. "O" to
+open the currently selected related change.
+
+[[file-table]]
+File table
+----------
+
+The user can now manually toggle the 'reviewed' flag per file using the check
+box to the left of the filename.
+
+Key bindings: "j" & "k" to navigate in the file table, and "r" to toggle the
+'reviewed' flag.
+
+[[included-in]]
+Included in
+-----------
+
+To see the branches a specific change was merged into and the list of the tags
+a change was tagged with, use the 'Included In' drop down on the change header,
+to the left of the 'Revisions' drop down.
+
+Note that this list is only visible on merged changes.
+
+[[missing-features]]
+Missing features
+----------------
+
+Several features have not been implemented yet:
+
+* Permalink a change
+* Allow to see if a reviewer can't vote on a label
+* Allow to select a reference version as base for the comparison
+* Change diff view preferences
+
+GERRIT
+------
+Part of link:index.html[Gerrit Code Review]
diff --git a/Documentation/js-api.txt b/Documentation/js-api.txt
new file mode 100644
index 0000000..2e97ac4
--- /dev/null
+++ b/Documentation/js-api.txt
@@ -0,0 +1,638 @@
+Gerrit Code Review - JavaScript API
+===================================
+
+Gerrit Code Review supports an API for JavaScript plugins to interact
+with the web UI and the server process.
+
+Entry Point
+-----------
+
+JavaScript is loaded using a standard `<script src='...'>` HTML tag.
+Plugins should protect the global namespace by defining their code
+within an anonymous function passed to `Gerrit.install()`. The plugin
+will be passed an object describing its registration with Gerrit:
+
+[source,javascript]
+----
+Gerrit.install(function (self) {
+  // ... plugin JavaScript code here ...
+});
+----
+
+
+[[self]]
+Plugin Instance
+---------------
+
+The plugin instance is passed to the plugin's initialization function
+and provides a number of utility services to plugin authors.
+
+[[self_delete]]
+self.delete()
+~~~~~~~~~~~~~
+Issues a DELETE REST API request to the Gerrit server.
+
+.Signature
+[source,javascript]
+----
+Gerrit.delete(url, callback)
+----
+
+* url: URL relative to the plugin's URL space. The JavaScript
+  library prefixes the supplied URL with `/plugins/{getPluginName}/`.
+
+* callback: JavaScript function to be invoked with the parsed
+  JSON result of the API call. DELETE methods often return
+  `204 No Content`, which is passed as null.
+
+[[self_get]]
+self.get()
+~~~~~~~~~~
+Issues a GET REST API request to the Gerrit server.
+
+.Signature
+[source,javascript]
+----
+self.get(url, callback)
+----
+
+* url: URL relative to the plugin's URL space. The JavaScript
+  library prefixes the supplied URL with `/plugins/{getPluginName}/`.
+
+* callback: JavaScript function to be invoked with the parsed JSON
+  result of the API call. If the API returns a string the result is
+  a string, otherwise the result is a JavaScript object or array,
+  as described in the relevant REST API documentation.
+
+[[self_getPluginName]]
+self.getPluginName()
+~~~~~~~~~~~~~~~~~~~~
+Returns the name this plugin was installed as by the server
+administrator. The plugin name is required to access REST API
+views installed by the plugin, or to access resources.
+
+[[self_post]]
+self.post()
+~~~~~~~~~~~
+Issues a POST REST API request to the Gerrit server.
+
+.Signature
+[source,javascript]
+----
+self.post(url, input, callback)
+----
+
+* url: URL relative to the plugin's URL space. The JavaScript
+  library prefixes the supplied URL with `/plugins/{getPluginName}/`.
+
+* input: JavaScript object to serialize as the request payload.
+
+* callback: JavaScript function to be invoked with the parsed JSON
+  result of the API call. If the API returns a string the result is
+  a string, otherwise the result is a JavaScript object or array,
+  as described in the relevant REST API documentation.
+
+[source,javascript]
+----
+self.post(
+  '/my-servlet',
+  {start_build: true, platform_type: 'Linux'},
+  function (r) {});
+----
+
+[[self_put]]
+self.put()
+~~~~~~~~~~
+Issues a PUT REST API request to the Gerrit server.
+
+.Signature
+[source,javascript]
+----
+self.put(url, input, callback)
+----
+
+* url: URL relative to the plugin's URL space. The JavaScript
+  library prefixes the supplied URL with `/plugins/{getPluginName}/`.
+
+* input: JavaScript object to serialize as the request payload.
+
+* callback: JavaScript function to be invoked with the parsed JSON
+  result of the API call. If the API returns a string the result is
+  a string, otherwise the result is a JavaScript object or array,
+  as described in the relevant REST API documentation.
+
+[source,javascript]
+----
+self.put(
+  '/builds',
+  {start_build: true, platform_type: 'Linux'},
+  function (r) {});
+----
+
+[[self_onAction]]
+self.onAction()
+~~~~~~~~~~~~~~~
+Register a JavaScript callback to be invoked when the user clicks
+on a button associated with a server side `UiAction`.
+
+.Signature
+[source,javascript]
+----
+Gerrit.onAction(type, view_name, callback);
+----
+
+* type: `'change'`, `'revision'` or `'project'`, indicating which type
+  of resource the `UiAction` was bound to in the server.
+
+* view_name: string appearing in URLs to name the view. This is the
+  second argument of the `get()`, `post()`, `put()`, and `delete()`
+  binding methods in a `RestApiModule`.
+
+* callback: JavaScript function to invoke when the user clicks. The
+  function will be passed a link:#ActionContext[action context].
+
+[[self_url]]
+self.url()
+~~~~~~~~~~
+Returns a URL within the plugin's URL space. If invoked with no
+parameter the URL of the plugin is returned. If passed a string
+the argument is appended to the plugin URL.
+
+[source,javascript]
+----
+self.url();                    // "https://gerrit-review.googlesource.com/plugins/demo/"
+self.url('/static/icon.png');  // "https://gerrit-review.googlesource.com/plugins/demo/static/icon.png"
+----
+
+
+[[ActionContext]]
+Action Context
+--------------
+A new action context is passed to the `onAction` callback function
+each time the associated action button is clicked by the user. A
+context is initialized with sufficient state to issue the associated
+REST API RPC.
+
+[[context_action]]
+context.action
+~~~~~~~~~~~~~~
+An link:rest-api-changes.html#action-info[ActionInfo] object instance
+supplied by the server describing the UI button the user used to
+invoke the action.
+
+[[context_call]]
+context.call()
+~~~~~~~~~~~~~~
+Issues the REST API call associated with the action. The HTTP method
+used comes from `context.action.method`, hiding the JavaScript from
+needing to care.
+
+.Signature
+[source,javascript]
+----
+context.call(input, callback)
+----
+
+* input: JavaScript object to serialize as the request payload. This
+  parameter is ignored for GET and DELETE methods.
+
+* callback: JavaScript function to be invoked with the parsed JSON
+  result of the API call. If the API returns a string the result is
+  a string, otherwise the result is a JavaScript object or array,
+  as described in the relevant REST API documentation.
+
+[source,javascript]
+----
+context.call(
+  {message: "..."},
+  function (result) {
+    // ... use result here ...
+  });
+----
+
+[[context_change]]
+context.change
+~~~~~~~~~~~~~~
+When the action is invoked on a change a
+link:rest-api-changes.html#change-info[ChangeInfo] object instance
+describing the change. Available fields of the ChangeInfo may vary
+based on the options used by the UI when it loaded the change.
+
+[[context_delete]]
+context.delete()
+~~~~~~~~~~~~~~~~
+Issues a DELETE REST API call to the URL associated with the action.
+
+.Signature
+[source,javascript]
+----
+context.delete(callback)
+----
+
+* callback: JavaScript function to be invoked with the parsed
+  JSON result of the API call. DELETE methods often return
+  `204 No Content`, which is passed as null.
+
+[source,javascript]
+----
+context.delete(function () {});
+----
+
+[[context_get]]
+context.get()
+~~~~~~~~~~~~~
+Issues a GET REST API call to the URL associated with the action.
+
+.Signature
+[source,javascript]
+----
+context.get(callback)
+----
+
+* callback: JavaScript function to be invoked with the parsed JSON
+  result of the API call. If the API returns a string the result is
+  a string, otherwise the result is a JavaScript object or array,
+  as described in the relevant REST API documentation.
+
+[source,javascript]
+----
+context.get(function (result) {
+  // ... use result here ...
+});
+----
+
+[[context_go]]
+context.go()
+~~~~~~~~~~~~
+Go to a page. Shorthand for link:#Gerrit_go[`Gerrit.go()`].
+
+[[context_hide]]
+context.hide()
+~~~~~~~~~~~~~~
+Hide the currently visible popup displayed by
+link:#context_popup[`context.popup()`].
+
+[[context_post]]
+context.post()
+~~~~~~~~~~~~~~
+Issues a POST REST API call to the URL associated with the action.
+
+.Signature
+[source,javascript]
+----
+context.post(input, callback)
+----
+
+* input: JavaScript object to serialize as the request payload.
+
+* callback: JavaScript function to be invoked with the parsed JSON
+  result of the API call. If the API returns a string the result is
+  a string, otherwise the result is a JavaScript object or array,
+  as described in the relevant REST API documentation.
+
+[source,javascript]
+----
+context.post(
+  {message: "..."},
+  function (result) {
+    // ... use result here ...
+  });
+----
+
+[[context_popup]]
+context.popup()
+~~~~~~~~~~~~~~~
+
+Displays a small popup near the activation button to gather
+additional input from the user before executing the REST API RPC.
+
+The caller is always responsible for closing the popup with
+link#context_hide[`context.hide()`]. Gerrit will handle closing a
+popup if the user presses `Escape` while keyboard focus is within
+the popup.
+
+.Signature
+[source,javascript]
+----
+context.popup(element)
+----
+
+* element: an HTML DOM element to display as the body of the
+  popup. This is typically a `div` element but can be any valid HTML
+  element. CSS can be used to style the element beyond the defaults.
+
+A common usage is to gather more input:
+
+[source,javascript]
+----
+self.onAction('revision', 'start-build', function (c) {
+  var l = c.checkbox();
+  var m = c.checkbox();
+  c.popup(c.div(
+    c.div(c.label(l, 'Linux')),
+    c.div(c.label(m, 'Mac OS X')),
+    c.button('Build', {onclick: function() {
+      c.call(
+        {
+          commit: c.revision.name,
+          linux: l.checked,
+          mac: m.checked,
+        },
+        function() { c.hide() });
+    });
+});
+----
+
+[[context_put]]
+context.put()
+~~~~~~~~~~~~~
+Issues a PUT REST API call to the URL associated with the action.
+
+.Signature
+[source,javascript]
+----
+context.put(input, callback)
+----
+
+* input: JavaScript object to serialize as the request payload.
+
+* callback: JavaScript function to be invoked with the parsed JSON
+  result of the API call. If the API returns a string the result is
+  a string, otherwise the result is a JavaScript object or array,
+  as described in the relevant REST API documentation.
+
+[source,javascript]
+----
+context.put(
+  {message: "..."},
+  function (result) {
+    // ... use result here ...
+  });
+----
+
+[[context_refresh]]
+context.refresh()
+~~~~~~~~~~~~~~~~~
+Refresh the current display. Shorthand for
+link:#Gerrit_refresh[`Gerrit.refresh()`].
+
+[[context_revision]]
+context.revision
+~~~~~~~~~~~~~~~~
+When the action is invoked on a specific revision of a change,
+a link:rest-api-changes.html#revision-info[RevisionInfo]
+object instance describing the revision. Available fields of the
+RevisionInfo may vary based on the options used by the UI when it
+loaded the change.
+
+[[context_project]]
+context.project
+~~~~~~~~~~~~~~~
+When the action is invoked on a specific project,
+the name of the project.
+
+Action Context HTML Helpers
+---------------------------
+The link:#ActionContext[action context] includes some HTML helper
+functions to make working with DOM based widgets less painful.
+
+* `br()`: new `<br>` element.
+
+* `button(label, options)`: new `<button>` with the string `label`
+  wrapped inside of a `div`. The optional `options` object may
+  define `onclick` as a function to be invoked upon clicking. This
+  calling pattern avoids circular references between the element
+  and the onclick handler.
+
+* `checkbox()`: new `<input type='checkbox'>` element.
+* `div(...)`: a new `<div>` wrapping the (optional) arguments.
+* `hr()`: new `<hr>` element.
+
+* `label(c, label)`: a new `<label>` element wrapping element `c`
+  and the string `label`. Used to wrap a checkbox with its label,
+  `label(checkbox(), 'Click Me')`.
+
+* `prependLabel(label, c)`: a new `<label>` element wrapping element `c`
+  and the string `label`. Used to wrap an input field with its label,
+  `prependLabel('Greeting message', textfield())`.
+
+* `textarea(options)`: new `<textarea>` element. The options
+  object may optionally include `rows` and `cols`. The textarea
+  comes with an onkeypress handler installed to play nicely with
+  Gerrit's keyboard binding system.
+
+* `textfield()`: new `<input type='text'>` element.  The text field
+  comes with an onkeypress handler installed to play nicely with
+  Gerrit's keyboard binding system.
+
+* `span(...)`: a new `<span>` wrapping the (optional) arguments.
+
+* `msg(label)`: a new label.
+
+[[Gerrit]]
+Gerrit
+------
+
+The `Gerrit` object is the only symbol provided into the global
+namespace by Gerrit Code Review. All top-level functions can be
+accessed through this name.
+
+[[Gerrit_delete]]
+Gerrit.delete()
+~~~~~~~~~~~~~~~
+Issues a DELETE REST API request to the Gerrit server. For plugin
+private REST API URLs see link:#self_delete[self.delete()].
+
+.Signature
+[source,javascript]
+----
+Gerrit.delete(url, callback)
+----
+
+* url: URL relative to the Gerrit server. For example to access the
+  link:rest-api-changes.html[changes REST API] use `'/changes/'`.
+
+* callback: JavaScript function to be invoked with the parsed
+  JSON result of the API call. DELETE methods often return
+  `204 No Content`, which is passed as null.
+
+[source,javascript]
+----
+Gerrit.delete(
+  '/changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/topic',
+  function () {});
+----
+
+[[Gerrit_get]]
+Gerrit.get()
+~~~~~~~~~~~~
+Issues a GET REST API request to the Gerrit server. For plugin
+private REST API URLs see link:#self_get[self.get()].
+
+.Signature
+[source,javascript]
+----
+Gerrit.get(url, callback)
+----
+
+* url: URL relative to the Gerrit server. For example to access the
+  link:rest-api-changes.html[changes REST API] use `'/changes/'`.
+
+* callback: JavaScript function to be invoked with the parsed JSON
+  result of the API call. If the API returns a string the result is
+  a string, otherwise the result is a JavaScript object or array,
+  as described in the relevant REST API documentation.
+
+[source,javascript]
+----
+Gerrit.get('/changes/?q=status:open', function (open) {
+  for (var i = 0; i < open.length; i++) {
+    console.log(open.get(i).change_id);
+  }
+});
+----
+
+[[Gerrit_getPluginName]]
+Gerrit.getPluginName()
+~~~~~~~~~~~~~~~~~~~~~~
+Returns the name this plugin was installed as by the server
+administrator. The plugin name is required to access REST API
+views installed by the plugin, or to access resources.
+
+Unlike link:#self_getPluginName[`self.getPluginName()`] this method
+must guess the name from the JavaScript call stack. Plugins are
+encouraged to use `self.getPluginName()` whenever possible.
+
+[[Gerrit_go]]
+Gerrit.go()
+~~~~~~~~~~~
+Updates the web UI to display the view identified by the supplied
+URL token. The URL token is the text after `#` in the browser URL.
+
+[source,javascript]
+----
+Gerrit.go('/admin/projects/');
+----
+
+If the URL passed matches `http://...`, `https://...`, or `//...`
+the current browser window will navigate to the non-Gerrit URL.
+The user can return to Gerrit with the back button.
+
+[[Gerrit_install]]
+Gerrit.install()
+~~~~~~~~~~~~~~~~
+Registers a new plugin by invoking the supplied initialization
+function. The function is passed the link:#self[plugin instance].
+
+[source,javascript]
+----
+Gerrit.install(function (self) {
+  // ... plugin JavaScript code here ...
+});
+----
+
+[[Gerrit_post]]
+Gerrit.post()
+~~~~~~~~~~~~~
+Issues a POST REST API request to the Gerrit server. For plugin
+private REST API URLs see link:#self_post[self.post()].
+
+.Signature
+[source,javascript]
+----
+Gerrit.post(url, input, callback)
+----
+
+* url: URL relative to the Gerrit server. For example to access the
+  link:rest-api-changes.html[changes REST API] use `'/changes/'`.
+
+* input: JavaScript object to serialize as the request payload.
+
+* callback: JavaScript function to be invoked with the parsed JSON
+  result of the API call. If the API returns a string the result is
+  a string, otherwise the result is a JavaScript object or array,
+  as described in the relevant REST API documentation.
+
+[source,javascript]
+----
+Gerrit.post(
+  '/changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/topic',
+  {topic: 'tests', message: 'Classify work as for testing.'},
+  function (r) {});
+----
+
+[[Gerrit_put]]
+Gerrit.put()
+~~~~~~~~~~~~
+Issues a PUT REST API request to the Gerrit server. For plugin
+private REST API URLs see link:#self_put[self.put()].
+
+.Signature
+[source,javascript]
+----
+Gerrit.put(url, input, callback)
+----
+
+* url: URL relative to the Gerrit server. For example to access the
+  link:rest-api-changes.html[changes REST API] use `'/changes/'`.
+
+* input: JavaScript object to serialize as the request payload.
+
+* callback: JavaScript function to be invoked with the parsed JSON
+  result of the API call. If the API returns a string the result is
+  a string, otherwise the result is a JavaScript object or array,
+  as described in the relevant REST API documentation.
+
+[source,javascript]
+----
+Gerrit.put(
+  '/changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/topic',
+  {topic: 'tests', message: 'Classify work as for testing.'},
+  function (r) {});
+----
+
+[[Gerrit_onAction]]
+Gerrit.onAction()
+~~~~~~~~~~~~~~~~~
+Register a JavaScript callback to be invoked when the user clicks
+on a button associated with a server side `UiAction`.
+
+.Signature
+[source,javascript]
+----
+Gerrit.onAction(type, view_name, callback);
+----
+
+* type: `'change'` or `'revision'`, indicating what sort of resource
+  the `UiAction` was bound to in the server.
+
+* view_name: string appearing in URLs to name the view. This is the
+  second argument of the `get()`, `post()`, `put()`, and `delete()`
+  binding methods in a `RestApiModule`.
+
+* callback: JavaScript function to invoke when the user clicks. The
+  function will be passed a link:#ActionContext[ActionContext].
+
+[[Gerrit_refresh]]
+Gerrit.refresh()
+~~~~~~~~~~~~~~~~
+Redisplays the current web UI view, refreshing all information.
+
+[[Gerrit_url]]
+Gerrit.url()
+~~~~~~~~~~~~
+Returns the URL of the Gerrit Code Review server. If invoked with
+no parameter the URL of the site is returned. If passed a string
+the argument is appended to the site URL.
+
+[source,javascript]
+----
+Gerrit.url();        // "https://gerrit-review.googlesource.com/"
+Gerrit.url('/123');  // "https://gerrit-review.googlesource.com/123"
+----
+
+For a plugin specific version see link:#self_url()[`self.url()`].
+
+GERRIT
+------
+Part of link:index.html[Gerrit Code Review]
diff --git a/Documentation/json.txt b/Documentation/json.txt
index 3893e3f..2836e5b 100644
--- a/Documentation/json.txt
+++ b/Documentation/json.txt
@@ -115,11 +115,13 @@
 createdOn:: Time in seconds since the UNIX epoch when this patchset
 was created.
 
+isDraft:: Whether or not the patch set is a draft patch set.
+
 approvals:: The <<approval,approval attribute>> granted.
 
 comments:: All comments for this patchset in <<patchsetcomment,patchsetComment attributes>>.
 
-files:: All changed files in this patchset in <<patch,patch attributes>>.
+files:: All changed files in this patchset in <<file,file attributes>>.
 
 sizeInsertions:: Size information of insertions of this patchset.
 
@@ -235,9 +237,9 @@
 
 message:: The comment text.
 
-[[patch]]
-patch
------
+[[file]]
+file
+----
 Information about a patch on a file.
 
 file:: The name of the file.  If the file is renamed, the new name.
diff --git a/Documentation/licenses.txt b/Documentation/licenses.txt
deleted file mode 100644
index fbdd9cd..0000000
--- a/Documentation/licenses.txt
+++ /dev/null
@@ -1,1189 +0,0 @@
-Gerrit Code Review - Licenses
-=============================
-
-Gerrit itself is licensed under the <<apache2,Apache License 2.0>>.
-Gerrit's executable distributions also include many other software
-components that are covered by additional licenses.
-
-Included Components
--------------------
-
-[options="header"]
-|======================================================================
-|Included Package           | License
-|Gerrit Code Review         | <<apache2,Apache License 2.0>>
-|gwtjsonrpc                 | <<apache2,Apache License 2.0>>
-|gwtorm                     | <<apache2,Apache License 2.0>>
-|Google Gson                | <<apache2,Apache License 2.0>>
-|Google Web Toolkit         | <<apache2,Apache License 2.0>>
-|Guice                      | <<apache2,Apache License 2.0>>
-|Guava Libraries            | <<apache2,Apache License 2.0>>
-|Apache Commons Codec       | <<apache2,Apache License 2.0>>
-|Apache Commons DBCP        | <<apache2,Apache License 2.0>>
-|Apache Commons Http Client | <<apache2,Apache License 2.0>>
-|Apache Commons Lang        | <<apache2,Apache License 2.0>>
-|Apache Commons Logging     | <<apache2,Apache License 2.0>>
-|Apache Commons Net         | <<apache2,Apache License 2.0>>
-|Apache Commons Pool        | <<apache2,Apache License 2.0>>
-|Apache Log4J               | <<apache2,Apache License 2.0>>
-|Apache MINA                | <<apache2,Apache License 2.0>>
-|Apache Tomcat Servlet API  | <<apache2,Apache License 2.0>>
-|Apache SSHD                | <<apache2,Apache License 2.0>>, see also <<sshd,NOTICE>>
-|Apache Velocity            | <<apache2,Apache License 2.0>>
-|Apache Xerces              | <<apache2,Apache License 2.0>>
-|OpenID4Java                | <<apache2,Apache License 2.0>>
-|Neko HTML                  | <<apache2,Apache License 2.0>>
-|mime-util                  | <<apache2,Apache License 2.0>>
-|Jetty                      | <<apache2,Apache License 2.0>>, or link:http://www.eclipse.org/legal/epl-v10.html[EPL]
-|Prolog Cafe                | <<prolog_cafe,EPL or GPL>>
-|Google Code Prettify       | <<apache2,Apache License 2.0>>
-|JavaEWAH                   | <<apache2,Apache License 2.0>>
-|JGit                       | <<jgit,New-Style BSD>>
-|JSch                       | <<sshd,New-Style BSD>>
-|PostgreSQL JDBC Driver     | <<postgresql,New-Style BSD>>
-|H2 Database                | <<h2,EPL or modified MPL>>
-|ObjectWeb ASM              | <<asm,New-Style BSD>>
-|ANTLR                      | <<antlr,New-Style BSD>>
-|args4j                     | <<args4j,MIT License>>
-|SLF4J                      | <<slf4j,MIT License>>
-|Clippy                     | <<clippy,MIT License>>
-|juniversalchardet          | <<mpl1_1,MPL 1.1>>
-|AOP Alliance               | Public Domain
-|JSR 305                    | <<jsr305,New-Style BSD>>
-|dk.brics.automaton         | <<automaton,New-Style BSD>>
-|Java Concurrency in Practice Annotations | <<jcip,Create Commons Attribution License>>
-|pegdown                    | <<apache2,Apache License 2.0>>
-|======================================================================
-
-Cryptography Notice
--------------------
-
-This distribution includes cryptographic software.  The country
-in which you currently reside may have restrictions on the import,
-possession, use, and/or re-export to another country, of encryption
-software.  BEFORE using any encryption software, please check
-your country's laws, regulations and policies concerning the
-import, possession, or use, and re-export of encryption software,
-to see if this is permitted.  See the
-link:http://www.wassenaar.org/[Wassenaar Arrangement]
-for more information.
-
-The U.S. Government Department of Commerce, Bureau of Industry
-and Security (BIS), has classified this software as Export
-Commodity Control Number (ECCN) 5D002.C.1, which includes
-information security software using or performing cryptographic
-functions with asymmetric algorithms.  The form and manner of
-this distribution makes it eligible for export under the License
-Exception ENC Technology Software Unrestricted (TSU) exception
-(see the BIS Export Administration Regulations, Section 740.13)
-for both object code and source code.
-
-Gerrit includes an SSH daemon (Apache SSHD), to support authenticated
-uploads of changes directly from `git push` command line clients.
-
-Gerrit includes an SSH client (JSch), to support authenticated
-replication of changes to remote systems, such as for automatic
-updates of mirror servers, or realtime backups.
-
-For either feature to function, Gerrit requires the
-link:http://java.sun.com/javase/technologies/security/[Java Cryptography extensions]
-and/or the
-link:http://www.bouncycastle.org/java.html[Bouncy Castle Crypto API]
-to be installed by the end-user.
-
-Licenses
---------
-
-[[apache2]]
-Apache License 2.0
-~~~~~~~~~~~~~~~~~~
-
-----
-                                 Apache License
-                           Version 2.0, January 2004
-                        http://www.apache.org/licenses/
-
-   TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
-
-   1. Definitions.
-
-      "License" shall mean the terms and conditions for use, reproduction,
-      and distribution as defined by Sections 1 through 9 of this document.
-
-      "Licensor" shall mean the copyright owner or entity authorized by
-      the copyright owner that is granting the License.
-
-      "Legal Entity" shall mean the union of the acting entity and all
-      other entities that control, are controlled by, or are under common
-      control with that entity. For the purposes of this definition,
-      "control" means (i) the power, direct or indirect, to cause the
-      direction or management of such entity, whether by contract or
-      otherwise, or (ii) ownership of fifty percent (50%) or more of the
-      outstanding shares, or (iii) beneficial ownership of such entity.
-
-      "You" (or "Your") shall mean an individual or Legal Entity
-      exercising permissions granted by this License.
-
-      "Source" form shall mean the preferred form for making modifications,
-      including but not limited to software source code, documentation
-      source, and configuration files.
-
-      "Object" form shall mean any form resulting from mechanical
-      transformation or translation of a Source form, including but
-      not limited to compiled object code, generated documentation,
-      and conversions to other media types.
-
-      "Work" shall mean the work of authorship, whether in Source or
-      Object form, made available under the License, as indicated by a
-      copyright notice that is included in or attached to the work
-      (an example is provided in the Appendix below).
-
-      "Derivative Works" shall mean any work, whether in Source or Object
-      form, that is based on (or derived from) the Work and for which the
-      editorial revisions, annotations, elaborations, or other modifications
-      represent, as a whole, an original work of authorship. For the purposes
-      of this License, Derivative Works shall not include works that remain
-      separable from, or merely link (or bind by name) to the interfaces of,
-      the Work and Derivative Works thereof.
-
-      "Contribution" shall mean any work of authorship, including
-      the original version of the Work and any modifications or additions
-      to that Work or Derivative Works thereof, that is intentionally
-      submitted to Licensor for inclusion in the Work by the copyright owner
-      or by an individual or Legal Entity authorized to submit on behalf of
-      the copyright owner. For the purposes of this definition, "submitted"
-      means any form of electronic, verbal, or written communication sent
-      to the Licensor or its representatives, including but not limited to
-      communication on electronic mailing lists, source code control systems,
-      and issue tracking systems that are managed by, or on behalf of, the
-      Licensor for the purpose of discussing and improving the Work, but
-      excluding communication that is conspicuously marked or otherwise
-      designated in writing by the copyright owner as "Not a Contribution."
-
-      "Contributor" shall mean Licensor and any individual or Legal Entity
-      on behalf of whom a Contribution has been received by Licensor and
-      subsequently incorporated within the Work.
-
-   2. Grant of Copyright License. Subject to the terms and conditions of
-      this License, each Contributor hereby grants to You a perpetual,
-      worldwide, non-exclusive, no-charge, royalty-free, irrevocable
-      copyright license to reproduce, prepare Derivative Works of,
-      publicly display, publicly perform, sublicense, and distribute the
-      Work and such Derivative Works in Source or Object form.
-
-   3. Grant of Patent License. Subject to the terms and conditions of
-      this License, each Contributor hereby grants to You a perpetual,
-      worldwide, non-exclusive, no-charge, royalty-free, irrevocable
-      (except as stated in this section) patent license to make, have made,
-      use, offer to sell, sell, import, and otherwise transfer the Work,
-      where such license applies only to those patent claims licensable
-      by such Contributor that are necessarily infringed by their
-      Contribution(s) alone or by combination of their Contribution(s)
-      with the Work to which such Contribution(s) was submitted. If You
-      institute patent litigation against any entity (including a
-      cross-claim or counterclaim in a lawsuit) alleging that the Work
-      or a Contribution incorporated within the Work constitutes direct
-      or contributory patent infringement, then any patent licenses
-      granted to You under this License for that Work shall terminate
-      as of the date such litigation is filed.
-
-   4. Redistribution. You may reproduce and distribute copies of the
-      Work or Derivative Works thereof in any medium, with or without
-      modifications, and in Source or Object form, provided that You
-      meet the following conditions:
-
-      (a) You must give any other recipients of the Work or
-          Derivative Works a copy of this License; and
-
-      (b) You must cause any modified files to carry prominent notices
-          stating that You changed the files; and
-
-      (c) You must retain, in the Source form of any Derivative Works
-          that You distribute, all copyright, patent, trademark, and
-          attribution notices from the Source form of the Work,
-          excluding those notices that do not pertain to any part of
-          the Derivative Works; and
-
-      (d) If the Work includes a "NOTICE" text file as part of its
-          distribution, then any Derivative Works that You distribute must
-          include a readable copy of the attribution notices contained
-          within such NOTICE file, excluding those notices that do not
-          pertain to any part of the Derivative Works, in at least one
-          of the following places: within a NOTICE text file distributed
-          as part of the Derivative Works; within the Source form or
-          documentation, if provided along with the Derivative Works; or,
-          within a display generated by the Derivative Works, if and
-          wherever such third-party notices normally appear. The contents
-          of the NOTICE file are for informational purposes only and
-          do not modify the License. You may add Your own attribution
-          notices within Derivative Works that You distribute, alongside
-          or as an addendum to the NOTICE text from the Work, provided
-          that such additional attribution notices cannot be construed
-          as modifying the License.
-
-      You may add Your own copyright statement to Your modifications and
-      may provide additional or different license terms and conditions
-      for use, reproduction, or distribution of Your modifications, or
-      for any such Derivative Works as a whole, provided Your use,
-      reproduction, and distribution of the Work otherwise complies with
-      the conditions stated in this License.
-
-   5. Submission of Contributions. Unless You explicitly state otherwise,
-      any Contribution intentionally submitted for inclusion in the Work
-      by You to the Licensor shall be under the terms and conditions of
-      this License, without any additional terms or conditions.
-      Notwithstanding the above, nothing herein shall supersede or modify
-      the terms of any separate license agreement you may have executed
-      with Licensor regarding such Contributions.
-
-   6. Trademarks. This License does not grant permission to use the trade
-      names, trademarks, service marks, or product names of the Licensor,
-      except as required for reasonable and customary use in describing the
-      origin of the Work and reproducing the content of the NOTICE file.
-
-   7. Disclaimer of Warranty. Unless required by applicable law or
-      agreed to in writing, Licensor provides the Work (and each
-      Contributor provides its Contributions) on an "AS IS" BASIS,
-      WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
-      implied, including, without limitation, any warranties or conditions
-      of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
-      PARTICULAR PURPOSE. You are solely responsible for determining the
-      appropriateness of using or redistributing the Work and assume any
-      risks associated with Your exercise of permissions under this License.
-
-   8. Limitation of Liability. In no event and under no legal theory,
-      whether in tort (including negligence), contract, or otherwise,
-      unless required by applicable law (such as deliberate and grossly
-      negligent acts) or agreed to in writing, shall any Contributor be
-      liable to You for damages, including any direct, indirect, special,
-      incidental, or consequential damages of any character arising as a
-      result of this License or out of the use or inability to use the
-      Work (including but not limited to damages for loss of goodwill,
-      work stoppage, computer failure or malfunction, or any and all
-      other commercial damages or losses), even if such Contributor
-      has been advised of the possibility of such damages.
-
-   9. Accepting Warranty or Additional Liability. While redistributing
-      the Work or Derivative Works thereof, You may choose to offer,
-      and charge a fee for, acceptance of support, warranty, indemnity,
-      or other liability obligations and/or rights consistent with this
-      License. However, in accepting such obligations, You may act only
-      on Your own behalf and on Your sole responsibility, not on behalf
-      of any other Contributor, and only if You agree to indemnify,
-      defend, and hold each Contributor harmless for any liability
-      incurred by, or claims asserted against, such Contributor by reason
-      of your accepting any such warranty or additional liability.
-
-   END OF TERMS AND CONDITIONS
-
-   APPENDIX: How to apply the Apache License to your work.
-
-      To apply the Apache License to your work, attach the following
-      boilerplate notice, with the fields enclosed by brackets "[]"
-      replaced with your own identifying information. (Don't include
-      the brackets!)  The text should be enclosed in the appropriate
-      comment syntax for the file format. We also recommend that a
-      file or class name and description of purpose be included on the
-      same "printed page" as the copyright notice for easier
-      identification within third-party archives.
-
-   Copyright [yyyy] [name of copyright owner]
-
-   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.
-----
-
-[[sshd]]
-Apache SSHD - Notice
-~~~~~~~~~~~~~~~~~~~~
-
-* link:http://svn.apache.org/viewvc/mina/sshd/trunk/NOTICE.txt?view=markup[Original]
-
-----
-   =========================================================================
-   ==  NOTICE file for use with the Apache License, Version 2.0,          ==
-   ==  in this case for the SSHD distribution.                            ==
-   =========================================================================
-
-   This product contains software developped by JCraft,Inc. and subject to
-   the following license:
-
-Copyright (c) 2002,2003,2004,2005,2006,2007,2008 Atsuhiko Yamanaka, JCraft,Inc.
-All rights reserved.
-
-Redistribution and use in source and binary forms, with or without
-modification, are permitted provided that the following conditions are met:
-
-  1. Redistributions of source code must retain the above copyright notice,
-     this list of conditions and the following disclaimer.
-
-  2. Redistributions in binary form must reproduce the above copyright
-     notice, this list of conditions and the following disclaimer in
-     the documentation and/or other materials provided with the distribution.
-
-  3. The names of the authors may not be used to endorse or promote products
-     derived from this software without specific prior written permission.
-
-THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES,
-INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
-FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JCRAFT,
-INC. OR ANY CONTRIBUTORS TO THIS SOFTWARE BE LIABLE FOR ANY DIRECT, INDIRECT,
-INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,
-OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
-EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
- --------------------------------------------------------------------------------
-
-Copyright (c) 2000 - 2006 The Legion Of The Bouncy Castle (http://www.bouncycastle.org)
-
-Permission is hereby granted, free of charge, to any person obtaining a copy of
-this software and associated documentation files (the "Software"), to deal in the
-Software without restriction, including without limitation the rights to use, copy,
-modify, merge, publish, distribute, sublicense, and/or sell copies of the Software,
-and to permit persons to whom the Software is furnished to do so, subject to the
-following conditions:
-
-The above copyright notice and this permission notice shall be included in all
-copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
-INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
-PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
-HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
-SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-----
-
-[[postgresql]]
-PostgreSQL JDBC Driver - New Style BSD
-~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-
-* link:http://jdbc.postgresql.org/license.html[Original]
-
-----
-Copyright (c) 1997-2008, PostgreSQL Global Development Group
-All rights reserved.
-
-Redistribution and use in source and binary forms, with or without
-modification, are permitted provided that the following conditions are met:
-
-1. Redistributions of source code must retain the above copyright notice,
-   this list of conditions and the following disclaimer.
-2. Redistributions in binary form must reproduce the above copyright notice,
-   this list of conditions and the following disclaimer in the documentation
-   and/or other materials provided with the distribution.
-3. Neither the name of the PostgreSQL Global Development Group nor the names
-   of its contributors may be used to endorse or promote products derived
-   from this software without specific prior written permission.
-
-THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
-AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
-LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
-CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
-SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
-INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
-CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
-ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
-POSSIBILITY OF SUCH DAMAGE.
-----
-
-[[prolog_cafe]]
-Prolog Cafe - EPL or GPL
-~~~~~~~~~~~~~~~~~~~~~~~~
-
-Originally developed by Mutsunori BANBARA and Naoyuki TAMURA at the
-Kobe University, JAPAN. Gerrit Code Review uses a fork derived from
-the 1.2.5 release, and offers the corresponding source code at
-link:https://gerrit.googlesource.com/prolog-cafe[].
-
-Prolog Cafe is dual licensed and available under either the
-link:http://opensource.org/licenses/eclipse-1.0.php[Eclipse Public License],
-or the
-link:http://www.gnu.org/licenses/gpl-2.0.html[GPL version 2.0 (or later)].
-
-In the context of Gerrit Code Review, Prolog Cafe is consumed
-under the EPL.
-
-[[h2]]
-H2 Database - EPL or modified MPL
-~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-
-* link:http://www.h2database.com/html/license.html[Complete Terms]
-
-H2 is dual licensed and available under a modified version of the
-MPL 1.1 (Mozilla Public License) or under the (unmodified) EPL 1.0
-(link:http://opensource.org/licenses/eclipse-1.0.php[Eclipse Public License]).
-
-[[asm]]
-ObjectWeb ASM - New Style BSD
-~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-
-* link:http://svn.forge.objectweb.org/cgi-bin/viewcvs.cgi/asm/trunk/asm/LICENSE.txt[Original]
-
-----
- ASM: a very small and fast Java bytecode manipulation framework
- Copyright (c) 2000-2005 INRIA, France Telecom
- All rights reserved.
-
- Redistribution and use in source and binary forms, with or without
- modification, are permitted provided that the following conditions
- are met:
-
- 1. Redistributions of source code must retain the above copyright
-    notice, this list of conditions and the following disclaimer.
- 2. Redistributions in binary form must reproduce the above copyright
-    notice, this list of conditions and the following disclaimer in the
-    documentation and/or other materials provided with the distribution.
- 3. Neither the name of the copyright holders nor the names of its
-    contributors may be used to endorse or promote products derived from
-    this software without specific prior written permission.
-
- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
- AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
- LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
- THE POSSIBILITY OF SUCH DAMAGE.
-----
-
-[[antlr]]
-ANTLR - New Style BSD
-~~~~~~~~~~~~~~~~~~~~~
-
-* link:http://www.antlr.org/license.html[Original]
-
-----
-Copyright (c) 2003-2008, Terence Parr
-All rights reserved.
-
-Redistribution and use in source and binary forms, with or without
-modification, are permitted provided that the following conditions
-are met:
-
-    * Redistributions of source code must retain the above copyright
-      notice, this list of conditions and the following disclaimer.
-    * Redistributions in binary form must reproduce the above
-      copyright notice, this list of conditions and the following
-      disclaimer in the documentation and/or other materials provided
-      with the distribution.
-    * Neither the name of the author nor the names of its
-      contributors may be used to endorse or promote products derived
-      from this software without specific prior written permission.
-
-THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
-FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
-COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
-INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
-BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
-LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
-CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
-LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
-ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
-POSSIBILITY OF SUCH DAMAGE.
-----
-
-[[jgit]]
-JGit - New Style BSD
-~~~~~~~~~~~~~~~~~~~~
-
-* link:http://repo.or.cz/w/egit.git?a=blob;f=org.spearce.jgit/LICENSE;hb=HEAD[Original]
-
-----
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or
- * without modification, are permitted provided that the following
- * conditions are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- *
- * - Redistributions in binary form must reproduce the above
- *   copyright notice, this list of conditions and the following
- *   disclaimer in the documentation and/or other materials provided
- *   with the distribution.
- *
- * - Neither the name of the Git Development Community nor the
- *   names of its contributors may be used to endorse or promote
- *   products derived from this software without specific prior
- *   written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
- * CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
- * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
- * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
- * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
- * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
- * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-----
-
-[[jsr305]]
-JSR 305 Reference Implementation - New Style BSD
-~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-
-* link:http://code.google.com/p/jsr-305/source/browse/trunk/ri/LICENSE[Original 1]
-* link:http://code.google.com/p/findbugs/source/browse/trunk/findbugs/LICENSE-jsr305.txt[Original 2]
-
-----
-Copyright (c) 2007-2009, JSR305 expert group
-All rights reserved.
-
-http://www.opensource.org/licenses/bsd-license.php
-
-Redistribution and use in source and binary forms, with or without
-modification, are permitted provided that the following conditions are met:
-
-    * Redistributions of source code must retain the above copyright notice,
-      this list of conditions and the following disclaimer.
-    * Redistributions in binary form must reproduce the above copyright notice,
-      this list of conditions and the following disclaimer in the documentation
-      and/or other materials provided with the distribution.
-    * Neither the name of the JSR305 expert group nor the names of its
-      contributors may be used to endorse or promote products derived from
-      this software without specific prior written permission.
-
-THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
-AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
-THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
-LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
-CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
-SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
-INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
-CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
-ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
-POSSIBILITY OF SUCH DAMAGE.
-----
-
-[[automaton]]
-dk.brics.automaton - New Style BSD
-~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-
-* link:http://www.brics.dk/automaton/index.html
-
-----
-Copyright (c) 2007-2009, dk.brics.automaton
-All rights reserved.
-
-http://www.opensource.org/licenses/bsd-license.php
-
-Redistribution and use in source and binary forms, with or without
-modification, are permitted provided that the following conditions are met:
-
-    * Redistributions of source code must retain the above copyright notice,
-      this list of conditions and the following disclaimer.
-    * Redistributions in binary form must reproduce the above copyright notice,
-      this list of conditions and the following disclaimer in the documentation
-      and/or other materials provided with the distribution.
-    * Neither the name of the JSR305 expert group nor the names of its
-      contributors may be used to endorse or promote products derived from
-      this software without specific prior written permission.
-
-THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
-AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
-THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
-LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
-CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
-SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
-INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
-CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
-ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
-POSSIBILITY OF SUCH DAMAGE.
-----
-
-[[args4j]]
-args4j - MIT License
-~~~~~~~~~~~~~~~~~~~~
-
-* link:https://args4j.dev.java.net/[Home]
-* link:http://www.opensource.org/licenses/mit-license.php[Canonical MIT License]
-
-[[slf4j]]
-SLF4J - MIT License
-~~~~~~~~~~~~~~~~~~~
-
-* link:http://www.slf4j.org/license.html[Original]
-
-----
- Copyright (c) 2004-2008 QOS.ch
- All rights reserved.
-
- Permission is hereby granted, free  of charge, to any person obtaining
- a  copy  of this  software  and  associated  documentation files  (the
- "Software"), to  deal in  the Software without  restriction, including
- without limitation  the rights to  use, copy, modify,  merge, publish,
- distribute,  sublicense, and/or sell  copies of  the Software,  and to
- permit persons to whom the Software  is furnished to do so, subject to
- the following conditions:
-
- The  above  copyright  notice  and  this permission  notice  shall  be
- included in all copies or substantial portions of the Software.
-
- THE  SOFTWARE IS  PROVIDED  "AS  IS", WITHOUT  WARRANTY  OF ANY  KIND,
- EXPRESS OR  IMPLIED, INCLUDING  BUT NOT LIMITED  TO THE  WARRANTIES OF
- MERCHANTABILITY,    FITNESS    FOR    A   PARTICULAR    PURPOSE    AND
- NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- OF CONTRACT, TORT OR OTHERWISE,  ARISING FROM, OUT OF OR IN CONNECTION
- WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-----
-
-[[clippy]]
-Clippy - MIT License
-~~~~~~~~~~~~~~~~~~~~
-
-* link:http://github.com/mojombo/clippy/tree/master[Site]
-
-----
-(The MIT License)
-
-Copyright (c) 2008 Tom Preston-Werner
-
-Permission is hereby granted, free of charge, to any person obtaining
-a copy of this software and associated documentation files (the
-'Software'), to deal in the Software without restriction, including
-without limitation the rights to use, copy, modify, merge, publish,
-distribute, sublicense, and/or sell copies of the Software, and to
-permit persons to whom the Software is furnished to do so, subject to
-the following conditions:
- 
-The above copyright notice and this permission notice shall be
-included in all copies or substantial portions of the Software.
- 
-THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
-EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
-IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
-CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
-TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
-SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-----
-
-[[jcip]]
-Java Concurrency in Practice Annotations
-~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-
-* link:http://jcip.net/[book website]
-* link:http://jcip.net/jcip-annotations-src.jar[sources]
-* link:http://creativecommons.org/licenses/by/2.5/[license]
-
-----
-Copyright (c) 2005 Brian Goetz and Tim Peierls
-Released under the Creative Commons Attribution License
-  (http://creativecommons.org/licenses/by/2.5)
-Official home: http://www.jcip.net
-
-Any republication or derived work distributed in source code form
-must include this copyright and license notice.
-----
-
-[[mpl1_1]]
-Mozilla Public License 1.1
-~~~~~~~~~~~~~~~~~~~~~~~~~~
-
-* link:http://www.mozilla.org/MPL/MPL-1.1.html[Mozilla Public License (Original)]
-* link:http://www.mozilla.org/MPL/MPL-1.1-annotated.html[Mozilla Public License (Annotated)]
-
-----
-                          MOZILLA PUBLIC LICENSE
-                                Version 1.1
-
-                              ---------------
-
-1. Definitions.
-
-     1.0.1. "Commercial Use" means distribution or otherwise making the
-     Covered Code available to a third party.
-
-     1.1. "Contributor" means each entity that creates or contributes to
-     the creation of Modifications.
-
-     1.2. "Contributor Version" means the combination of the Original
-     Code, prior Modifications used by a Contributor, and the Modifications
-     made by that particular Contributor.
-
-     1.3. "Covered Code" means the Original Code or Modifications or the
-     combination of the Original Code and Modifications, in each case
-     including portions thereof.
-
-     1.4. "Electronic Distribution Mechanism" means a mechanism generally
-     accepted in the software development community for the electronic
-     transfer of data.
-
-     1.5. "Executable" means Covered Code in any form other than Source
-     Code.
-
-     1.6. "Initial Developer" means the individual or entity identified
-     as the Initial Developer in the Source Code notice required by Exhibit
-     A.
-
-     1.7. "Larger Work" means a work which combines Covered Code or
-     portions thereof with code not governed by the terms of this License.
-
-     1.8. "License" means this document.
-
-     1.8.1. "Licensable" means having the right to grant, to the maximum
-     extent possible, whether at the time of the initial grant or
-     subsequently acquired, any and all of the rights conveyed herein.
-
-     1.9. "Modifications" means any addition to or deletion from the
-     substance or structure of either the Original Code or any previous
-     Modifications. When Covered Code is released as a series of files, a
-     Modification is:
-          A. Any addition to or deletion from the contents of a file
-          containing Original Code or previous Modifications.
-
-          B. Any new file that contains any part of the Original Code or
-          previous Modifications.
-
-     1.10. "Original Code" means Source Code of computer software code
-     which is described in the Source Code notice required by Exhibit A as
-     Original Code, and which, at the time of its release under this
-     License is not already Covered Code governed by this License.
-
-     1.10.1. "Patent Claims" means any patent claim(s), now owned or
-     hereafter acquired, including without limitation,  method, process,
-     and apparatus claims, in any patent Licensable by grantor.
-
-     1.11. "Source Code" means the preferred form of the Covered Code for
-     making modifications to it, including all modules it contains, plus
-     any associated interface definition files, scripts used to control
-     compilation and installation of an Executable, or source code
-     differential comparisons against either the Original Code or another
-     well known, available Covered Code of the Contributor's choice. The
-     Source Code can be in a compressed or archival form, provided the
-     appropriate decompression or de-archiving software is widely available
-     for no charge.
-
-     1.12. "You" (or "Your")  means an individual or a legal entity
-     exercising rights under, and complying with all of the terms of, this
-     License or a future version of this License issued under Section 6.1.
-     For legal entities, "You" includes any entity which controls, is
-     controlled by, or is under common control with You. For purposes of
-     this definition, "control" means (a) the power, direct or indirect,
-     to cause the direction or management of such entity, whether by
-     contract or otherwise, or (b) ownership of more than fifty percent
-     (50%) of the outstanding shares or beneficial ownership of such
-     entity.
-
-2. Source Code License.
-
-     2.1. The Initial Developer Grant.
-     The Initial Developer hereby grants You a world-wide, royalty-free,
-     non-exclusive license, subject to third party intellectual property
-     claims:
-          (a)  under intellectual property rights (other than patent or
-          trademark) Licensable by Initial Developer to use, reproduce,
-          modify, display, perform, sublicense and distribute the Original
-          Code (or portions thereof) with or without Modifications, and/or
-          as part of a Larger Work; and
-
-          (b) under Patents Claims infringed by the making, using or
-          selling of Original Code, to make, have made, use, practice,
-          sell, and offer for sale, and/or otherwise dispose of the
-          Original Code (or portions thereof).
-
-          (c) the licenses granted in this Section 2.1(a) and (b) are
-          effective on the date Initial Developer first distributes
-          Original Code under the terms of this License.
-
-          (d) Notwithstanding Section 2.1(b) above, no patent license is
-          granted: 1) for code that You delete from the Original Code; 2)
-          separate from the Original Code;  or 3) for infringements caused
-          by: i) the modification of the Original Code or ii) the
-          combination of the Original Code with other software or devices.
-
-     2.2. Contributor Grant.
-     Subject to third party intellectual property claims, each Contributor
-     hereby grants You a world-wide, royalty-free, non-exclusive license
-
-          (a)  under intellectual property rights (other than patent or
-          trademark) Licensable by Contributor, to use, reproduce, modify,
-          display, perform, sublicense and distribute the Modifications
-          created by such Contributor (or portions thereof) either on an
-          unmodified basis, with other Modifications, as Covered Code
-          and/or as part of a Larger Work; and
-
-          (b) under Patent Claims infringed by the making, using, or
-          selling of  Modifications made by that Contributor either alone
-          and/or in combination with its Contributor Version (or portions
-          of such combination), to make, use, sell, offer for sale, have
-          made, and/or otherwise dispose of: 1) Modifications made by that
-          Contributor (or portions thereof); and 2) the combination of
-          Modifications made by that Contributor with its Contributor
-          Version (or portions of such combination).
-
-          (c) the licenses granted in Sections 2.2(a) and 2.2(b) are
-          effective on the date Contributor first makes Commercial Use of
-          the Covered Code.
-
-          (d)    Notwithstanding Section 2.2(b) above, no patent license is
-          granted: 1) for any code that Contributor has deleted from the
-          Contributor Version; 2)  separate from the Contributor Version;
-          3)  for infringements caused by: i) third party modifications of
-          Contributor Version or ii)  the combination of Modifications made
-          by that Contributor with other software  (except as part of the
-          Contributor Version) or other devices; or 4) under Patent Claims
-          infringed by Covered Code in the absence of Modifications made by
-          that Contributor.
-
-3. Distribution Obligations.
-
-     3.1. Application of License.
-     The Modifications which You create or to which You contribute are
-     governed by the terms of this License, including without limitation
-     Section 2.2. The Source Code version of Covered Code may be
-     distributed only under the terms of this License or a future version
-     of this License released under Section 6.1, and You must include a
-     copy of this License with every copy of the Source Code You
-     distribute. You may not offer or impose any terms on any Source Code
-     version that alters or restricts the applicable version of this
-     License or the recipients' rights hereunder. However, You may include
-     an additional document offering the additional rights described in
-     Section 3.5.
-
-     3.2. Availability of Source Code.
-     Any Modification which You create or to which You contribute must be
-     made available in Source Code form under the terms of this License
-     either on the same media as an Executable version or via an accepted
-     Electronic Distribution Mechanism to anyone to whom you made an
-     Executable version available; and if made available via Electronic
-     Distribution Mechanism, must remain available for at least twelve (12)
-     months after the date it initially became available, or at least six
-     (6) months after a subsequent version of that particular Modification
-     has been made available to such recipients. You are responsible for
-     ensuring that the Source Code version remains available even if the
-     Electronic Distribution Mechanism is maintained by a third party.
-
-     3.3. Description of Modifications.
-     You must cause all Covered Code to which You contribute to contain a
-     file documenting the changes You made to create that Covered Code and
-     the date of any change. You must include a prominent statement that
-     the Modification is derived, directly or indirectly, from Original
-     Code provided by the Initial Developer and including the name of the
-     Initial Developer in (a) the Source Code, and (b) in any notice in an
-     Executable version or related documentation in which You describe the
-     origin or ownership of the Covered Code.
-
-     3.4. Intellectual Property Matters
-          (a) Third Party Claims.
-          If Contributor has knowledge that a license under a third party's
-          intellectual property rights is required to exercise the rights
-          granted by such Contributor under Sections 2.1 or 2.2,
-          Contributor must include a text file with the Source Code
-          distribution titled "LEGAL" which describes the claim and the
-          party making the claim in sufficient detail that a recipient will
-          know whom to contact. If Contributor obtains such knowledge after
-          the Modification is made available as described in Section 3.2,
-          Contributor shall promptly modify the LEGAL file in all copies
-          Contributor makes available thereafter and shall take other steps
-          (such as notifying appropriate mailing lists or newsgroups)
-          reasonably calculated to inform those who received the Covered
-          Code that new knowledge has been obtained.
-
-          (b) Contributor APIs.
-          If Contributor's Modifications include an application programming
-          interface and Contributor has knowledge of patent licenses which
-          are reasonably necessary to implement that API, Contributor must
-          also include this information in the LEGAL file.
-
-               (c)    Representations.
-          Contributor represents that, except as disclosed pursuant to
-          Section 3.4(a) above, Contributor believes that Contributor's
-          Modifications are Contributor's original creation(s) and/or
-          Contributor has sufficient rights to grant the rights conveyed by
-          this License.
-
-     3.5. Required Notices.
-     You must duplicate the notice in Exhibit A in each file of the Source
-     Code.  If it is not possible to put such notice in a particular Source
-     Code file due to its structure, then You must include such notice in a
-     location (such as a relevant directory) where a user would be likely
-     to look for such a notice.  If You created one or more Modification(s)
-     You may add your name as a Contributor to the notice described in
-     Exhibit A.  You must also duplicate this License in any documentation
-     for the Source Code where You describe recipients' rights or ownership
-     rights relating to Covered Code.  You may choose to offer, and to
-     charge a fee for, warranty, support, indemnity or liability
-     obligations to one or more recipients of Covered Code. However, You
-     may do so only on Your own behalf, and not on behalf of the Initial
-     Developer or any Contributor. You must make it absolutely clear than
-     any such warranty, support, indemnity or liability obligation is
-     offered by You alone, and You hereby agree to indemnify the Initial
-     Developer and every Contributor for any liability incurred by the
-     Initial Developer or such Contributor as a result of warranty,
-     support, indemnity or liability terms You offer.
-
-     3.6. Distribution of Executable Versions.
-     You may distribute Covered Code in Executable form only if the
-     requirements of Section 3.1-3.5 have been met for that Covered Code,
-     and if You include a notice stating that the Source Code version of
-     the Covered Code is available under the terms of this License,
-     including a description of how and where You have fulfilled the
-     obligations of Section 3.2. The notice must be conspicuously included
-     in any notice in an Executable version, related documentation or
-     collateral in which You describe recipients' rights relating to the
-     Covered Code. You may distribute the Executable version of Covered
-     Code or ownership rights under a license of Your choice, which may
-     contain terms different from this License, provided that You are in
-     compliance with the terms of this License and that the license for the
-     Executable version does not attempt to limit or alter the recipient's
-     rights in the Source Code version from the rights set forth in this
-     License. If You distribute the Executable version under a different
-     license You must make it absolutely clear that any terms which differ
-     from this License are offered by You alone, not by the Initial
-     Developer or any Contributor. You hereby agree to indemnify the
-     Initial Developer and every Contributor for any liability incurred by
-     the Initial Developer or such Contributor as a result of any such
-     terms You offer.
-
-     3.7. Larger Works.
-     You may create a Larger Work by combining Covered Code with other code
-     not governed by the terms of this License and distribute the Larger
-     Work as a single product. In such a case, You must make sure the
-     requirements of this License are fulfilled for the Covered Code.
-
-4. Inability to Comply Due to Statute or Regulation.
-
-     If it is impossible for You to comply with any of the terms of this
-     License with respect to some or all of the Covered Code due to
-     statute, judicial order, or regulation then You must: (a) comply with
-     the terms of this License to the maximum extent possible; and (b)
-     describe the limitations and the code they affect. Such description
-     must be included in the LEGAL file described in Section 3.4 and must
-     be included with all distributions of the Source Code. Except to the
-     extent prohibited by statute or regulation, such description must be
-     sufficiently detailed for a recipient of ordinary skill to be able to
-     understand it.
-
-5. Application of this License.
-
-     This License applies to code to which the Initial Developer has
-     attached the notice in Exhibit A and to related Covered Code.
-
-6. Versions of the License.
-
-     6.1. New Versions.
-     Netscape Communications Corporation ("Netscape") may publish revised
-     and/or new versions of the License from time to time. Each version
-     will be given a distinguishing version number.
-
-     6.2. Effect of New Versions.
-     Once Covered Code has been published under a particular version of the
-     License, You may always continue to use it under the terms of that
-     version. You may also choose to use such Covered Code under the terms
-     of any subsequent version of the License published by Netscape. No one
-     other than Netscape has the right to modify the terms applicable to
-     Covered Code created under this License.
-
-     6.3. Derivative Works.
-     If You create or use a modified version of this License (which you may
-     only do in order to apply it to code which is not already Covered Code
-     governed by this License), You must (a) rename Your license so that
-     the phrases "Mozilla", "MOZILLAPL", "MOZPL", "Netscape",
-     "MPL", "NPL" or any confusingly similar phrase do not appear in your
-     license (except to note that your license differs from this License)
-     and (b) otherwise make it clear that Your version of the license
-     contains terms which differ from the Mozilla Public License and
-     Netscape Public License. (Filling in the name of the Initial
-     Developer, Original Code or Contributor in the notice described in
-     Exhibit A shall not of themselves be deemed to be modifications of
-     this License.)
-
-7. DISCLAIMER OF WARRANTY.
-
-     COVERED CODE IS PROVIDED UNDER THIS LICENSE ON AN "AS IS" BASIS,
-     WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
-     WITHOUT LIMITATION, WARRANTIES THAT THE COVERED CODE IS FREE OF
-     DEFECTS, MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE OR NON-INFRINGING.
-     THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE COVERED CODE
-     IS WITH YOU. SHOULD ANY COVERED CODE PROVE DEFECTIVE IN ANY RESPECT,
-     YOU (NOT THE INITIAL DEVELOPER OR ANY OTHER CONTRIBUTOR) ASSUME THE
-     COST OF ANY NECESSARY SERVICING, REPAIR OR CORRECTION. THIS DISCLAIMER
-     OF WARRANTY CONSTITUTES AN ESSENTIAL PART OF THIS LICENSE. NO USE OF
-     ANY COVERED CODE IS AUTHORIZED HEREUNDER EXCEPT UNDER THIS DISCLAIMER.
-
-8. TERMINATION.
-
-     8.1.  This License and the rights granted hereunder will terminate
-     automatically if You fail to comply with terms herein and fail to cure
-     such breach within 30 days of becoming aware of the breach. All
-     sublicenses to the Covered Code which are properly granted shall
-     survive any termination of this License. Provisions which, by their
-     nature, must remain in effect beyond the termination of this License
-     shall survive.
-
-     8.2.  If You initiate litigation by asserting a patent infringement
-     claim (excluding declatory judgment actions) against Initial Developer
-     or a Contributor (the Initial Developer or Contributor against whom
-     You file such action is referred to as "Participant")  alleging that:
-
-     (a)  such Participant's Contributor Version directly or indirectly
-     infringes any patent, then any and all rights granted by such
-     Participant to You under Sections 2.1 and/or 2.2 of this License
-     shall, upon 60 days notice from Participant terminate prospectively,
-     unless if within 60 days after receipt of notice You either: (i)
-     agree in writing to pay Participant a mutually agreeable reasonable
-     royalty for Your past and future use of Modifications made by such
-     Participant, or (ii) withdraw Your litigation claim with respect to
-     the Contributor Version against such Participant.  If within 60 days
-     of notice, a reasonable royalty and payment arrangement are not
-     mutually agreed upon in writing by the parties or the litigation claim
-     is not withdrawn, the rights granted by Participant to You under
-     Sections 2.1 and/or 2.2 automatically terminate at the expiration of
-     the 60 day notice period specified above.
-
-     (b)  any software, hardware, or device, other than such Participant's
-     Contributor Version, directly or indirectly infringes any patent, then
-     any rights granted to You by such Participant under Sections 2.1(b)
-     and 2.2(b) are revoked effective as of the date You first made, used,
-     sold, distributed, or had made, Modifications made by that
-     Participant.
-
-     8.3.  If You assert a patent infringement claim against Participant
-     alleging that such Participant's Contributor Version directly or
-     indirectly infringes any patent where such claim is resolved (such as
-     by license or settlement) prior to the initiation of patent
-     infringement litigation, then the reasonable value of the licenses
-     granted by such Participant under Sections 2.1 or 2.2 shall be taken
-     into account in determining the amount or value of any payment or
-     license.
-
-     8.4.  In the event of termination under Sections 8.1 or 8.2 above,
-     all end user license agreements (excluding distributors and resellers)
-     which have been validly granted by You or any distributor hereunder
-     prior to termination shall survive termination.
-
-9. LIMITATION OF LIABILITY.
-
-     UNDER NO CIRCUMSTANCES AND UNDER NO LEGAL THEORY, WHETHER TORT
-     (INCLUDING NEGLIGENCE), CONTRACT, OR OTHERWISE, SHALL YOU, THE INITIAL
-     DEVELOPER, ANY OTHER CONTRIBUTOR, OR ANY DISTRIBUTOR OF COVERED CODE,
-     OR ANY SUPPLIER OF ANY OF SUCH PARTIES, BE LIABLE TO ANY PERSON FOR
-     ANY INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES OF ANY
-     CHARACTER INCLUDING, WITHOUT LIMITATION, DAMAGES FOR LOSS OF GOODWILL,
-     WORK STOPPAGE, COMPUTER FAILURE OR MALFUNCTION, OR ANY AND ALL OTHER
-     COMMERCIAL DAMAGES OR LOSSES, EVEN IF SUCH PARTY SHALL HAVE BEEN
-     INFORMED OF THE POSSIBILITY OF SUCH DAMAGES. THIS LIMITATION OF
-     LIABILITY SHALL NOT APPLY TO LIABILITY FOR DEATH OR PERSONAL INJURY
-     RESULTING FROM SUCH PARTY'S NEGLIGENCE TO THE EXTENT APPLICABLE LAW
-     PROHIBITS SUCH LIMITATION. SOME JURISDICTIONS DO NOT ALLOW THE
-     EXCLUSION OR LIMITATION OF INCIDENTAL OR CONSEQUENTIAL DAMAGES, SO
-     THIS EXCLUSION AND LIMITATION MAY NOT APPLY TO YOU.
-
-10. U.S. GOVERNMENT END USERS.
-
-     The Covered Code is a "commercial item," as that term is defined in
-     48 C.F.R. 2.101 (Oct. 1995), consisting of "commercial computer
-     software" and "commercial computer software documentation," as such
-     terms are used in 48 C.F.R. 12.212 (Sept. 1995). Consistent with 48
-     C.F.R. 12.212 and 48 C.F.R. 227.7202-1 through 227.7202-4 (June 1995),
-     all U.S. Government End Users acquire Covered Code with only those
-     rights set forth herein.
-
-11. MISCELLANEOUS.
-
-     This License represents the complete agreement concerning subject
-     matter hereof. If any provision of this License is held to be
-     unenforceable, such provision shall be reformed only to the extent
-     necessary to make it enforceable. This License shall be governed by
-     California law provisions (except to the extent applicable law, if
-     any, provides otherwise), excluding its conflict-of-law provisions.
-     With respect to disputes in which at least one party is a citizen of,
-     or an entity chartered or registered to do business in the United
-     States of America, any litigation relating to this License shall be
-     subject to the jurisdiction of the Federal Courts of the Northern
-     District of California, with venue lying in Santa Clara County,
-     California, with the losing party responsible for costs, including
-     without limitation, court costs and reasonable attorneys' fees and
-     expenses. The application of the United Nations Convention on
-     Contracts for the International Sale of Goods is expressly excluded.
-     Any law or regulation which provides that the language of a contract
-     shall be construed against the drafter shall not apply to this
-     License.
-
-12. RESPONSIBILITY FOR CLAIMS.
-
-     As between Initial Developer and the Contributors, each party is
-     responsible for claims and damages arising, directly or indirectly,
-     out of its utilization of rights under this License and You agree to
-     work with Initial Developer and Contributors to distribute such
-     responsibility on an equitable basis. Nothing herein is intended or
-     shall be deemed to constitute any admission of liability.
-
-13. MULTIPLE-LICENSED CODE.
-
-     Initial Developer may designate portions of the Covered Code as
-     "Multiple-Licensed".  "Multiple-Licensed" means that the Initial
-     Developer permits you to utilize portions of the Covered Code under
-     Your choice of the NPL or the alternative licenses, if any, specified
-     by the Initial Developer in the file described in Exhibit A.
-
-EXHIBIT A -Mozilla Public License.
-
-     ``The contents of this file are subject to the Mozilla Public License
-     Version 1.1 (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.mozilla.org/MPL/
-
-     Software distributed under the License is distributed on an "AS IS"
-     basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the
-     License for the specific language governing rights and limitations
-     under the License.
-
-     The Original Code is ______________________________________.
-
-     The Initial Developer of the Original Code is ________________________.
-     Portions created by ______________________ are Copyright (C) ______
-     _______________________. All Rights Reserved.
-
-     Contributor(s): ______________________________________.
-
-     Alternatively, the contents of this file may be used under the terms
-     of the _____ license (the  "[___] License"), in which case the
-     provisions of [______] License are applicable instead of those
-     above.  If you wish to allow use of your version of this file only
-     under the terms of the [____] License and not to allow others to use
-     your version of this file under the MPL, indicate your decision by
-     deleting  the provisions above and replace  them with the notice and
-     other provisions required by the [___] License.  If you do not delete
-     the provisions above, a recipient may use your version of this file
-     under either the MPL or the [___] License."
-
-     [NOTE: The text of this Exhibit A may differ slightly from the text of
-     the notices in the Source Code files of the Original Code. You should
-     use the text of this Exhibit A rather than the text found in the
-     Original Code Source Code for Your Modifications.]
-----
-
-GERRIT
-------
-Part of link:index.html[Gerrit Code Review]
diff --git a/Documentation/man/Makefile b/Documentation/man/Makefile
index 75e6533..945f215 100644
--- a/Documentation/man/Makefile
+++ b/Documentation/man/Makefile
@@ -34,6 +34,7 @@
 cmd-rename-group.txt   \
 cmd-review.txt         \
 cmd-set-account.txt    \
+cmd-set-members.txt    \
 cmd-set-project-parent.txt \
 cmd-set-project.txt    \
 cmd-set-reviewers.txt  \
diff --git a/Documentation/pgm-ScanTrackingIds.txt b/Documentation/pgm-ScanTrackingIds.txt
index ea5d72e..f9494d4 100644
--- a/Documentation/pgm-ScanTrackingIds.txt
+++ b/Documentation/pgm-ScanTrackingIds.txt
@@ -20,6 +20,14 @@
 concurrently to the server if the database is MySQL or PostgreSQL.
 If the database is H2, this task must be run by itself.
 
+STATUS
+------
+This command will be replaced by `reindex`.
+
+If secondary indexing is enabled
+(link:config-gerrit.html#index.type[index.type] set to `LUCENE`
+or `SOLR`) use link:pgm-reindex.html[reindex].
+
 OPTIONS
 -------
 
diff --git a/Documentation/pgm-daemon.txt b/Documentation/pgm-daemon.txt
index 3ffcb40..ce88ab7 100644
--- a/Documentation/pgm-daemon.txt
+++ b/Documentation/pgm-daemon.txt
@@ -15,6 +15,7 @@
 	[\--console-log]
 	[\--slave]
 	[\--headless]
+	[\--init]
 
 DESCRIPTION
 -----------
@@ -63,6 +64,10 @@
 	Don't start the default Gerrit UI. May be useful when Gerrit is
 	run with an alternative UI.
 
+\--init::
+	Run init before starting the daemon. This will create a new site or
+	upgrade an existing site.
+
 CONTEXT
 -------
 This command can only be run on a server which has direct
diff --git a/Documentation/pgm-index.txt b/Documentation/pgm-index.txt
index 7a1edcf..987b4ac 100644
--- a/Documentation/pgm-index.txt
+++ b/Documentation/pgm-index.txt
@@ -23,6 +23,9 @@
 link:pgm-prolog-shell.html[prolog-shell]::
 	Simple interactive Prolog interpreter.
 
+link:pgm-reindex.html[reindex]::
+	Rebuild the secondary index.
+
 link:pgm-rulec.html[rulec]::
 	Compile project-specific Prolog rules to JARs.
 
diff --git a/Documentation/pgm-init.txt b/Documentation/pgm-init.txt
index 57decdd..3d6cb73 100644
--- a/Documentation/pgm-init.txt
+++ b/Documentation/pgm-init.txt
@@ -12,6 +12,8 @@
 	-d <SITE_PATH>
 	[\--batch]
 	[\--no-auto-start]
+	[\--list-plugins]
+	[\--install-plugin=<PLUGIN_NAME>]
 
 DESCRIPTION
 -----------
@@ -45,6 +47,12 @@
 	Location of the gerrit.config file, and all other per-site
 	configuration data, supporting libraries and log files.
 
+\--list-plugins::
+	Print names of plugins that can be installed during init process.
+
+\--install-plugin:
+	Automatically install plugin with given name without asking.
+
 CONTEXT
 -------
 This command can only be run on a server which has direct
diff --git a/Documentation/pgm-prolog-shell.txt b/Documentation/pgm-prolog-shell.txt
index f3fa2d8..3189e90 100644
--- a/Documentation/pgm-prolog-shell.txt
+++ b/Documentation/pgm-prolog-shell.txt
@@ -20,7 +20,7 @@
 -s::
 	Dynamically load the Prolog source code at startup,
 	as though the user had entered `['FILE.pl'].` into
-	the interepter once it was running. This option may
+	the interpreter once it was running. This option may
 	be supplied more than once to load multiple files.
 
 EXAMPLES
diff --git a/Documentation/pgm-reindex.txt b/Documentation/pgm-reindex.txt
new file mode 100644
index 0000000..2b44f6b
--- /dev/null
+++ b/Documentation/pgm-reindex.txt
@@ -0,0 +1,41 @@
+reindex
+=======
+
+NAME
+----
+reindex - Rebuild the secondary index
+
+SYNOPSIS
+--------
+[verse]
+'java' -jar gerrit.war 'reindex' [<OPTIONS>]
+
+DESCRIPTION
+-----------
+Rebuilds the secondary index.
+
+OPTIONS
+-------
+--threads::
+	Number of threads to use for indexing.
+
+--schema-version::
+	Schema version to reindex; default is most recent version.
+
+--output::
+	Prefix for output; path for local disk index, or prefix for remote index.
+
+--verbose::
+	Output debug information for each change.
+
+--dry-run::
+	Dry run.  Don't write anything to index.
+
+CONTEXT
+-------
+The secondary index must be enabled. See
+link:config-gerrit.html#index.type[index.type].
+
+GERRIT
+------
+Part of link:index.html[Gerrit Code Review]
diff --git a/Documentation/prolog-cookbook.txt b/Documentation/prolog-cookbook.txt
index 170d11a..b1710a2 100644
--- a/Documentation/prolog-cookbook.txt
+++ b/Documentation/prolog-cookbook.txt
@@ -182,7 +182,7 @@
 <2> label `'Verified'` is rejected. Change is not submittable.
 <3> label `'Author-is-John-Doe'` is needed for the change to become submittable.
     Note that this tells nothing about how this criteria will be met. It is up
-    to the implementor of the `submit_rule` to return `label('Author-is-John-Doe',
+    to the implementer of the `submit_rule` to return `label('Author-is-John-Doe',
     ok(_))` when this criteria is met.  Most likely, it will have to match
     against `gerrit:commit_author` in order to check if this criteria is met.
     This will become clear through the examples below.
@@ -645,7 +645,7 @@
 
 Reusing the default submit policy
 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-To get results of Gerrits default submit policy we use the
+To get results of Gerrit's default submit policy we use the
 `gerrit:default_submit` predicate.  The `gerrit:default_submit(X)` includes all
 categories from the database.  This means that if we write a submit rule like:
 
@@ -743,7 +743,7 @@
 The latter implementation is probably easier to understand and the code looks
 cleaner. Note, however, that the latter implementation will always return the
 two standard categories only (`Code-Review` and `Verified`) even if a new
-category has beeen inserted into the database. To include the new category
+category has been inserted into the database. To include the new category
 the `rules.pl` would need to be modified or a `submit_filter` in a parent
 project would have to care about including the new category in the result
 of this `submit_rule`.
diff --git a/Documentation/replace_macros.py b/Documentation/replace_macros.py
new file mode 100755
index 0000000..1680a47
--- /dev/null
+++ b/Documentation/replace_macros.py
@@ -0,0 +1,106 @@
+#!/usr/bin/python
+# 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.
+
+from optparse import OptionParser
+import re
+import sys
+
+PAT_GERRIT = re.compile(r'^GERRIT')
+PAT_INCLUDE = re.compile(r'^(include::.*)(\[\])$')
+PAT_GET = re.compile(r'^get::([^ \t\n]*)')
+PAT_TITLE = re.compile(r'^\.(.*)')
+PAT_STARS = re.compile(r'^\*\*\*\*')
+
+GERRIT_UPLINK = """
+
+++++
+<hr style=\"
+  height: 2px;
+  color: silver;
+  margin-top: 1.2em;
+  margin-bottom: 0.5em;
+\">
+++++
+
+"""
+
+GET_TITLE = '<div class="title">%s</div>'
+
+GET_MACRO = """
+
+++++
+<div class="listingblock">
+%s
+<div class="content">
+<a id=\"{0}\" onmousedown="javascript:
+  var i = document.URL.lastIndexOf(\'/Documentation/\');
+  var url = document.URL.substring(0, i) + \'{0}\';
+  document.getElementById(\'{0}\').href = url;">
+    GET {0} HTTP/1.0
+</a>
+</div>
+</div>
+++++
+
+"""
+
+opts = OptionParser()
+opts.add_option('-o', '--out', help='output file')
+opts.add_option('-s', '--src', help='source file')
+opts.add_option('-x', '--suffix', help='suffix for included filenames')
+options, _ = opts.parse_args()
+
+try:
+  out_file = open(options.out, 'w')
+  src_file = open(options.src, 'r')
+  last_line = ''
+  ignore_next_line = False
+  last_title = ''
+  for line in src_file.xreadlines():
+    if PAT_GERRIT.match(last_line):
+      # Case of "GERRIT\n------" at the footer
+      out_file.write(GERRIT_UPLINK)
+      last_line = ''
+    elif PAT_INCLUDE.match(line):
+      # Case of 'include::<filename>'
+      match = PAT_INCLUDE.match(line)
+      out_file.write(last_line)
+      last_line = match.group(1) + options.suffix + match.group(2) + '\n'
+    elif PAT_STARS.match(line):
+      if PAT_TITLE.match(last_line):
+        # Case of the title in '.<title>\n****\nget::<url>\n****'
+        match = PAT_TITLE.match(last_line)
+        last_title = GET_TITLE % match.group(1)
+      else:
+        out_file.write(last_line)
+        last_title = ''
+    elif PAT_GET.match(line):
+      # Case of '****\nget::<url>\n****' in rest api
+      url = PAT_GET.match(line).group(1)
+      out_file.write(GET_MACRO.format(url) % last_title)
+      ignore_next_line = True
+    elif ignore_next_line:
+      # Handle the trailing '****' of the 'get::' case
+      last_line = ''
+      ignore_next_line = False
+    else:
+      out_file.write(last_line)
+      last_line = line
+  out_file.write(last_line)
+  out_file.close()
+except IOError as err:
+  sys.stderr.write(
+      "error while expanding %s to %s: %s" % (options.src, options.out, err))
+  exit(1)
diff --git a/Documentation/rest-api-access.txt b/Documentation/rest-api-access.txt
new file mode 100644
index 0000000..6c786e4
--- /dev/null
+++ b/Documentation/rest-api-access.txt
@@ -0,0 +1,380 @@
+Gerrit Code Review - /access/ REST API
+======================================
+
+This page describes the access rights related REST endpoints.
+Please also take note of the general information on the
+link:rest-api.html[REST API].
+
+[[access-endpoints]]
+Access Rights Endpoints
+-----------------------
+
+[[list-access]]
+List Access Rights
+~~~~~~~~~~~~~~~~~~
+[verse]
+'GET /access/?project=link:rest-api-projects.html#project-name[\{project-name\}]'
+
+Lists the access rights for projects. The projects for which the access
+rights should be returned must be specified as `project` options. The
+`project` can be specified multiple times.
+
+As result a map is returned that maps the project name to
+link:#project-access-info[ProjectAccessInfo] entities.
+
+The entries in the map are sorted by project name.
+
+.Request
+----
+  GET /access/?project=MyProject&project=All-Projects HTTP/1.0
+----
+
+.Response
+----
+  HTTP/1.1 200 OK
+  Content-Type: application/json;charset=UTF-8
+
+  )]}'
+  {
+    "All-Projects": {
+      "revision": "edd453d18e08640e67a8c9a150cec998ed0ac9aa",
+      "local": {
+        "GLOBAL_CAPABILITIES": {
+          "permissions": {
+            "priority": {
+              "rules": {
+                "15bfcd8a6de1a69c50b30cedcdcc951c15703152": {
+                  "action": "BATCH"
+                }
+              }
+            },
+            "streamEvents": {
+              "rules": {
+                "15bfcd8a6de1a69c50b30cedcdcc951c15703152": {
+                  "action": "ALLOW"
+                }
+              }
+            },
+            "administrateServer": {
+              "rules": {
+                "53a4f647a89ea57992571187d8025f830625192a": {
+                  "action": "ALLOW"
+                }
+              }
+            }
+          }
+        },
+        "refs/meta/config": {
+          "permissions": {
+            "submit": {
+              "rules": {
+                "53a4f647a89ea57992571187d8025f830625192a": {
+                  "action": "ALLOW"
+                },
+                "global:Project-Owners": {
+                  "action": "ALLOW"
+                }
+              }
+            },
+            "label-Code-Review": {
+              "label": "Code-Review",
+              "rules": {
+                "53a4f647a89ea57992571187d8025f830625192a": {
+                  "action": "ALLOW",
+                  "min": -2,
+                  "max": 2
+                },
+                "global:Project-Owners": {
+                  "action": "ALLOW",
+                  "min": -2,
+                  "max": 2
+                }
+              }
+            },
+            "read": {
+              "exclusive": true,
+              "rules": {
+                "53a4f647a89ea57992571187d8025f830625192a": {
+                  "action": "ALLOW"
+                },
+                "global:Project-Owners": {
+                  "action": "ALLOW"
+                }
+              }
+            },
+            "push": {
+              "rules": {
+                "53a4f647a89ea57992571187d8025f830625192a": {
+                  "action": "ALLOW"
+                },
+                "global:Project-Owners": {
+                  "action": "ALLOW"
+                }
+              }
+            }
+          }
+        },
+        "refs/for/refs/*": {
+          "permissions": {
+            "pushMerge": {
+              "rules": {
+                "global:Registered-Users": {
+                  "action": "ALLOW"
+                }
+              }
+            },
+            "push": {
+              "rules": {
+                "global:Registered-Users": {
+                  "action": "ALLOW"
+                }
+              }
+            }
+          }
+        },
+        "refs/tags/*": {
+          "permissions": {
+            "pushSignedTag": {
+              "rules": {
+                "53a4f647a89ea57992571187d8025f830625192a": {
+                  "action": "ALLOW"
+                },
+                "global:Project-Owners": {
+                  "action": "ALLOW"
+                }
+              }
+            },
+            "pushTag": {
+              "rules": {
+                "53a4f647a89ea57992571187d8025f830625192a": {
+                  "action": "ALLOW"
+                },
+                "global:Project-Owners": {
+                  "action": "ALLOW"
+                }
+              }
+            }
+          }
+        },
+        "refs/heads/*": {
+          "permissions": {
+            "forgeCommitter": {
+              "rules": {
+                "53a4f647a89ea57992571187d8025f830625192a": {
+                  "action": "ALLOW"
+                },
+                "global:Project-Owners": {
+                  "action": "ALLOW"
+                }
+              }
+            },
+            "forgeAuthor": {
+              "rules": {
+                "global:Registered-Users": {
+                  "action": "ALLOW"
+                }
+              }
+            },
+            "submit": {
+              "rules": {
+                "53a4f647a89ea57992571187d8025f830625192a": {
+                  "action": "ALLOW"
+                },
+                "global:Project-Owners": {
+                  "action": "ALLOW"
+                }
+              }
+            },
+            "editTopicName": {
+              "rules": {
+                "53a4f647a89ea57992571187d8025f830625192a": {
+                  "action": "ALLOW",
+                  "force": true
+                },
+                "global:Project-Owners": {
+                  "action": "ALLOW",
+                  "force": true
+                }
+              }
+            },
+            "label-Code-Review": {
+              "label": "Code-Review",
+              "rules": {
+                "global:Registered-Users": {
+                  "action": "ALLOW",
+                  "min": -1,
+                  "max": 1
+                },
+                "53a4f647a89ea57992571187d8025f830625192a": {
+                  "action": "ALLOW",
+                  "min": -2,
+                  "max": 2
+                },
+                "global:Project-Owners": {
+                  "action": "ALLOW",
+                  "min": -2,
+                  "max": 2
+                }
+              }
+            },
+            "create": {
+              "rules": {
+                "53a4f647a89ea57992571187d8025f830625192a": {
+                  "action": "ALLOW"
+                },
+                "global:Project-Owners": {
+                  "action": "ALLOW"
+                }
+              }
+            },
+            "push": {
+              "rules": {
+                "53a4f647a89ea57992571187d8025f830625192a": {
+                  "action": "ALLOW"
+                },
+                "global:Project-Owners": {
+                  "action": "ALLOW"
+                }
+              }
+            }
+          }
+        },
+        "refs/*": {
+          "permissions": {
+            "read": {
+              "rules": {
+                "global:Anonymous-Users": {
+                  "action": "ALLOW"
+                },
+                "53a4f647a89ea57992571187d8025f830625192a": {
+                  "action": "ALLOW"
+                }
+              }
+            }
+          }
+        }
+      },
+      "is_owner": true,
+      "owner_of": [
+        "GLOBAL_CAPABILITIES",
+        "refs/meta/config",
+        "refs/for/refs/*",
+        "refs/tags/*",
+        "refs/heads/*",
+        "refs/*"
+      ],
+      "can_upload": true,
+      "can_add": true,
+      "config_visible": true
+    },
+    "MyProject": {
+      "revision": "61157ed63e14d261b6dca40650472a9b0bd88474",
+      "inherits_from": {
+        "kind": "gerritcodereview#project",
+        "id": "All-Projects",
+        "name": "All-Projects",
+        "description": "Access inherited by all other projects."
+      },
+      "local": {},
+      "is_owner": true,
+      "owner_of": [
+        "refs/*"
+      ],
+      "can_upload": true,
+      "can_add": true,
+      "config_visible": true
+    }
+  }
+----
+
+[[access-section-info]]
+AccessSectionInfo
+~~~~~~~~~~~~~~~~~
+The `AccessSectionInfo` describes the access rights that are assigned
+on a ref.
+
+[options="header",width="50%",cols="1,^1,5"]
+|==================================
+|Field Name           ||Description
+|`permissions`        ||
+The permissions assigned on the ref of this access section as a map
+that maps the permission names to link:#permission-info[PermissionInfo]
+entities.
+|==================================
+
+[[permission-info]]
+PermissionInfo
+~~~~~~~~~~~~~~
+The `PermissionInfo` entity contains information about an assigned
+permission.
+
+[options="header",width="50%",cols="1,^1,5"]
+|==================================
+|Field Name     ||Description
+|`label`        |optional|
+The name of the label. Not set if it's not a label permission.
+|`exclusive`    |not set if `false`|
+Whether this permission is assigned exclusively.
+|`rules`        ||
+The rules assigned for this permission as a map that maps the UUIDs of
+the groups for which the permission are assigned to
+link:#permission-info[PermissionRuleInfo] entities.
+|==================================
+
+[[permission-rule-info]]
+PermissionRuleInfo
+~~~~~~~~~~~~~~~~~~
+The `PermissionRuleInfo` entity contains information about a permission
+rule that is assigned to group.
+
+[options="header",width="50%",cols="1,^1,5"]
+|==================================
+|Field Name     ||Description
+|`action`       ||
+The action of this rule. For normal permissions this can be `ALLOW`,
+`DENY` or `BLOCK`. Special values for global capabilities are
+`INTERACTIVE` and `BATCH`.
+|`force`        |not set if `false`|
+Whether the force flag is set.
+|`min`          |
+not set if range if empty (from `0` to `0`) or not set|
+The min value of the permission range.
+|`max`          |
+not set if range if empty (from `0` to `0`) or not set|
+The max value of the permission range.
+|==================================
+
+[[project-access-info]]
+ProjectAccessInfo
+~~~~~~~~~~~~~~~~~
+The `ProjectAccessInfo` entity contains information about the access
+rights for a project.
+
+[options="header",width="50%",cols="1,^1,5"]
+|==================================
+|Field Name           ||Description
+|`revision`           ||
+The revision of the `refs/meta/config` branch from which the access
+rights were loaded.
+|`inherits_from`      |not set for the `All-Project` project|
+The parent project from which permissions are inherited as a
+link:rest-api-projects.html#project-info[ProjectInfo] entity.
+|`local`              ||
+The local access rights of the project as a map that maps the refs to
+link:#access-section-info[AccessSectionInfo] entities.
+|`is_owner`           |not set if `false`|
+Whether the calling user owns this project.
+|`owner_of`           ||The list of refs owned by the calling user.
+|`can_upload`         |not set if `false`|
+Whether the calling user can upload to any ref.
+|`can_add`            |not set if `false`|
+Whether the calling user can add any ref.
+|`config_visible`     |not set if `false`|
+Whether the calling user can see the `refs/meta/config` branch of the
+project.
+|==================================
+
+
+GERRIT
+------
+Part of link:index.html[Gerrit Code Review]
diff --git a/Documentation/rest-api-accounts.txt b/Documentation/rest-api-accounts.txt
index f17a741..70431c6 100644
--- a/Documentation/rest-api-accounts.txt
+++ b/Documentation/rest-api-accounts.txt
@@ -5,8 +5,9 @@
 Please also take note of the general information on the
 link:rest-api.html[REST API].
 
-Endpoints
----------
+[[account-endpoints]]
+Account Endpoints
+-----------------
 
 [[get-account]]
 Get Account
@@ -31,10 +32,565 @@
   {
     "_account_id": 1000096,
     "name": "John Doe",
+    "email": "john.doe@example.com",
+    "username": "john"
+  }
+----
+
+[[create-account]]
+Create Account
+~~~~~~~~~~~~~~
+[verse]
+'PUT /accounts/link:#username[\{username\}]'
+
+Creates a new account.
+
+In the request body additional data for the account can be provided as
+link:#account-input[AccountInput].
+
+.Request
+----
+  PUT /accounts/john HTTP/1.0
+  Content-Type: application/json;charset=UTF-8
+
+  {
+    "name": "John Doe",
+    "email": "john.doe@example.com",
+    "ssh_key": "ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEA0T...YImydZAw==",
+    "http_password": "19D9aIn7zePb",
+    "groups": [
+      "MyProject-Owners"
+    ]
+  }
+----
+
+As response a detailed link:#account-info[AccountInfo] entity is
+returned that describes the created account.
+
+.Response
+----
+  HTTP/1.1 201 Created
+  Content-Disposition: attachment
+  Content-Type: application/json;charset=UTF-8
+
+  )]}'
+  {
+    "_account_id": 1000195,
+    "name": "John Doe",
     "email": "john.doe@example.com"
   }
 ----
 
+[[get-account-name]]
+Get Account Name
+~~~~~~~~~~~~~~~~
+[verse]
+'GET /accounts/link:#account-id[\{account-id\}]/name'
+
+Retrieves the full name of an account.
+
+.Request
+----
+  GET /accounts/self/name HTTP/1.0
+----
+
+.Response
+----
+  HTTP/1.1 200 OK
+  Content-Disposition: attachment
+  Content-Type: application/json;charset=UTF-8
+
+  )]}'
+  "John Doe"
+----
+
+If the account does not have a name an empty string is returned.
+
+[[set-account-name]]
+Set Account Name
+~~~~~~~~~~~~~~~~
+[verse]
+'PUT /accounts/link:#account-id[\{account-id\}]/name'
+
+Sets the full name of an account.
+
+The new account name must be provided in the request body inside
+a link:#account-name-input[AccountNameInput] entity.
+
+.Request
+----
+  PUT /accounts/self/name HTTP/1.0
+  Content-Type: application/json;charset=UTF-8
+
+  {
+    "name": "John F. Doe"
+  }
+----
+
+As response the new account name is returned.
+
+.Response
+----
+  HTTP/1.1 200 OK
+  Content-Disposition: attachment
+  Content-Type: application/json;charset=UTF-8
+
+  )]}'
+  "John F. Doe"
+----
+
+If the name was deleted the response is "`204 No Content`".
+
+Some realms may not allow to modify the account name. In this case the
+request is rejected with "`405 Method Not Allowed`".
+
+[[delete-account-name]]
+Delete Account Name
+~~~~~~~~~~~~~~~~~~~
+[verse]
+'DELETE /accounts/link:#account-id[\{account-id\}]/name'
+
+Deletes the name of an account.
+
+.Request
+----
+  DELETE /accounts/self/name HTTP/1.0
+----
+
+.Response
+----
+  HTTP/1.1 204 No Content
+----
+
+[[get-username]]
+Get Username
+~~~~~~~~~~~~
+[verse]
+'GET /accounts/link:#account-id[\{account-id\}]/username'
+
+Retrieves the username of an account.
+
+.Request
+----
+  GET /accounts/self/username HTTP/1.0
+----
+
+.Response
+----
+  HTTP/1.1 200 OK
+  Content-Disposition: attachment
+  Content-Type: application/json;charset=UTF-8
+
+  )]}'
+  "john.doe"
+----
+
+If the account does not have a username the response is `404 Not Found`.
+
+[[get-active]]
+Get Active
+~~~~~~~~~~
+[verse]
+'GET /accounts/link:#account-id[\{account-id\}]/active'
+
+Checks if an account is active.
+
+.Request
+----
+  GET /accounts/john.doe@example.com/active HTTP/1.0
+----
+
+As response `200 OK` is returned for an active account and
+`404 Not Found` is returned for an inactive account.
+
+.Response
+----
+  HTTP/1.1 200 OK
+----
+
+[[set-active]]
+Set Active
+~~~~~~~~~~
+[verse]
+'PUT /accounts/link:#account-id[\{account-id\}]/active'
+
+Sets the account state to active.
+
+.Request
+----
+  PUT /accounts/john.doe@example.com/active HTTP/1.0
+----
+
+.Response
+----
+  HTTP/1.1 201 Created
+----
+
+If the account was already active the response is `200 OK`.
+
+[[delete-active]]
+Delete Active
+~~~~~~~~~~~~~
+[verse]
+'DELETE /accounts/link:#account-id[\{account-id\}]/active'
+
+Sets the account state to inactive.
+
+.Request
+----
+  DELETE /accounts/john.doe@example.com/active HTTP/1.0
+----
+
+.Response
+----
+  HTTP/1.1 204 No Content
+----
+
+If the account was already inactive the response is `404 Not Found`.
+
+[[get-http-password]]
+Get HTTP Password
+~~~~~~~~~~~~~~~~~
+[verse]
+'GET /accounts/link:#account-id[\{account-id\}]/password.http'
+
+Retrieves the HTTP password of an account.
+
+.Request
+----
+  GET /accounts/john.doe@example.com/password.http HTTP/1.0
+----
+
+.Response
+----
+  HTTP/1.1 200 OK
+  Content-Disposition: attachment
+  Content-Type: application/json;charset=UTF-8
+
+  )]}'
+  "ETxgpih8xrNs"
+----
+
+If the account does not have an HTTP password the response is `404 Not Found`.
+
+[[set-http-password]]
+Set/Generate HTTP Password
+~~~~~~~~~~~~~~~~~~~~~~~~~~
+[verse]
+'PUT /accounts/link:#account-id[\{account-id\}]/password.http'
+
+Sets/Generates the HTTP password of an account.
+
+The options for setting/generating the HTTP password must be provided
+in the request body inside a link:#http-password-input[
+HttpPasswordInput] entity.
+
+.Request
+----
+  PUT /accounts/self/password.http HTTP/1.0
+  Content-Type: application/json;charset=UTF-8
+
+  {
+    "generate": true
+  }
+----
+
+As response the new HTTP password is returned.
+
+.Response
+----
+  HTTP/1.1 200 OK
+  Content-Disposition: attachment
+  Content-Type: application/json;charset=UTF-8
+
+  )]}'
+  "ETxgpih8xrNs"
+----
+
+If the HTTP password was deleted the response is "`204 No Content`".
+
+[[delete-http-password]]
+Delete HTTP Password
+~~~~~~~~~~~~~~~~~~~~
+[verse]
+'DELETE /accounts/link:#account-id[\{account-id\}]/password.http'
+
+Deletes the HTTP password of an account.
+
+.Request
+----
+  DELETE /accounts/self/password.http HTTP/1.0
+----
+
+.Response
+----
+  HTTP/1.1 204 No Content
+----
+
+[[list-account-emails]]
+List Account Emails
+~~~~~~~~~~~~~~~~~~~
+[verse]
+'GET /accounts/link:#account-id[\{account-id\}]/emails'
+
+Returns the email addresses that are configured for the specified user.
+
+.Request
+----
+  GET /accounts/self/emails HTTP/1.0
+----
+
+As response the email addresses of the user are returned as a list of
+link:#email-info[EmailInfo] entities.
+
+.Response
+----
+  HTTP/1.1 200 OK
+  Content-Disposition: attachment
+  Content-Type: application/json;charset=UTF-8
+
+  )]}'
+  [
+    {
+      "email": "john.doe@example.com",
+      "preferred": true
+    },
+    {
+      "email": "j.doe@example.com"
+    }
+  ]
+----
+
+[[get-account-email]]
+Get Account Email
+~~~~~~~~~~~~~~~~~
+[verse]
+'GET /accounts/link:#account-id[\{account-id\}]/emails/link:#email-id[\{email-id\}]'
+
+Retrieves an email address of a user.
+
+.Request
+----
+  GET /accounts/self/emails/john.doe@example.com HTTP/1.0
+----
+
+As response an link:#email-info[EmailInfo] entity is returned that
+describes the email address.
+
+.Response
+----
+  HTTP/1.1 200 OK
+  Content-Disposition: attachment
+  Content-Type: application/json;charset=UTF-8
+
+  )]}'
+  {
+    "email": "john.doe@example.com",
+    "preferred": true
+  }
+----
+
+[[create-account-email]]
+Create Account Email
+~~~~~~~~~~~~~~~~~~~~
+[verse]
+'PUT /accounts/link:#account-id[\{account-id\}]/emails/link:#email-id[\{email-id\}]'
+
+Registers a new email address for the user. A verification email is
+sent with a link that needs to be visited to confirm the email address,
+unless `DEVELOPMENT_BECOME_ANY_ACCOUNT` is used as authentication type.
+For the development mode email addresses are directly added without
+confirmation. A Gerrit administrator may add an email address without
+confirmation by setting `no_confirmation` in the
+link:#email-input[EmailInput].
+
+In the request body additional data for the email address can be
+provided as link:#email-input[EmailInput].
+
+.Request
+----
+  PUT /accounts/self/emails/john.doe@example.com HTTP/1.0
+----
+
+As response the new email address is returned as
+link:#email-info[EmailInfo] entity.
+
+.Response
+----
+  HTTP/1.1 201 Created
+  Content-Disposition: attachment
+  Content-Type: application/json;charset=UTF-8
+
+  )]}'
+  {
+    "email": "john.doe@example.com",
+    "pending_confirmation": true
+  }
+----
+
+[[delete-account-email]]
+Delete Account Email
+~~~~~~~~~~~~~~~~~~~~
+[verse]
+'DELETE /accounts/link:#account-id[\{account-id\}]/emails/link:#email-id[\{email-id\}]'
+
+Deletes an email address of an account.
+
+.Request
+----
+  DELETE /accounts/self/emails/john.doe@example.com HTTP/1.0
+----
+
+.Response
+----
+  HTTP/1.1 204 No Content
+----
+
+[[set-preferred-email]]
+Set Preferred Email
+~~~~~~~~~~~~~~~~~~~
+[verse]
+'PUT /accounts/link:#account-id[\{account-id\}]/emails/link:#email-id[\{email-id\}]/preferred'
+
+Sets an email address as preferred email address for an account.
+
+.Request
+----
+  PUT /accounts/self/emails/john.doe@example.com/preferred HTTP/1.0
+----
+
+.Response
+----
+  HTTP/1.1 201 Created
+----
+
+If the email address was already the preferred email address of the
+account the response is "`200 OK`".
+
+[[list-ssh-keys]]
+List SSH Keys
+~~~~~~~~~~~~~
+[verse]
+'GET /accounts/link:#account-id[\{account-id\}]/sshkeys'
+
+Returns the SSH keys of an account.
+
+.Request
+----
+  GET /accounts/self/sshkeys HTTP/1.0
+----
+
+As response the SSH keys of the account are returned as a list of
+link:#ssh-key-info[SshKeyInfo] entities.
+
+.Response
+----
+  HTTP/1.1 200 OK
+  Content-Disposition: attachment
+  Content-Type: application/json;charset=UTF-8
+
+  )]}'
+  [
+    {
+      "seq": 1,
+      "ssh_public_key": "ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEA0T...YImydZAw\u003d\u003d john.doe@example.com",
+      "encoded_key": "AAAAB3NzaC1yc2EAAAABIwAAAQEA0T...YImydZAw\u003d\u003d",
+      "algorithm": "ssh-rsa",
+      "comment": "john.doe@example.com",
+      "valid": true
+    }
+  ]
+----
+
+[[get-ssh-key]]
+Get SSH Key
+~~~~~~~~~~~
+[verse]
+'GET /accounts/link:#account-id[\{account-id\}]/sshkeys/link:#ssh-key-id[\{ssh-key-id\}]'
+
+Retrieves an SSH key of a user.
+
+.Request
+----
+  GET /accounts/self/sshkeys/1 HTTP/1.0
+----
+
+As response an link:#ssh-key-info[SshKeyInfo] entity is returned that
+describes the SSH key.
+
+.Response
+----
+  HTTP/1.1 200 OK
+  Content-Disposition: attachment
+  Content-Type: application/json;charset=UTF-8
+
+  )]}'
+  {
+    "seq": 1,
+    "ssh_public_key": "ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEA0T...YImydZAw\u003d\u003d john.doe@example.com",
+    "encoded_key": "AAAAB3NzaC1yc2EAAAABIwAAAQEA0T...YImydZAw\u003d\u003d",
+    "algorithm": "ssh-rsa",
+    "comment": "john.doe@example.com",
+    "valid": true
+  }
+----
+
+[[add-ssh-key]]
+Add SSH Key
+~~~~~~~~~~~
+[verse]
+'POST /accounts/link:#account-id[\{account-id\}]/sshkeys'
+
+Adds an SSH key for a user.
+
+The SSH public key must be provided as raw content in the request body.
+
+.Request
+----
+  POST /accounts/self/sshkeys HTTP/1.0
+  Content-Type: plain/text
+
+  AAAAB3NzaC1yc2EAAAABIwAAAQEA0T...YImydZAw\u003d\u003d
+----
+
+As response an link:#ssh-key-info[SshKeyInfo] entity is returned that
+describes the new SSH key.
+
+.Response
+----
+  HTTP/1.1 200 OK
+  Content-Disposition: attachment
+  Content-Type: application/json;charset=UTF-8
+
+  )]}'
+  {
+    "seq": 2,
+    "ssh_public_key": "ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEA0T...YImydZAw\u003d\u003d john.doe@example.com",
+    "encoded_key": "AAAAB3NzaC1yc2EAAAABIwAAAQEA0T...YImydZAw\u003d\u003d",
+    "algorithm": "ssh-rsa",
+    "comment": "john.doe@example.com",
+    "valid": true
+  }
+----
+
+[[delete-ssh-key]]
+Delete SSH Key
+~~~~~~~~~~~~~~
+[verse]
+'DELETE /accounts/link:#account-id[\{account-id\}]/sshkeys/link:#ssh-key-id[\{ssh-key-id\}]'
+
+Deletes an SSH key of a user.
+
+.Request
+----
+  DELETE /accounts/self/sshkeys/2 HTTP/1.0
+----
+
+.Response
+----
+  HTTP/1.1 204 No Content
+----
+
 [[list-account-capabilities]]
 List Account Capabilities
 ~~~~~~~~~~~~~~~~~~~~~~~~~
@@ -103,8 +659,7 @@
     "flushCaches": true,
     "viewConnections": true,
     "viewQueue": true,
-    "runGC": true,
-    "startReplication": true
+    "runGC": true
   }
 ----
 
@@ -366,6 +921,87 @@
   }
 ----
 
+[[get-starred-changes]]
+Get Starred Changes
+~~~~~~~~~~~~~~~~~~~
+[verse]
+'GET /accounts/link:#account-id[\{account-id\}]/starred.changes'
+
+Gets the changes starred by the identified user account. This
+URL endpoint is functionally identical to the changes query
+`GET /changes/?q=is:starred`. The result is a list of
+link:rest-api-changes.html#change-info[ChangeInfo] entities.
+
+.Request
+----
+  GET /a/accounts/self/starred.changes
+----
+
+.Response
+----
+  HTTP/1.1 200 OK
+  Content-Disposition: attachment
+  Content-Type: application/json;charset=UTF-8
+
+  )]}'
+  [
+    {
+      "kind": "gerritcodereview#change",
+      "id": "myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940",
+      "project": "myProject",
+      "branch": "master",
+      "change_id": "I8473b95934b5732ac55d26311a706c9c2bde9940",
+      "subject": "Implementing Feature X",
+      "status": "NEW",
+      "created": "2013-02-01 09:59:32.126000000",
+      "updated": "2013-02-21 11:16:36.775000000",
+      "mergeable": true,
+      "_sortkey": "0023412400000f7d",
+      "_number": 3965,
+      "owner": {
+        "name": "John Doe"
+      }
+    }
+  ]
+----
+
+[[star-change]]
+Star Change
+~~~~~~~~~~~
+[verse]
+'PUT /accounts/link:#account-id[\{account-id\}]/starred.changes/link:rest-api-changes.html#change-id[\{change-id\}]'
+
+Star a change. Starred changes are returned for the search query
+`is:starred` or `starredby:USER` and automatically notify the user
+whenever updates are made to the change.
+
+.Request
+----
+  PUT /a/accounts/self/starred.changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940 HTTP/1.0
+----
+
+.Response
+----
+  HTTP/1.1 204 No Content
+----
+
+[[unstar-change]]
+Unstar Change
+~~~~~~~~~~~~~
+[verse]
+'DELETE /accounts/link:#account-id[\{account-id\}]/starred.changes/link:rest-api-changes#change-id[\{change-id\}]'
+
+Unstar a change. Removes the starred flag, stopping notifications.
+
+.Request
+----
+  DELETE /a/accounts/self/starred.changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940 HTTP/1.0
+----
+
+.Response
+----
+  HTTP/1.1 204 No Content
+----
 
 [[ids]]
 IDs
@@ -391,6 +1027,22 @@
 Identifier of a global capability. Valid values are all field names of
 the link:#capability-info[CapabilityInfo] entity.
 
+[[email-id]]
+\{email-id\}
+~~~~~~~~~~~~
+An email address, or `preferred` for the preferred email address of the
+user.
+
+[[username]]
+\{username\}
+~~~~~~~~~~~~
+The user name.
+
+[[ssh-key-id]]
+\{ssh-key-id\}
+~~~~~~~~~~~~~~
+The sequence number of the SSH key.
+
 
 [[json-entities]]
 JSON Entities
@@ -406,12 +1058,50 @@
 |Field Name    ||Description
 |`_account_id` ||The numeric ID of the account.
 |`name`        |optional|The full name of the user. +
-Only set if detailed account information is requested.
+Only set if link:rest-api-changes.html#detailed-accounts[detailed
+account information] is requested.
 |`email`       |optional|
 The email address the user prefers to be contacted through. +
-Only set if detailed account information is requested.
+Only set if link:rest-api-changes.html#detailed-accounts[detailed
+account information] is requested.
+|`username`    |optional|The username of the user. +
+Only set if link:rest-api-changes.html#detailed-accounts[detailed
+account information] is requested.
 |===========================
 
+[[account-input]]
+AccountInput
+~~~~~~~~~~~~
+The `AccountInput` entity contains information for the creation of
+a new account.
+
+[options="header",width="50%",cols="1,^2,4"]
+|============================
+|Field Name     ||Description
+|`username`     |optional|
+The user name. If provided, must match the user name from the URL.
+|`name`         |optional|The full name of the user.
+|`email`        |optional|The email address of the user.
+|`ssh_key`      |optional|The public SSH key of the user.
+|`http_password`|optional|The HTTP password of the user.
+|`groups`       |optional|
+A list of link:rest-api-groups.html#group-id[group IDs] that identify
+the groups to which the user should be added.
+|============================
+
+[[account-name-input]]
+AccountNameInput
+~~~~~~~~~~~~~~~~
+The `AccountNameInput` entity contains information for setting a name
+for an account.
+
+[options="header",width="50%",cols="1,^2,4"]
+|=============================
+|Field Name ||Description
+|`name`     |optional|The new full name of the account. +
+If not set or if set to an empty string, the account name is deleted.
+|=============================
+
 [[capability-info]]
 CapabilityInfo
 ~~~~~~~~~~~~~~
@@ -453,9 +1143,6 @@
 |`runGC`  |not set if `false`|Whether the user has the
 link:access-control.html#capability_runGC[Run Garbage Collection]
 capability.
-|`startReplication`  |not set if `false`|Whether the user has the
-link:access-control.html#capability_startReplication[Start Replication]
-capability.
 |=================================
 
 [[diff-preferences-info]]
@@ -551,6 +1238,65 @@
 Number of spaces that should be used to display one tab.
 |=====================================
 
+[[email-info]]
+EmailInfo
+~~~~~~~~~
+The `EmailInfo` entity contains information about an email address of a
+user.
+
+[options="header",width="50%",cols="1,^1,5"]
+|========================
+|Field Name ||Description
+|`email`    ||The email address.
+|`preferred`|not set if `false`|
+Whether this is the preferred email address of the user.
+|`pending_confirmation`|not set if `false`|
+Set true if the user must confirm control of the email address
+by following a verification link before Gerrit will permit use of
+this address.
+|========================
+
+[[email-input]]
+EmailInput
+~~~~~~~~~~
+The `EmailInput` entity contains information for registering a new
+email address.
+
+[options="header",width="50%",cols="1,^1,5"]
+|==============================
+|Field Name       ||Description
+|`email`          ||
+The email address. If provided, must match the email address from the
+URL.
+|`preferred`      |`false` if not set|
+Whether the new email address should become the preferred email address
+of the user (only supported if `no_confirmation` is set or if the
+authentication type is `DEVELOPMENT_BECOME_ANY_ACCOUNT`).
+|`no_confirmation`|`false` if not set|
+Whether the email address should be added without confirmation. In this
+case no verification email is sent to the user. +
+Only Gerrit administrators are allowed to add email addresses without
+confirmation.
+|==============================
+
+[[http-password-input]]
+HttpPasswordInput
+~~~~~~~~~~~~~~~~~
+The `HttpPasswordInput` entity contains information for setting/generating
+an HTTP password.
+
+[options="header",width="50%",cols="1,^1,5"]
+|============================
+|Field Name     ||Description
+|`generate`     |`false` if not set|
+Whether a new HTTP password should be generated
+|`http_password`|optional|
+The new HTTP password. Only Gerrit administrators may set the HTTP
+password directly. +
+If empty or not set and `generate` is false or not set, the HTTP
+password is deleted.
+|============================
+
 [[query-limit-info]]
 QueryLimitInfo
 ~~~~~~~~~~~~~~
@@ -564,6 +1310,23 @@
 |`max`               |Upper limit.
 |================================
 
+[[ssh-key-info]]
+SshKeyInfo
+~~~~~~~~~~
+The `SshKeyInfo` entity contains information about an SSH key of a
+user.
+
+[options="header",width="50%",cols="1,^1,5"]
+|=============================
+|Field Name      ||Description
+|`seq`           ||The sequence number of the SSH key.
+|`ssh_public_key`||The complete public SSH key.
+|`encoded_key`   ||The encoded key.
+|`algorithm`     ||The algorithm of the SSH key.
+|`comment`       |optional|The comment of the SSH key.
+|`valid`         ||Whether the SSH key is valid.
+|=============================
+
 
 GERRIT
 ------
diff --git a/Documentation/rest-api-changes.txt b/Documentation/rest-api-changes.txt
index 09c7e11..9404d00 100644
--- a/Documentation/rest-api-changes.txt
+++ b/Documentation/rest-api-changes.txt
@@ -48,7 +48,6 @@
       "status": "NEW",
       "created": "2012-07-17 07:18:30.854000000",
       "updated": "2012-07-17 07:19:27.766000000",
-      "reviewed": true,
       "mergeable": true,
       "_sortkey": "001e7057000006dc",
       "_number": 1756,
@@ -120,7 +119,6 @@
         "status": "NEW",
         "created": "2012-07-17 07:18:30.854000000",
         "updated": "2012-07-17 07:19:27.766000000",
-        "reviewed": true,
         "mergeable": true,
         "_sortkey": "001e7057000006dc",
         "_number": 1756,
@@ -173,11 +171,25 @@
 * `ALL_REVISIONS`: describe all revisions, not just current.
 --
 
+[[download_commands]]
+--
+* `DOWNLOAD_COMMANDS`: include the `commands` field in the
+  link:#fetch-info[FetchInfo] for revisions. Only valid when the
+  `CURRENT_REVISION` or `ALL_REVISIONS` option is selected.
+--
+
+[[draft_comments]]
+--
+* `DRAFT_COMMENTS`: include the `has_draft_comments` field for
+  revisions. Only valid when the `CURRENT_REVISION` or `ALL_REVISIONS`
+  option is selected.
+--
+
 [[current-commit]]
 --
 * `CURRENT_COMMIT`: parse and output all header fields from the
-  commit object, including message. Only valid when the current
-  revision or all revisions are selected.
+  commit object, including message. Only valid when the
+  `CURRENT_REVISION` or `ALL_REVISIONS` option is selected.
 --
 
 [[all-commits]]
@@ -191,21 +203,21 @@
 --
 * `CURRENT_FILES`: list files modified by the commit, including
   basic line counts inserted/deleted per file. Only valid when
-  the current revision or all revisions are selected.
+  the `CURRENT_REVISION` or `ALL_REVISIONS` option is selected.
 --
 
 [[all-files]]
 --
 * `ALL_FILES`: list files modified by the commit, including
   basic line counts inserted/deleted per file. If only the
-  `CURRENT_REVISION` was requested the only that commit's
+  `CURRENT_REVISION` was requested then only that commit's
   modified files will be output.
 --
 
 [[detailed-accounts]]
 --
-* `DETAILED_ACCOUNTS`: include `_account_id` and `email` fields when
-  referencing accounts.
+* `DETAILED_ACCOUNTS`: include `_account_id`, `email` and `username`
+  fields when referencing accounts.
 --
 
 [[messages]]
@@ -213,9 +225,22 @@
 * `MESSAGES`: include messages associated with the change.
 --
 
+[[actions]]
+--
+* `CURRENT_ACTIONS`: include information on available actions
+  for the change and its current revision. The caller must be
+  authenticated to obtain the available actions.
+--
+
+[[reviewed]]
+--
+* `REVIEWED`: include the `reviewed` field if the caller is
+  authenticated and has commented on the current revision.
+--
+
 .Request
 ----
-  GET /changes/?q=97&o=CURRENT_REVISION&o=CURRENT_COMMIT&o=CURRENT_FILES HTTP/1.0
+  GET /changes/?q=97&o=CURRENT_REVISION&o=CURRENT_COMMIT&o=CURRENT_FILES&o=DOWNLOAD_COMMANDS HTTP/1.0
 ----
 
 .Response
@@ -249,11 +274,33 @@
           "fetch": {
             "git": {
               "url": "git://localhost/gerrit",
-              "ref": "refs/changes/97/97/1"
+              "ref": "refs/changes/97/97/1",
+              "commands": {
+                "Checkout": "git fetch git://localhost/gerrit refs/changes/97/97/1 \u0026\u0026 git checkout FETCH_HEAD",
+                "Cherry-Pick": "git fetch git://localhost/gerrit refs/changes/97/97/1 \u0026\u0026 git cherry-pick FETCH_HEAD",
+                "Format-Patch": "git fetch git://localhost/gerrit refs/changes/97/97/1 \u0026\u0026 git format-patch -1 --stdout FETCH_HEAD",
+                "Pull": "git pull git://localhost/gerrit refs/changes/97/97/1"
+              }
             },
             "http": {
-              "url": "http://127.0.0.1:8080/gerrit",
-              "ref": "refs/changes/97/97/1"
+              "url": "http://myuser@127.0.0.1:8080/gerrit",
+              "ref": "refs/changes/97/97/1",
+              "commands": {
+                "Checkout": "git fetch http://myuser@127.0.0.1:8080/gerrit refs/changes/97/97/1 \u0026\u0026 git checkout FETCH_HEAD",
+                "Cherry-Pick": "git fetch http://myuser@127.0.0.1:8080/gerrit refs/changes/97/97/1 \u0026\u0026 git cherry-pick FETCH_HEAD",
+                "Format-Patch": "git fetch http://myuser@127.0.0.1:8080/gerrit refs/changes/97/97/1 \u0026\u0026 git format-patch -1 --stdout FETCH_HEAD",
+                "Pull": "git pull http://myuser@127.0.0.1:8080/gerrit refs/changes/97/97/1"
+              }
+            },
+            "ssh": {
+              "url": "ssh://myuser@*:29418/gerrit",
+              "ref": "refs/changes/97/97/1",
+              "commands": {
+                "Checkout": "git fetch ssh://myuser@*:29418/gerrit refs/changes/97/97/1 \u0026\u0026 git checkout FETCH_HEAD",
+                "Cherry-Pick": "git fetch ssh://myuser@*:29418/gerrit refs/changes/97/97/1 \u0026\u0026 git cherry-pick FETCH_HEAD",
+                "Format-Patch": "git fetch ssh://myuser@*:29418/gerrit refs/changes/97/97/1 \u0026\u0026 git format-patch -1 --stdout FETCH_HEAD",
+                "Pull": "git pull ssh://myuser@*:29418/gerrit refs/changes/97/97/1"
+              }
             }
           },
           "commit": {
@@ -319,6 +366,11 @@
 
 Retrieves a change.
 
+Additional fields can be obtained by adding `o` parameters, each
+option requires more database lookups and slows down the query
+response time to the client so they are generally disabled by
+default. Fields are described in link:#list-changes[Query Changes].
+
 .Request
 ----
   GET /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940 HTTP/1.0
@@ -344,7 +396,6 @@
     "status": "NEW",
     "created": "2013-02-01 09:59:32.126000000",
     "updated": "2013-02-21 11:16:36.775000000",
-    "reviewed": true,
     "mergeable": true,
     "_sortkey": "0023412400000f7d",
     "_number": 3965,
@@ -364,6 +415,11 @@
 detailed labels], link:#detailed-accounts[detailed accounts], and
 link:#messages[messages].
 
+Additional fields can be obtained by adding `o` parameters, each
+option requires more database lookups and slows down the query
+response time to the client so they are generally disabled by
+default. Fields are described in link:#list-changes[Query Changes].
+
 .Request
 ----
   GET /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/detail HTTP/1.0
@@ -389,14 +445,14 @@
     "status": "NEW",
     "created": "2013-02-01 09:59:32.126000000",
     "updated": "2013-02-21 11:16:36.775000000",
-    "reviewed": true,
     "mergeable": true,
     "_sortkey": "0023412400000f7d",
     "_number": 3965,
     "owner": {
       "_account_id": 1000096,
       "name": "John Doe",
-      "email": "john.doe@example.com"
+      "email": "john.doe@example.com",
+      "username": "jdoe"
     },
     "labels": {
       "Verified": {
@@ -405,13 +461,15 @@
             "value": 0,
             "_account_id": 1000096,
             "name": "John Doe",
-            "email": "john.doe@example.com"
+            "email": "john.doe@example.com",
+            "username": "jdoe"
           },
           {
             "value": 0,
             "_account_id": 1000097,
             "name": "Jane Roe",
-            "email": "jane.roe@example.com"
+            "email": "jane.roe@example.com",
+            "username": "jroe"
           }
         ],
         "values": {
@@ -424,25 +482,29 @@
         "recommended": {
           "_account_id": 1000097,
           "name": "Jane Roe",
-          "email": "jane.roe@example.com"
+          "email": "jane.roe@example.com",
+          "username": "jroe"
         },
         "disliked": {
           "_account_id": 1000096,
           "name": "John Doe",
-          "email": "john.doe@example.com"
+          "email": "john.doe@example.com",
+          "username": "jdoe"
         },
         "all": [
           {
             "value": -1,
             "_account_id": 1000096,
             "name": "John Doe",
-            "email": "john.doe@example.com"
+            "email": "john.doe@example.com",
+            "username": "jdoe"
           },
           {
             "value": 1,
             "_account_id": 1000097,
             "name": "Jane Roe",
-            "email": "jane.roe@example.com"
+            "email": "jane.roe@example.com",
+            "username": "jroe"
           }
         ]
         "values": {
@@ -472,12 +534,14 @@
       {
         "_account_id": 1000096,
         "name": "John Doe",
-        "email": "john.doe@example.com"
+        "email": "john.doe@example.com",
+        "username": "jdoe"
       },
       {
         "_account_id": 1000097,
         "name": "Jane Roe",
-        "email": "jane.roe@example.com"
+        "email": "jane.roe@example.com",
+        "username": "jroe"
       }
     ],
     "messages": [
@@ -486,7 +550,8 @@
         "author": {
           "_account_id": 1000096,
           "name": "John Doe",
-          "email": "john.doe@example.com"
+          "email": "john.doe@example.com",
+          "username": "jdoe"
         },
         "updated": "2013-03-23 21:34:02.419000000",
         "message": "Patch Set 1:\n\nThis is the first message.",
@@ -497,7 +562,8 @@
         "author": {
           "_account_id": 1000097,
           "name": "Jane Roe",
-          "email": "jane.roe@example.com"
+          "email": "jane.roe@example.com",
+          "username": "jroe"
         },
         "updated": "2013-03-23 21:36:52.332000000",
         "message": "Patch Set 1:\n\nThis is the second message.\n\nWith a line break.",
@@ -628,7 +694,6 @@
     "status": "ABANDONED",
     "created": "2013-02-01 09:59:32.126000000",
     "updated": "2013-02-21 11:16:36.775000000",
-    "reviewed": true,
     "mergeable": true,
     "_sortkey": "0023412400000f7d",
     "_number": 3965,
@@ -687,7 +752,6 @@
     "status": "NEW",
     "created": "2013-02-01 09:59:32.126000000",
     "updated": "2013-02-21 11:16:36.775000000",
-    "reviewed": true,
     "mergeable": true,
     "_sortkey": "0023412400000f7d",
     "_number": 3965,
@@ -710,6 +774,95 @@
   change is new
 ----
 
+[[rebase-change]]
+Rebase Change
+~~~~~~~~~~~~~
+[verse]
+'POST /changes/link:#change-id[\{change-id\}]/rebase'
+
+Rebases a change.
+
+.Request
+----
+  POST /changes/myProject~master~I3ea943139cb62e86071996f2480e58bf3eeb9dd2/rebase HTTP/1.0
+----
+
+As response a link:#change-info[ChangeInfo] entity is returned that
+describes the rebased change. Information about the current patch set
+is included.
+
+.Response
+----
+  HTTP/1.1 200 OK
+  Content-Disposition: attachment
+  Content-Type: application/json;charset=UTF-8
+
+  )]}'
+  {
+    "kind": "gerritcodereview#change",
+    "id": "myProject~master~I3ea943139cb62e86071996f2480e58bf3eeb9dd2",
+    "project": "myProject",
+    "branch": "master",
+    "change_id": "I3ea943139cb62e86071996f2480e58bf3eeb9dd2",
+    "subject": "Implement Feature X",
+    "status": "NEW",
+    "created": "2013-02-01 09:59:32.126000000",
+    "updated": "2013-02-21 11:16:36.775000000",
+    "mergeable": false,
+    "_sortkey": "0024cf9a000012bf",
+    "_number": 4799,
+    "owner": {
+      "name": "John Doe"
+    },
+    "current_revision": "27cc4558b5a3d3387dd11ee2df7a117e7e581822",
+    "revisions": {
+      "27cc4558b5a3d3387dd11ee2df7a117e7e581822": {
+        "_number": 2,
+        "fetch": {
+          "http": {
+            "url": "http://gerrit:8080/myProject",
+            "ref": "refs/changes/99/4799/2"
+          }
+        },
+        "commit": {
+          "parents": [
+            {
+              "commit": "b4003890dadd406d80222bf1ad8aca09a4876b70",
+              "subject": "Implement Feature A"
+            }
+        ],
+        "author": {
+          "name": "John Doe",
+          "email": "john.doe@example.com",
+          "date": "2013-05-07 15:21:27.000000000",
+          "tz": 120
+        },
+        "committer": {
+          "name": "Gerrit Code Review",
+          "email": "gerrit-server@example.com",
+          "date": "2013-05-07 15:35:43.000000000",
+          "tz": 120
+        },
+        "subject": "Implement Feature X",
+        "message": "Implement Feature X\n\nAdded feature X."
+      }
+    }
+  }
+----
+
+If the change cannot be rebased, e.g. due to conflicts, the response is
+"`409 Conflict`" and the error message is contained in the response
+body.
+
+.Response
+----
+  HTTP/1.1 409 Conflict
+  Content-Disposition: attachment
+  Content-Type: text/plain;charset=UTF-8
+
+  The change could not be rebased due to a path conflict during merge.
+----
+
 [[revert-change]]
 Revert Change
 ~~~~~~~~~~~~~
@@ -746,7 +899,6 @@
     "status": "NEW",
     "created": "2013-02-01 09:59:32.126000000",
     "updated": "2013-02-21 11:16:36.775000000",
-    "reviewed": true,
     "mergeable": true,
     "_sortkey": "0023412400000f7d",
     "_number": 3965,
@@ -811,7 +963,6 @@
     "status": "MERGED",
     "created": "2013-02-01 09:59:32.126000000",
     "updated": "2013-02-21 11:16:36.775000000",
-    "reviewed": true,
     "_sortkey": "0023412400000f7d",
     "_number": 3965,
     "owner": {
@@ -833,6 +984,74 @@
   blocked by Verified
 ----
 
+[[publish-draft-change]]
+Publish Draft Change
+~~~~~~~~~~~~~~~~~~~~
+[verse]
+'POST /changes/link:#change-id[\{change-id\}]/publish'
+
+Publishes a draft change.
+
+.Request
+----
+  POST /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/publish HTTP/1.0
+  Content-Type: application/json;charset=UTF-8
+----
+
+.Response
+----
+  HTTP/1.1 204 No Content
+----
+
+[[delete-draft-change]]
+Delete Draft Change
+~~~~~~~~~~~~~~~~~~~
+[verse]
+'DELETE /changes/link:#change-id[\{change-id\}]'
+
+Deletes a draft change.
+
+.Request
+----
+  DELETE /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940 HTTP/1.0
+  Content-Type: application/json;charset=UTF-8
+----
+
+.Response
+----
+  HTTP/1.1 204 No Content
+----
+
+[[get-included-in]]
+Get Included In
+~~~~~~~~~~~~~~~
+[verse]
+'GET /changes/link:#change-id[\{change-id\}]/in'
+
+Retrieves the branches and tags in which a change is included. As result
+an link:#included-in-info[IncludedInInfo] entity is returned.
+
+.Request
+----
+  GET /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/in HTTP/1.0
+----
+
+.Response
+----
+  HTTP/1.1 200 OK
+  Content-Disposition: attachment
+  Content-Type: application/json;charset=UTF-8
+
+  )]}'
+  {
+    "kind": "gerritcodereview#includedininfo",
+    "branches": [
+      "master"
+    ],
+    "tags": []
+  }
+----
+
 [[reviewer-endpoints]]
 Reviewer Endpoints
 ------------------
@@ -883,6 +1102,48 @@
   ]
 ----
 
+[[suggest-reviewers]]
+Suggest Reviewers
+~~~~~~~~~~~~~~~~~
+[verse]
+'GET /changes/link:#change-id[\{change-id\}]/suggest_reviewers?q=J&n=5'
+
+Suggest the reviewers for a given query `q` and result limit `n`. If result
+limit is not passed, then the default 10 is used.
+
+As result a list of link:#suggested-reviewer-info[SuggestedReviewerInfo] entries is returned.
+
+.Request
+----
+  GET /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/suggest_reviewers?q=J HTTP/1.0
+----
+
+.Response
+----
+  HTTP/1.1 200 OK
+  Content-Disposition: attachment
+  Content-Type: application/json;charset=UTF-8
+
+  )]}'
+  [
+    {
+      "kind": "gerritcodereview#suggestedreviewer",
+      "account": {
+        "_account_id": 1000097,
+        "name": "Jane Roe",
+        "email": "jane.roe@example.com"
+      }
+    },
+    {
+      "kind": "gerritcodereview#suggestedreviewer",
+      "group": {
+        "id": "4fd581c0657268f2bdcc26699fbf9ddb76e3a279",
+        "name": "Joiner"
+      }
+    }
+  ]
+----
+
 [[get-reviewer]]
 Get Reviewer
 ~~~~~~~~~~~~
@@ -1031,6 +1292,55 @@
 Revision Endpoints
 ------------------
 
+[[get-commit]]
+Get Commit
+~~~~~~~~~~
+[verse]
+'GET /changes/link:#change-id[\{change-id\}]/revisions/link:#revision-id[\{revision-id\}]/commit'
+
+Retrieves a parsed commit of a revision.
+
+.Request
+----
+  GET /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/revisions/674ac754f91e64a0efb8087e59a176484bd534d1/commit HTTP/1.0
+----
+
+As response a link:#commit-info[CommitInfo] entity is returned that
+describes the revision.
+
+.Response
+----
+  HTTP/1.1 200 OK
+  Content-Disposition: attachment
+  Content-Type: application/json;charset=UTF-8
+
+  )]}'
+  {
+    "kind": "gerritcodereview#commit",
+    "parents": [
+      {
+        "commit": "1eee2c9d8f352483781e772f35dc586a69ff5646",
+        "subject": "Migrate contributor agreements to All-Projects."
+      }
+    ],
+    "author": {
+      "name": "Shawn O. Pearce",
+      "email": "sop@google.com",
+      "date": "2012-04-24 18:08:08.000000000",
+      "tz": -420
+    },
+    "committer": {
+      "name": "Shawn O. Pearce",
+      "email": "sop@google.com",
+      "date": "2012-04-24 18:08:08.000000000",
+      "tz": -420
+    },
+    "subject": "Use an EventBus to manage star icons",
+    "message": "Use an EventBus to manage star icons\n\nImage widgets that need to ..."
+  }
+----
+
+
 [[get-review]]
 Get Review
 ~~~~~~~~~~
@@ -1070,7 +1380,6 @@
     "status": "NEW",
     "created": "2013-02-01 09:59:32.126000000",
     "updated": "2013-02-21 11:16:36.775000000",
-    "reviewed": true,
     "mergeable": true,
     "_sortkey": "0023412400000f7d",
     "_number": 3965,
@@ -1218,6 +1527,95 @@
   }
 ----
 
+[[rebase-revision]]
+Rebase Revision
+~~~~~~~~~~~~~~~
+[verse]
+'POST /changes/link:#change-id[\{change-id\}]/revisions/link:#revision-id[\{revision-id\}]/rebase'
+
+Rebases a revision.
+
+.Request
+----
+  POST /changes/myProject~master~I3ea943139cb62e86071996f2480e58bf3eeb9dd2/revisions/674ac754f91e64a0efb8087e59a176484bd534d1/rebase HTTP/1.0
+----
+
+As response a link:#change-info[ChangeInfo] entity is returned that
+describes the rebased change. Information about the current patch set
+is included.
+
+.Response
+----
+  HTTP/1.1 200 OK
+  Content-Disposition: attachment
+  Content-Type: application/json;charset=UTF-8
+
+  )]}'
+  {
+    "kind": "gerritcodereview#change",
+    "id": "myProject~master~I3ea943139cb62e86071996f2480e58bf3eeb9dd2",
+    "project": "myProject",
+    "branch": "master",
+    "change_id": "I3ea943139cb62e86071996f2480e58bf3eeb9dd2",
+    "subject": "Implement Feature X",
+    "status": "NEW",
+    "created": "2013-02-01 09:59:32.126000000",
+    "updated": "2013-02-21 11:16:36.775000000",
+    "mergeable": false,
+    "_sortkey": "0024cf9a000012bf",
+    "_number": 4799,
+    "owner": {
+      "name": "John Doe"
+    },
+    "current_revision": "27cc4558b5a3d3387dd11ee2df7a117e7e581822",
+    "revisions": {
+      "27cc4558b5a3d3387dd11ee2df7a117e7e581822": {
+        "_number": 2,
+        "fetch": {
+          "http": {
+            "url": "http://gerrit:8080/myProject",
+            "ref": "refs/changes/99/4799/2"
+          }
+        },
+        "commit": {
+          "parents": [
+            {
+              "commit": "b4003890dadd406d80222bf1ad8aca09a4876b70",
+              "subject": "Implement Feature A"
+            }
+        ],
+        "author": {
+          "name": "John Doe",
+          "email": "john.doe@example.com",
+          "date": "2013-05-07 15:21:27.000000000",
+          "tz": 120
+        },
+        "committer": {
+          "name": "Gerrit Code Review",
+          "email": "gerrit-server@example.com",
+          "date": "2013-05-07 15:35:43.000000000",
+          "tz": 120
+        },
+        "subject": "Implement Feature X",
+        "message": "Implement Feature X\n\nAdded feature X."
+      }
+    }
+  }
+----
+
+If the revision cannot be rebased, e.g. due to conflicts, the response is
+"`409 Conflict`" and the error message is contained in the response
+body.
+
+.Response
+----
+  HTTP/1.1 409 Conflict
+  Content-Disposition: attachment
+  Content-Type: text/plain;charset=UTF-8
+
+  The change could not be rebased due to a path conflict during merge.
+----
+
 [[submit-revision]]
 Submit Revision
 ~~~~~~~~~~~~~~~
@@ -1268,6 +1666,106 @@
   "revision 674ac754f91e64a0efb8087e59a176484bd534d1 is not current revision"
 ----
 
+[[publish-draft-revision]]
+Publish Draft Revision
+~~~~~~~~~~~~~~~~~~~~~~
+[verse]
+'POST /changes/link:#change-id[\{change-id\}]/revisions/link:#revision-id[\{revision-id\}]/publish'
+
+Publishes a draft revision.
+
+.Request
+----
+  POST /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/revisions/current/publish HTTP/1.0
+  Content-Type: application/json;charset=UTF-8
+----
+
+.Response
+----
+  HTTP/1.1 204 No Content
+----
+
+[[delete-draft-revision]]
+Delete Draft Revision
+~~~~~~~~~~~~~~~~~~~~~
+[verse]
+'DELETE /changes/link:#change-id[\{change-id\}]/revisions/link:#revision-id[\{revision-id\}]'
+
+Deletes a draft revision.
+
+.Request
+----
+  DELETE /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/revisions/674ac754f91e64a0efb8087e59a176484bd534d1 HTTP/1.0
+  Content-Type: application/json;charset=UTF-8
+----
+
+.Response
+----
+  HTTP/1.1 204 No Content
+----
+
+[[get-patch]]
+Get Patch
+~~~~~~~~~
+[verse]
+'GET /changes/link:#change-id[\{change-id\}]/revisions/link:#revision-id[\{revision-id\}]/patch'
+
+Gets the formatted patch for one revision.
+
+.Request
+----
+  GET /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/revisions/current/patch HTTP/1.0
+----
+
+The formatted patch is returned as text encoded inside base64:
+
+.Response
+----
+  HTTP/1.1 200 OK
+  Content-Disposition: attachment
+  Content-Type: text/plain;charset=ISO-8859-1
+  X-FYI-Content-Encoding: base64
+  X-FYI-Content-Type: application/mbox
+
+  RnJvbSA3ZGFkY2MxNTNmZGVhMTdhYTg0ZmYzMmE2ZTI0NWRiYjY...
+----
+
+Adding query parameter `zip` (for example `/changes/.../patch?zip`)
+returns the patch as a single file inside of a ZIP archive. Clients
+can expand the ZIP to obtain the plain text patch, avoiding the
+need for a base64 decoding step. This option implies `download`.
+
+Query parameter `download` (e.g. `/changes/.../patch?download`)
+will suggest the browser save the patch as `commitsha1.diff.base64`,
+for later processing by command line tools.
+
+[[get-mergeable]]
+Get Mergeable
+~~~~~~~~~~~~~
+[verse]
+'GET /changes/link:#change-id[\{change-id\}]/revisions/link:#revision-id[\{revision-id\}]/mergeable'
+
+Gets the method the server will use to submit (merge) the change and
+an indicator if the change is currently mergeable.
+
+.Request
+----
+  GET /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/revisions/current/mergeable HTTP/1.0
+----
+
+.Response
+----
+  HTTP/1.1 200 OK
+  Content-Disposition: attachment
+  Content-Type: application/json;charset=UTF-8
+
+  )]}'
+  {
+    submit_type: "MERGE_IF_NECESSARY",
+    mergeable: true,
+  }
+----
+
 [[get-submit-type]]
 Get Submit Type
 ~~~~~~~~~~~~~~~
@@ -1319,7 +1817,7 @@
   Content-Type: application/json;charset=UTF-8
 
   )]}'
-  "cherry_pick"
+  "CHERRY_PICK"
 ----
 
 [[test-submit-rule]]
@@ -1641,13 +2139,261 @@
   }
 ----
 
+[[list-files]]
+List Files
+~~~~~~~~~~
+[verse]
+'GET /changes/link:#change-id[\{change-id\}]/revisions/link:#revision-id[\{revision-id\}]/files/'
+
+Lists the files that were modified, added or deleted in a revision.
+
+.Request
+----
+  GET /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/revisions/674ac754f91e64a0efb8087e59a176484bd534d1/files/ HTTP/1.0
+----
+
+As result a map is returned that maps the file path to a list of
+link:#file-info[FileInfo] entries. The entries in the map are
+sorted by file path.
+
+.Response
+----
+  HTTP/1.1 200 OK
+  Content-Disposition: attachment
+  Content-Type: application/json;charset=UTF-8
+
+  )]}'
+  {
+    "/COMMIT_MSG": {
+      "status": "A",
+      "lines_inserted": 7
+    },
+    "gerrit-server/src/main/java/com/google/gerrit/server/project/RefControl.java": {
+      "lines_inserted": 5,
+      "lines_deleted": 3
+    }
+  }
+----
+
+The request parameter `reviewed` changes the response to return a list
+of the paths the caller has marked as reviewed.  Clients that also
+need the FileInfo should make two requests.
+
+.Request
+----
+  GET /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/revisions/674ac754f91e64a0efb8087e59a176484bd534d1/files/?reviewed HTTP/1.0
+----
+
+.Response
+----
+  HTTP/1.1 200 OK
+  Content-Disposition: attachment
+  Content-Type: application/json;charset=UTF-8
+
+  )]}'
+  [
+    "/COMMIT_MSG",
+    "gerrit-server/src/main/java/com/google/gerrit/server/project/RefControl.java",
+  ]
+----
+
+[[get-content]]
+Get Content
+~~~~~~~~~~~
+[verse]
+'GET /changes/link:#change-id[\{change-id\}]/revisions/link:#revision-id[\{revision-id\}]/files/link:#file-id[\{file-id\}]/content'
+
+Gets the content of a file from a certain revision.
+
+.Request
+----
+  GET /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/revisions/674ac754f91e64a0efb8087e59a176484bd534d1/files/gerrit-server%2Fsrc%2Fmain%2Fjava%2Fcom%2Fgoogle%2Fgerrit%2Fserver%2Fproject%2FRefControl.java/content HTTP/1.0
+----
+
+The content is returned as base64 encoded string.
+
+.Response
+----
+  HTTP/1.1 200 OK
+  Content-Disposition: attachment
+  Content-Type: text/plain;charset=UTF-8
+
+  Ly8gQ29weXJpZ2h0IChDKSAyMDEwIFRoZSBBbmRyb2lkIE9wZW4gU291cmNlIFByb2plY...
+----
+
+[[get-diff]]
+Get Diff
+~~~~~~~~
+[verse]
+'GET /changes/link:#change-id[\{change-id\}]/revisions/link:#revision-id[\{revision-id\}]/files/link:#file-id[\{file-id\}]/diff'
+
+Gets the diff of a file from a certain revision.
+
+.Request
+----
+  GET /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/revisions/674ac754f91e64a0efb8087e59a176484bd534d1/files/gerrit-server%2Fsrc%2Fmain%2Fjava%2Fcom%2Fgoogle%2Fgerrit%2Fserver%2Fproject%2FRefControl.java/diff HTTP/1.0
+----
+
+As response a link:#diff-info[DiffInfo] entity is returned that describes the diff.
+
+.Response
+----
+  HTTP/1.1 200 OK
+  Content-Disposition: attachment
+  Content-Type: application/json;charset=UTF-8
+
+  )]
+  {
+    "meta_a": {
+      "name": "gerrit-server/src/main/java/com/google/gerrit/server/project/RefControl.java",
+      "content_type": "text/x-java-source"
+    },
+    "meta_b": {
+      "name": "gerrit-server/src/main/java/com/google/gerrit/server/project/RefControl.java",
+      "content_type": "text/x-java-source"
+    },
+    "change_type": "MODIFIED",
+    "diff_header": [
+      "diff --git a/gerrit-server/src/main/java/com/google/gerrit/server/project/RefControl.java b/gerrit-server/src/main/java/com/google/gerrit/server/project/RefControl.java",
+      "index 59b7670..9faf81c 100644",
+      "--- a/gerrit-server/src/main/java/com/google/gerrit/server/project/RefControl.java",
+      "+++ b/gerrit-server/src/main/java/com/google/gerrit/server/project/RefControl.java"
+    ],
+    "content": [
+      {
+        "ab": [
+          "// Copyright (C) 2010 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."
+        ]
+      },
+      {
+        "b": [
+          "//",
+          "// Add some more lines in the header."
+        ]
+      },
+      {
+        "ab": [
+          "",
+          "package com.google.gerrit.server.project;",
+          "",
+          "import com.google.common.collect.Maps;",
+          ...
+        ]
+      }
+      ...
+    ]
+  }
+----
+
+If the `intraline` parameter is specified, intraline differences are included in the diff.
+
+.Request
+----
+  GET /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/revisions/b6b9c10649b9041884046119ab794374470a1b45/files/gerrit-server%2Fsrc%2Fmain%2Fjava%2Fcom%2Fgoogle%2Fgerrit%2Fserver%2Fproject%2FRefControl.java/diff?intraline HTTP/1.0
+----
+
+.Response
+----
+  HTTP/1.1 200 OK
+  Content-Disposition: attachment
+  Content-Type: application/json;charset=UTF-8
+
+  )]
+  {
+    "meta_a": {
+      "name": "gerrit-server/src/main/java/com/google/gerrit/server/project/RefControl.java",
+      "content_type": "text/x-java-source"
+    },
+    "meta_b": {
+      "name": "gerrit-server/src/main/java/com/google/gerrit/server/project/RefControl.java",
+      "content_type": "text/x-java-source"
+    },
+    "change_type": "MODIFIED",
+    "diff_header": [
+      "diff --git a/gerrit-server/src/main/java/com/google/gerrit/server/project/RefControl.java b/gerrit-server/src/main/java/com/google/gerrit/server/project/RefControl.java",
+      "index 59b7670..9faf81c 100644",
+      "--- a/gerrit-server/src/main/java/com/google/gerrit/server/project/RefControl.java",
+      "+++ b/gerrit-server/src/main/java/com/google/gerrit/server/project/RefControl.java"
+    ],
+    "content": [
+      ...
+      {
+        "a": [
+          "/** Manages access control for Git references (aka branches, tags). */"
+        ],
+        "b": [
+          "/** Manages access control for the Git references (aka branches, tags). */"
+        ],
+        "edit_a": [],
+        "edit_b": [
+          [
+            31,
+            4
+          ]
+        ]
+      }
+      ]
+    }
+----
+
+The `base` parameter can be specified to control the base patch set from which the diff should
+be generated.
+
+.Request
+----
+  GET /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/revisions/b6b9c10649b9041884046119ab794374470a1b45/files/gerrit-server%2Fsrc%2Fmain%2Fjava%2Fcom%2Fgoogle%2Fgerrit%2Fserver%2Fproject%2FRefControl.java/diff?base=2 HTTP/1.0
+----
+
+.Response
+----
+  HTTP/1.1 200 OK
+  Content-Disposition: attachment
+  Content-Type: application/json;charset=UTF-8
+
+  )]
+  {
+    "meta_a": {
+      "name": "gerrit-server/src/main/java/com/google/gerrit/server/project/RefControl.java",
+      "content_type": "text/x-java-source"
+    },
+    "meta_b": {
+      "name": "gerrit-server/src/main/java/com/google/gerrit/server/project/RefControl.java",
+      "content_type": "text/x-java-source"
+    },
+    "change_type": "MODIFIED",
+    "content": [
+      {
+        "skip": 578
+      }
+    ]
+  }
+----
+
+The `ignore-whitespace` parameter can be specified to control how whitespace differences are
+reported in the result.  Valid values are `NONE`, `TRAILING`, `CHANGED` or `ALL`.
+
+The `context` parameter can be specified to control the number of lines of surrounding context
+in the diff.  Valid values are `ALL` or number of lines.
+
 [[set-reviewed]]
 Set Reviewed
 ~~~~~~~~~~~~
 [verse]
-'PUT /changes/link:#change-id[\{change-id\}]/revisions/link:#revision-id[\{revision-id\}]/files/link:#patch-id[\{patch-id\}]/reviewed'
+'PUT /changes/link:#change-id[\{change-id\}]/revisions/link:#revision-id[\{revision-id\}]/files/link:#file-id[\{file-id\}]/reviewed'
 
-Marks a patch of a revision as reviewed by the calling user.
+Marks a file of a revision as reviewed by the calling user.
 
 .Request
 ----
@@ -1659,16 +2405,16 @@
   HTTP/1.1 201 Created
 ----
 
-If the patch was already marked as reviewed by the calling user the
+If the file was already marked as reviewed by the calling user the
 response is "`200 OK`".
 
 [[delete-reviewed]]
 Delete Reviewed
 ~~~~~~~~~~~~~~~
 [verse]
-'DELETE /changes/link:#change-id[\{change-id\}]/revisions/link:#revision-id[\{revision-id\}]/files/link:#patch-id[\{patch-id\}]/reviewed'
+'DELETE /changes/link:#change-id[\{change-id\}]/revisions/link:#revision-id[\{revision-id\}]/files/link:#file-id[\{file-id\}]/reviewed'
 
-Deletes the reviewed flag of the calling user from a patch of a revision.
+Deletes the reviewed flag of the calling user from a file of a revision.
 
 .Request
 ----
@@ -1680,6 +2426,106 @@
   HTTP/1.1 204 No Content
 ----
 
+[[cherry-pick]]
+Cherry Pick Revision
+~~~~~~~~~~~~~~~~~~~~
+[verse]
+'POST /changes/link:#change-id[\{change-id\}]/revisions/link:#revision-id[\{revision-id\}]/cherrypick'
+
+Cherry picks a revision to a destination branch.
+
+The commit message and destination branch must be provided in the request body inside a
+link:#cherrypick-input[CherryPickInput] entity.
+
+.Request
+----
+  POST /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/revisions/674ac754f91e64a0efb8087e59a176484bd534d1/cherrypick HTTP/1.0
+  Content-Type: application/json;charset=UTF-8
+
+  {
+    "message" : "Implementing Feature X",
+    "destination" : "release-branch"
+  }
+----
+
+As response a link:#change-info[ChangeInfo] entity is returned that
+describes the resulting cherry picked change.
+
+.Response
+----
+  HTTP/1.1 200 OK
+  Content-Disposition: attachment
+  Content-Type: application/json;charset=UTF-8
+
+  )]}'
+  {
+    "kind": "gerritcodereview#change",
+    "id": "myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9941",
+    "project": "myProject",
+    "branch": "release-branch",
+    "change_id": "I8473b95934b5732ac55d26311a706c9c2bde9941",
+    "subject": "Implementing Feature X",
+    "status": "NEW",
+    "created": "2013-02-01 09:59:32.126000000",
+    "updated": "2013-02-21 11:16:36.775000000",
+    "mergeable": true,
+    "_sortkey": "0023412400000f7d",
+    "_number": 3965,
+    "owner": {
+      "name": "John Doe"
+    }
+  }
+----
+
+[[message]]
+Edit Commit Message
+~~~~~~~~~~~~~~~~~~~
+[verse]
+'POST /changes/link:#change-id[\{change-id\}]/revisions/link:#revision-id[\{revision-id\}]/message'
+
+Edit commit message.
+
+The commit message must be provided in the request body inside a
+link:#cherrypick-input[CherryPickInput] entity.
+
+.Request
+----
+  POST /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/revisions/674ac754f91e64a0efb8087e59a176484bd534d1/message HTTP/1.0
+  Content-Type: application/json;charset=UTF-8
+
+  {
+    "message" : "Reword Implementing Feature X",
+  }
+----
+
+As response a link:#change-info[ChangeInfo] entity is returned that
+describes the change.
+
+.Response
+----
+  HTTP/1.1 200 OK
+  Content-Disposition: attachment
+  Content-Type: application/json;charset=UTF-8
+
+  )]}'
+  {
+    "kind": "gerritcodereview#change",
+    "id": "myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9941",
+    "project": "myProject",
+    "branch": "release-branch",
+    "change_id": "I8473b95934b5732ac55d26311a706c9c2bde9941",
+    "subject": "Reword Implementing Feature X",
+    "status": "NEW",
+    "created": "2013-02-01 09:59:32.126000000",
+    "updated": "2013-02-21 11:16:36.775000000",
+    "mergeable": true,
+    "_sortkey": "0023412400000f7d",
+    "_number": 3965,
+    "owner": {
+      "name": "John Doe"
+    }
+  }
+----
 
 [[ids]]
 IDs
@@ -1715,10 +2561,10 @@
 ~~~~~~~~~~~~
 UUID of a draft comment.
 
-[[patch-id]]
-\{patch-id\}
+[[file-id]]
+\{file-id\}
 ~~~~~~~~~~~~
-The file path of the patch.
+The path of the file.
 
 [[revision-id]]
 \{revision-id\}
@@ -1733,7 +2579,6 @@
   change ("674ac754"), at least 4 digits are required
 * a legacy numeric patch number ("1" for first patch set of the change)
 
-
 [[json-entities]]
 JSON Entities
 -------------
@@ -1751,6 +2596,33 @@
 change.
 |===========================
 
+[[action-info]]
+ActionInfo
+~~~~~~~~~~
+The `ActionInfo` entity describes a REST API call the client can
+make to manipulate a resource. These are frequently implemented by
+plugins and may be discovered at runtime.
+
+[options="header",width="50%",cols="1,^1,5"]
+|====================================
+|Field Name             ||Description
+|`method`               |optional|
+HTTP method to use with the action. Most actions use `POST`, `PUT`
+or `DELETE` to cause state changes.
+|`label`                |optional|
+Short title to display to a user describing the action. In the
+Gerrit web interface the label is used as the text on the button
+presented in the UI.
+|`title`                |optional|
+Longer text to display describing the action. In a web UI this
+should be the title attribute of the element, displaying when
+the user hovers the mouse.
+|`enabled`              |optional|
+If true the action is permitted at this time and the caller is
+likely allowed to execute it. This may change if state is updated
+at the server or permissions are modified. Not present if false.
+|====================================
+
 [[add-reviewer-result]]
 AddReviewerResult
 ~~~~~~~~~~~~~~~~~
@@ -1788,8 +2660,22 @@
 The vote that the user has given for the label. If present and zero, the
 user is permitted to vote on the label. If absent, the user is not
 permitted to vote on that label.
+|`date`        |optional|
+The time and date describing when the approval was made.
 |===========================
 
+[[group-base-info]]
+GroupBaseInfo
+~~~~~~~~~~~~~
+The `GroupBaseInfo` entity contains base information about the group.
+
+[options="header",width="50%",cols="1,6"]
+|==========================
+|Field Name    |Description
+|`id`          |The id of the group.
+|`name`        |The name of the group.
+|==========================
+
 [[change-info]]
 ChangeInfo
 ~~~~~~~~~~
@@ -1824,6 +2710,7 @@
 Whether the calling user has starred this change.
 |`reviewed`           |not set if `false`|
 Whether the change was reviewed by the calling user.
+Only set if link:#reviewed[reviewed] is requested.
 |`mergeable`          |optional|
 Whether the change is mergeable. +
 Not set for merged changes.
@@ -1832,6 +2719,10 @@
 |`owner`              ||
 The owner of the change as an link:rest-api-accounts.html#account-info[
 AccountInfo] entity.
+|`actions`            |optional|
+Actions the caller might be able to perform on this revision. The
+information is a map of view name to link:#action-info[ActionInfo]
+entities.
 |`labels`             |optional|
 The labels of the change as a map that maps the label names to
 link:#label-info[LabelInfo] entries. +
@@ -1846,7 +2737,7 @@
 link:rest-api-accounts.html#account-info[AccountInfo] entities. +
 Only set if link:#detailed-labels[detailed labels] are requested.
 |`messages`|optional|
-Messages associated with the change as a list of 
+Messages associated with the change as a list of
 link:#change-message-info[ChangeMessageInfo] entities. +
 Only set if link:#messages[messages] are requested.
 |`current_revision`   |optional|
@@ -1883,6 +2774,18 @@
 Which patchset (if any) generated this message.
 |==================================
 
+[[cherrypick-input]]
+CherryPickInput
+~~~~~~~~~~~~~~~
+The `CherryPickInput` entity contains information for cherry-picking a change to a new branch.
+
+[options="header",width="50%",cols="1,6"]
+|===========================
+|Field Name    |Description
+|`message`     |Commit message for the cherry-picked change
+|`destination` |Destination Branch
+|===========================
+
 [[comment-info]]
 CommentInfo
 ~~~~~~~~~~~
@@ -1902,7 +2805,11 @@
 If not set, the default is `REVISION`.
 |`line`        |optional|
 The number of the line for which the comment was done. +
-If not set, it's a file comment.
+If range is set, this equals the end line of the range. +
+If neither line nor range is set, it's a file comment.
+|`range`       |optional|
+The range of the comment as a link:rest-api.html#comment-range[CommentRange]
+entity.
 |`in_reply_to` |optional|
 The URL encoded UUID of the comment to which this comment is a reply.
 |`message`     |optional|The comment message.
@@ -1910,7 +2817,7 @@
 The link:rest-api.html#timestamp[timestamp] of when this comment was
 written.
 |`author`      |optional|
-The author of the message as an +
+The author of the message as an
 link:rest-api-accounts.html#account-info[AccountInfo] entity. +
 Unset for draft comments, assumed to be the calling user.
 |===========================
@@ -1940,7 +2847,11 @@
 |`line`        |optional|
 The number of the line for which the comment should be added. +
 `0` if it is a file comment. +
-If not set, a file comment is added.
+If neither line nor range is set, a file comment is added. +
+If range is set, this should equal the end line of the range.
+|`range`       |optional|
+The range of the comment as a link:rest-api.html#comment-range[CommentRange]
+entity.
 |`in_reply_to` |optional|
 The URL encoded UUID of the comment to which this comment is a reply.
 |`updated`     |optional|
@@ -1952,6 +2863,20 @@
 comment is deleted.
 |===========================
 
+[[comment-range]]
+CommentRange
+~~~~~~~~~~~~
+The `CommentRange` entity describes the range of an inline comment.
+
+[options="header",width="50%",cols="1,^1,5"]
+|===========================
+|Field Name    ||Description
+|`start_line`        ||The start line number of the range.
+|`start_character`   ||The character position in the start line.
+|`end_line`          ||The end line number of the range.
+|`end_character`     ||The character position in the end line.
+|===========================
+
 [[commit-info]]
 CommitInfo
 ~~~~~~~~~~
@@ -1963,7 +2888,8 @@
 |`commit`      |The commit ID.
 |`parent`      |
 The parent commits of this commit as a list of
-link:#commit-info[CommitInfo] entities.
+link:#commit-info[CommitInfo] entities. In parent
+only `commit` and `subject` fields are populated.
 |`author`      |The author of the commit as a
 link:#git-person-info[GitPersonInfo] entity.
 |`committer`   |The committer of the commit as a
@@ -1973,17 +2899,94 @@
 |`message`     |The commit message.
 |==========================
 
+[[diff-content]]
+DiffContent
+~~~~~~~~~~~
+The `DiffContent` entity contains information about the content differences
+in a file.
+
+[options="header",width="50%",cols="1,^1,5"]
+|==========================
+|Field Name ||Description
+|`a`        |optional|Content only in the file on side A (deleted in B).
+|`b`        |optional|Content only in the file on side B (added in B).
+|`ab`       |optional|Content in the file on both sides (unchanged).
+|`edit_a`   |only present during a replace, i.e. both `a` and `b` are present|
+Text sections deleted from side A as a
+link:#diff-intraline-info[DiffIntralineInfo] entity.
+|`edit_b`   |only present during a replace, i.e. both `a` and `b` are present|
+Text sections inserted in side B as a
+link:#diff-intraline-info[DiffIntralineInfo] entity.
+|`skip`     |optional|count of lines skipped on both sides when the file is
+too large to include all common lines.
+|==========================
+
+[[diff-file-meta-info]]
+DiffFileMetaInfo
+~~~~~~~~~~~~~~~~
+The `DiffFileMetaInfo` entity contains meta information about a file diff.
+
+[options="header",width="50%",cols="1,6"]
+|==========================
+|Field Name    |Description
+|`name`        |The name of the file.
+|`content_type`|The content type of the file.
+|==========================
+
+[[diff-info]]
+DiffInfo
+~~~~~~~~
+The `DiffInfo` entity contains information about the diff of a file
+in a revision.
+
+[options="header",width="50%",cols="1,^1,5"]
+|==========================
+|Field Name        ||Description
+|`meta_a`          |not present when the file is added|
+Meta information about the file on side A as a
+link:#diff-file-meta-info[DiffFileMetaInfo] entity.
+|`meta_b`          |not present when the file is deleted|
+Meta information about the file on side B as a
+link:#diff-file-meta-info[DiffFileMetaInfo] entity.
+|`change_type`     ||The type of change (`ADDED`, `MODIFIED`, `DELETED`, `RENAMED`
+`COPIED`, `REWRITE`).
+|`intraline_status`|only set when the `intraline` parameter was specified in the request|
+Intraline status (`OK`, `ERROR`, `TIMEOUT`).
+|`diff_header`     ||A list of strings representing the patch set diff header.
+|`content`         ||The content differences in the file as a list of
+link:#diff-content[DiffContent] entities.
+|==========================
+
+[[diff-intraline-info]]
+DiffIntralineInfo
+~~~~~~~~~~~~~~~~~
+The `DiffIntralineInfo` entity contains information about intraline edits in a
+file.
+
+The information consists of a list of `<skip length, mark length>` pairs, where
+the skip length is the number of characters between the end of the previous edit
+and the start of this edit, and the mark length is the number of edited characters
+following the skip. The start of the edits is from the beginning of the related
+diff content lines.
+
+Note that the implied newline character at the end of each line is included in
+the length calculation, and thus it is possible for the edits to span newlines.
+
 [[fetch-info]]
 FetchInfo
 ~~~~~~~~~
 The `FetchInfo` entity contains information about how to fetch a patch
 set via a certain protocol.
 
-[options="header",width="50%",cols="1,6"]
+[options="header",width="50%",cols="1,^1,5"]
 |==========================
-|Field Name    |Description
-|`url`         |The URL of the project.
-|`ref`         |The ref of the patch set.
+|Field Name    ||Description
+|`url`         ||The URL of the project.
+|`ref`         ||The ref of the patch set.
+|`commands`    |optional|
+The download commands for this patch set as a map that maps the command
+names to the commands. +
+Only set if link:#download_commands[download commands] are requested.
 |==========================
 
 [[file-info]]
@@ -2030,40 +3033,62 @@
 [[label-info]]
 LabelInfo
 ~~~~~~~~~
-The `LabelInfo` entity contains information about a label on a change.
+The `LabelInfo` entity contains information about a label on a change, always
+corresponding to the current patch set.
 
+There are two options that control the contents of `LabelInfo`:
+link:#labels[`LABELS`] and link:#detailed-labels[`DETAILED_LABELS`].
+
+* For a quick summary of the state of labels, use `LABELS`.
+* For detailed information about labels, including exact numeric votes for all
+  users and the allowed range of votes for the current user, use `DETAILED_LABELS`.
+
+Common fields
+^^^^^^^^^^^^^
 [options="header",width="50%",cols="1,^1,5"]
 |===========================
 |Field Name    ||Description
-|`approved`    |optional|The user who approved this label on the change
-as a link:rest-api-accounts.html#account-info[AccountInfo] entity. +
-Only set if link:#labels[labels] are requested.
-|`rejected`    |optional|The user who rejected this label on the change
-as a link:rest-api-accounts.html#account-info[AccountInfo] entity. +
-Only set if link:#labels[labels] are requested.
-|`recommended` |optional|The user who recommended this label on the
-change as a link:rest-api-accounts.html#account-info[AccountInfo] entity. +
-Only set if link:#labels[labels] are requested.
-|`disliked`    |optional|The user who disliked this label on the change
-as a link:rest-api-accounts.html#account-info[AccountInfo] entity. +
-Only set if link:#labels[labels] are requested.
-|`value`       |optional|The voting value of the user who
-recommended/disliked this label on the change if it is not
-"`+1`"/"`-1`". +
-Only set if link:#labels[labels] are requested.
 |`optional`    |not set if `false`|
 Whether the label is optional. Optional means the label may be set, but
 it's neither necessary for submission nor does it block submission if
 set.
+|===========================
+
+Fields set by `LABELS`
+^^^^^^^^^^^^^^^^^^^^^^
+[options="header",width="50%",cols="1,^1,5"]
+|===========================
+|Field Name    ||Description
+|`approved`    |optional|One user who approved this label on the change
+(voted the maximum value) as an
+link:rest-api-accounts.html#account-info[AccountInfo] entity.
+|`rejected`    |optional|One user who rejected this label on the change
+(voted the minimum value) as an
+link:rest-api-accounts.html#account-info[AccountInfo] entity.
+|`recommended` |optional|One user who recommended this label on the
+change (voted positively, but not the maximum value) as an
+link:rest-api-accounts.html#account-info[AccountInfo] entity.
+|`disliked`    |optional|One user who disliked this label on the change
+(voted negatively, but not the minimum value) as an
+link:rest-api-accounts.html#account-info[AccountInfo] entity.
+|`value`       |optional|The voting value of the user who
+recommended/disliked this label on the change if it is not
+"`+1`"/"`-1`".
+|===========================
+
+Fields set by `DETAILED_LABELS`
+^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+[options="header",width="50%",cols="1,^1,5"]
+|===========================
+|Field Name    ||Description
 |`all`         |optional|List of all approvals for this label as a list
-of link:#approval-info[ApprovalInfo] entities. +
-Only set if link:#detailed-labels[detailed labels] are requested.
+of link:#approval-info[ApprovalInfo] entities.
 |`values`      |optional|A map of all values that are allowed for this
 label. The map maps the values ("`-2`", "`-1`", " `0`", "`+1`", "`+2`")
-to the value descriptions. +
-Only set if link:#detailed-labels[detailed labels] are requested.
+to the value descriptions.
 |===========================
 
+
 [[restore-input]]
 RestoreInput
 ~~~~~~~~~~~~
@@ -2138,6 +3163,10 @@
 after the review is stored. +
 Allowed values are `NONE`, `OWNER`, `OWNER_REVIEWERS` and `ALL`. +
 If not set, the default is `ALL`.
+|`on_behalf_of`|optional|
+link:rest-api-accounts.html#account-id[\{account-id\}] the review
+should be posted on behalf of. To use this option the caller must
+have been granted `labelAs-NAME` permission for all keys of labels.
 |============================
 
 [[reviewer-info]]
@@ -2191,16 +3220,23 @@
 |===========================
 |Field Name    ||Description
 |`draft`       |not set if `false`|Whether the patch set is a draft.
+|`has_draft_comments`       |not set if `false`|Whether the patch
+set has one or more draft comments by the calling user. Only set if
+link:#draft_comments[draft comments] is requested.
 |`_number`     ||The patch set number.
 |`fetch`       ||
 Information about how to fetch this patch set. The fetch information is
 provided as a map that maps the protocol name ("`git`", "`http`",
 "`ssh`") to link:#fetch-info[FetchInfo] entities.
-|`commit`      ||The commit of the patch set as
+|`commit`      |optional|The commit of the patch set as
 link:#commit-info[CommitInfo] entity.
-|`files`       ||
+|`files`       |optional|
 The files of the patch set as a map that maps the file names to
 link:#file-info[FileInfo] entities.
+|`actions`     |optional|
+Actions the caller might be able to perform on this revision. The
+information is a map of view name to link:#action-info[ActionInfo]
+entities.
 |===========================
 
 [[rule-input]]
@@ -2221,6 +3257,17 @@
 to return results from the input rule.
 |===========================
 
+[[suggested-reviewer-info]]
+SuggestedReviewerInfo
+~~~~~~~~~~~~~~~~~~~~~
+The `SuggestedReviewerInfo` entity contains information about a reviewer
+that can be added to a change (an account or a group).
+
+`SuggestedReviewerInfo` has either the `account` field that contains
+the link:rest-api-accounts.html#account-info[AccountInfo] entity, or
+the `group` field that contains the
+link:rest-api-changes.html#group-base-info[GroupBaseInfo] entity.
+
 [[submit-info]]
 SubmitInfo
 ~~~~~~~~~~
@@ -2304,6 +3351,22 @@
 topic.
 |===========================
 
+[[included-in-info]]
+IncludedInInfo
+~~~~~~~~~~~~~~
+The `IncludedInInfo` entity contains information about the branches a
+change was merged into and tags it was tagged with.
+
+[options="header",width="50%",cols="1,6"]
+|==========================
+|Field Name |Description
+|`kind`     |`gerritcodereview#includedininfo`
+|`branches` | The list of branches this change was merged into.
+Each branch is listed without the 'refs/head/' prefix.
+|`tags`     | The list of tags this change was tagged with.
+Each tag is listed without the 'refs/tags/' prefix.
+|==========================
+
 
 GERRIT
 ------
diff --git a/Documentation/rest-api-config.txt b/Documentation/rest-api-config.txt
new file mode 100644
index 0000000..5bd5e0c
--- /dev/null
+++ b/Documentation/rest-api-config.txt
@@ -0,0 +1,222 @@
+Gerrit Code Review - /config/ REST API
+======================================
+
+This page describes the config related REST endpoints.
+Please also take note of the general information on the
+link:rest-api.html[REST API].
+
+[[config-endpoints]]
+Config Endpoints
+---------------
+
+[[get-version]]
+Get Version
+~~~~~~~~~~~
+[verse]
+'GET /config/server/version'
+
+Returns the version of the Gerrit server.
+
+.Request
+----
+  GET /config/server/version HTTP/1.0
+----
+
+.Response
+----
+  HTTP/1.1 200 OK
+  Content-Type: application/json;charset=UTF-8
+
+  )]}'
+  "2.7"
+----
+
+[[list-capabilities]]
+List Capabilities
+~~~~~~~~~~~~~~~~~
+[verse]
+'GET /config/server/capabilities'
+
+Lists the capabilities that are available in the system. There are two
+kinds of capabilities: core and plugin-owned capabilities.
+
+As result a map of link:#capability-info[CapabilityInfo] entities is
+returned.
+
+The entries in the map are sorted by capability ID.
+
+.Request
+----
+  GET /config/server/capabilities/ HTTP/1.0
+----
+
+.Response
+----
+  HTTP/1.1 200 OK
+  Content-Type: application/json;charset=UTF-8
+
+  )]}'
+  {
+    "accessDatabase": {
+      "kind": "gerritcodereview#capability",
+      "id": "accessDatabase",
+      "name": "Access Database"
+    },
+    "administrateServer": {
+      "kind": "gerritcodereview#capability",
+      "id": "administrateServer",
+      "name": "Administrate Server"
+    },
+    "createAccount": {
+      "kind": "gerritcodereview#capability",
+      "id": "createAccount",
+      "name": "Create Account"
+    },
+    "createGroup": {
+      "kind": "gerritcodereview#capability",
+      "id": "createGroup",
+      "name": "Create Group"
+    },
+    "createProject": {
+      "kind": "gerritcodereview#capability",
+      "id": "createProject",
+      "name": "Create Project"
+    },
+    "emailReviewers": {
+      "kind": "gerritcodereview#capability",
+      "id": "emailReviewers",
+      "name": "Email Reviewers"
+    },
+    "flushCaches": {
+      "kind": "gerritcodereview#capability",
+      "id": "flushCaches",
+      "name": "Flush Caches"
+    },
+    "killTask": {
+      "kind": "gerritcodereview#capability",
+      "id": "killTask",
+      "name": "Kill Task"
+    },
+    "priority": {
+      "kind": "gerritcodereview#capability",
+      "id": "priority",
+      "name": "Priority"
+    },
+    "queryLimit": {
+      "kind": "gerritcodereview#capability",
+      "id": "queryLimit",
+      "name": "Query Limit"
+    },
+    "runGC": {
+      "kind": "gerritcodereview#capability",
+      "id": "runGC",
+      "name": "Run Garbage Collection"
+    },
+    "streamEvents": {
+      "kind": "gerritcodereview#capability",
+      "id": "streamEvents",
+      "name": "Stream Events"
+    },
+    "viewCaches": {
+      "kind": "gerritcodereview#capability",
+      "id": "viewCaches",
+      "name": "View Caches"
+    },
+    "viewConnections": {
+      "kind": "gerritcodereview#capability",
+      "id": "viewConnections",
+      "name": "View Connections"
+    },
+    "viewQueue": {
+      "kind": "gerritcodereview#capability",
+      "id": "viewQueue",
+      "name": "View Queue"
+    }
+  }
+----
+
+[[get-top-menus]]
+Get Top Menus
+~~~~~~~~~~~~~
+[verse]
+'GET /config/server/top-menus'
+
+Returns the list of additional top menu entries.
+
+.Request
+----
+  GET /config/server/top-menus HTTP/1.0
+----
+
+As response a list of the additional top menu entries as
+link:#top-menu-entry-info[TopMenuEntryInfo] entities is returned.
+
+.Response
+----
+  HTTP/1.1 200 OK
+  Content-Type: application/json;charset=UTF-8
+
+  )]}'
+  [
+    {
+      "name": "Top Menu Entry",
+      "items": [
+        {
+          "url": "http://gerrit.googlecode.com/",
+          "name": "Gerrit",
+          "target": "_blank"
+        }
+      ]
+    }
+  ]
+----
+
+
+[[json-entities]]
+JSON Entities
+-------------
+
+[[capability-info]]
+CapabilityInfo
+~~~~~~~~~~~~~~
+The `CapabilityInfo` entity contains information about a capability.
+
+[options="header",width="50%",cols="1,6"]
+|=================================
+|Field Name           |Description
+|`kind`               |`gerritcodereview#capability`
+|`id`                 |capability ID
+|`name`               |capability name
+|=================================
+
+[[top-menu-entry-info]]
+TopMenuEntryInfo
+~~~~~~~~~~~~~~~~
+The `TopMenuEntryInfo` entity contains information about a top menu
+entry.
+
+[options="header",width="50%",cols="1,6"]
+|=================================
+|Field Name           |Description
+|`name`               |Name of the top menu entry.
+|`items`              |List of link:#top-menu-item-info[menu items].
+|=================================
+
+[[top-menu-item-info]]
+TopMenuItemInfo
+~~~~~~~~~~~~~~~
+The `TopMenuItemInfo` entity contains information about a menu item in
+a top menu entry.
+
+[options="header",width="50%",cols="1,^1,5"]
+|========================
+|Field Name ||Description
+|`url`      ||The URL of the menu item link.
+|`name`     ||The name of the menu item.
+|`target`   ||Target attribute of the menu item link.
+|`id`       |optional|The `id` attribute of the menu item link.
+|========================
+
+GERRIT
+------
+Part of link:index.html[Gerrit Code Review]
diff --git a/Documentation/rest-api-groups.txt b/Documentation/rest-api-groups.txt
index e800d56..6289e5a 100644
--- a/Documentation/rest-api-groups.txt
+++ b/Documentation/rest-api-groups.txt
@@ -293,12 +293,14 @@
       {
         "_account_id": 1000097,
         "name": "Jane Roe",
-        "email": "jane.roe@example.com"
+        "email": "jane.roe@example.com",
+        "username": "jane"
       },
       {
         "_account_id": 1000096,
         "name": "John Doe",
         "email": "john.doe@example.com"
+        "username": "john"
       }
     ],
     "includes": []
@@ -620,12 +622,14 @@
     {
       "_account_id": 1000097,
       "name": "Jane Roe",
-      "email": "jane.roe@example.com"
+      "email": "jane.roe@example.com",
+      "username": "jane"
     },
     {
       "_account_id": 1000096,
       "name": "John Doe",
-      "email": "john.doe@example.com"
+      "email": "john.doe@example.com",
+      "username": "john"
     }
   ]
 ----
@@ -657,17 +661,20 @@
     {
       "_account_id": 1000097,
       "name": "Jane Roe",
-      "email": "jane.roe@example.com"
+      "email": "jane.roe@example.com",
+      "username": "jane"
     },
     {
       "_account_id": 1000096,
       "name": "John Doe",
-      "email": "john.doe@example.com"
+      "email": "john.doe@example.com",
+      "username": "john"
     },
     {
       "_account_id": 1000098,
       "name": "Richard Roe",
-      "email": "richard.roe@example.com"
+      "email": "richard.roe@example.com",
+      "username": "rroe"
     }
   ]
 ----
@@ -698,7 +705,8 @@
   {
     "_account_id": 1000096,
     "name": "John Doe",
-    "email": "john.doe@example.com"
+    "email": "john.doe@example.com",
+    "username": "john"
   }
 ----
 
@@ -728,7 +736,8 @@
   {
     "_account_id": 1000037,
     "name": "John Doe",
-    "email": "john.doe@example.com"
+    "email": "john.doe@example.com",
+    "username": "john"
   }
 ----
 
@@ -756,10 +765,10 @@
   Content-Type: application/json;charset=UTF-8
 
   {
-    "members": {
+    "members": [
       "jane.roe@example.com",
       "john.doe@example.com"
-    }
+    ]
   }
 ----
 
@@ -782,12 +791,14 @@
     {
       "_account_id": 1000057,
       "name": "Jane Roe",
-      "email": "jane.roe@example.com"
+      "email": "jane.roe@example.com",
+      "username": "jane"
     },
     {
       "_account_id": 1000037,
       "name": "John Doe",
-      "email": "john.doe@example.com"
+      "email": "john.doe@example.com",
+      "username": "john"
     }
   ]
 ----
@@ -827,10 +838,10 @@
   Content-Type: application/json;charset=UTF-8
 
   {
-    "members": {
+    "members": [
       "jane.roe@example.com",
       "john.doe@example.com"
-    }
+    ]
   }
 ----
 
@@ -923,7 +934,8 @@
 [verse]
 'PUT /groups/link:#group-id[\{group-id\}]/groups/link:#group-id[\{group-id\}]'
 
-Includes a group into a Gerrit internal group.
+Includes an internal or external group into a Gerrit internal group.
+External groups must be specified using the UUID.
 
 .Request
 ----
diff --git a/Documentation/rest-api-plugins.txt b/Documentation/rest-api-plugins.txt
new file mode 100644
index 0000000..2cc80f0
--- /dev/null
+++ b/Documentation/rest-api-plugins.txt
@@ -0,0 +1,279 @@
+Gerrit Code Review - /plugins/ REST API
+=======================================
+
+This page describes the plugin related REST endpoints.
+Please also take note of the general information on the
+link:rest-api.html[REST API].
+
+[[plugin-endpoints]]
+Plugin Endpoints
+----------------
+
+Gerrit REST endpoints for installed plugins are available under
+'/plugins/link:#plugin-id[\{plugin-id\}]/gerrit~<endpoint-id>'.
+The `gerrit~` prefix ensures that the Gerrit REST endpoints for plugins
+do not clash with any REST endpoint that a plugin may offer under its
+namespace.
+
+
+[[list-plugins]]
+List Plugins
+~~~~~~~~~~~~
+[verse]
+'GET /plugins/'
+
+Lists the plugins installed on the Gerrit server. Only the enabled
+plugins are returned unless the `all` option is specified.
+
+As result a map is returned that maps the plugin IDs to
+link:#plugin-info[PluginInfo] entries. The entries in the map are sorted
+by plugin ID.
+
+.Request
+----
+  GET /plugins/?all HTTP/1.0
+----
+
+.Response
+----
+  HTTP/1.1 200 OK
+  Content-Disposition: attachment
+  Content-Type: application/json;charset=UTF-8
+
+  )]}'
+  {
+    "delete-project": {
+      "kind": "gerritcodereview#plugin",
+      "id": "delete-project",
+      "version": "2.8-SNAPSHOT"
+    },
+    "reviewers-by-blame": {
+      "kind": "gerritcodereview#plugin",
+      "id": "reviewers-by-blame",
+      "version": "2.8-SNAPSHOT",
+      "disabled": true
+    }
+  }
+----
+
+[[install-plugin]]
+Install Plugin
+~~~~~~~~~~~~~~
+[verse]
+'PUT /plugins/link:#plugin-id[\{plugin-id\}]'
+
+Installs a new plugin on the Gerrit server. If a plugin with the
+specified name already exists it is overwritten. Note: if the plugin
+provides its own name in the MANIFEST file, then the plugin name from
+the MANIFEST file has precedence over the \{plugin-id\} above.
+
+The plugin jar can either be sent as binary data in the request body
+or a URL to the plugin jar must be provided in the request body inside
+a link:#plugin-input[PluginInput] entity.
+
+.Request
+----
+  PUT /plugins/delete-project HTTP/1.0
+  Content-Type: application/json;charset=UTF-8
+
+  {
+    "url": "file:///gerrit/plugins/delete-project/delete-project-2.8.jar"
+  }
+----
+
+To provide the plugin jar as binary data in the request body the
+following curl command can be used:
+
+----
+  curl --digest --user admin:TNNuLkWsIV8w -X PUT --data-binary @delete-project-2.8.jar 'http://gerrit:8080/a/plugins/delete-project'
+----
+
+As response a link:#plugin-info[PluginInfo] entity is returned that
+describes the plugin.
+
+.Response
+----
+  HTTP/1.1 201 Created
+  Content-Disposition: attachment
+  Content-Type: application/json;charset=UTF-8
+
+  )]}'
+  {
+    "kind": "gerritcodereview#plugin",
+    "id": "delete-project",
+    "version": "2.8"
+  }
+----
+
+If an existing plugin was overwritten the response is "`200 OK`".
+
+[[get-plugin-status]]
+Get Plugin Status
+~~~~~~~~~~~~~~~~~
+[verse]
+'GET /plugins/link:#plugin-id[\{plugin-id\}]/gerrit~status'
+
+Retrieves the status of a plugin on the Gerrit server.
+
+.Request
+----
+  GET /plugins/delete-project/gerrit~status HTTP/1.0
+----
+
+As response a link:#plugin-info[PluginInfo] entity is returned that
+describes the plugin.
+
+.Response
+----
+  HTTP/1.1 200 OK
+  Content-Disposition: attachment
+  Content-Type: application/json;charset=UTF-8
+
+  )]}'
+  {
+    "kind": "gerritcodereview#plugin",
+    "id": "delete-project",
+    "version": "2.8"
+  }
+----
+
+[[enable-plugin]]
+Enable Plugin
+~~~~~~~~~~~~~
+[verse]
+'POST /plugins/link:#plugin-id[\{plugin-id\}]/gerrit~enable'
+
+Enables a plugin on the Gerrit server.
+
+.Request
+----
+  POST /plugins/delete-project/gerrit~enable HTTP/1.0
+----
+
+As response a link:#plugin-info[PluginInfo] entity is returned that
+describes the plugin.
+
+.Response
+----
+  HTTP/1.1 200 OK
+  Content-Disposition: attachment
+  Content-Type: application/json;charset=UTF-8
+
+  )]}'
+  {
+    "kind": "gerritcodereview#plugin",
+    "id": "delete-project",
+    "version": "2.8"
+  }
+----
+
+[[disable-plugin]]
+Disable Plugin
+~~~~~~~~~~~~~~
+[verse]
+'POST /plugins/link:#plugin-id[\{plugin-id\}]/gerrit~disable'
+
+OR
+
+[verse]
+'DELETE /plugins/link:#plugin-id[\{plugin-id\}]'
+
+Disables a plugin on the Gerrit server.
+
+.Request
+----
+  POST /plugins/delete-project/gerrit~disable HTTP/1.0
+----
+
+As response a link:#plugin-info[PluginInfo] entity is returned that
+describes the plugin.
+
+.Response
+----
+  HTTP/1.1 200 OK
+  Content-Disposition: attachment
+  Content-Type: application/json;charset=UTF-8
+
+  )]}'
+  {
+    "kind": "gerritcodereview#plugin",
+    "id": "delete-project",
+    "version": "2.8",
+    "disabled": true
+  }
+----
+
+[[reload-plugin]]
+Reload Plugin
+~~~~~~~~~~~~~
+[verse]
+'POST /plugins/link:#plugin-id[\{plugin-id\}]/gerrit~reload'
+
+Reloads a plugin on the Gerrit server.
+
+.Request
+----
+  POST /plugins/delete-project/gerrit~reload HTTP/1.0
+----
+
+As response a link:#plugin-info[PluginInfo] entity is returned that
+describes the plugin.
+
+.Response
+----
+  HTTP/1.1 200 OK
+  Content-Disposition: attachment
+  Content-Type: application/json;charset=UTF-8
+
+  )]}'
+  {
+    "kind": "gerritcodereview#plugin",
+    "id": "delete-project",
+    "version": "2.8",
+    "disabled": true
+  }
+----
+
+
+[[ids]]
+IDs
+---
+
+[[plugin-id]]
+\{plugin-id\}
+~~~~~~~~~~~~~
+The ID of the plugin.
+
+[[json-entities]]
+JSON Entities
+-------------
+
+[[plugin-info]]
+PluginInfo
+~~~~~~~~~~
+The `PluginInfo` entity describes a plugin.
+
+[options="header",width="50%",cols="1,^2,4"]
+|=======================
+|Field Name||Description
+|`kind`    ||`gerritcodereview#plugin`
+|`id`      ||The ID of the plugin.
+|`version` ||The version of the plugin.
+|`disabled`|not set if `false`|Whether the plugin is disabled.
+|=======================
+
+[[plugin-input]]
+PluginInput
+~~~~~~~~~~~
+The `PluginInput` entity describes a plugin that should be installed.
+
+[options="header",width="50%",cols="1,6"]
+|======================
+|Field Name|Description
+|`url`     |URL to the plugin jar.
+|======================
+
+
+GERRIT
+------
+Part of link:index.html[Gerrit Code Review]
diff --git a/Documentation/rest-api-projects.txt b/Documentation/rest-api-projects.txt
index 35caac4..35db183 100644
--- a/Documentation/rest-api-projects.txt
+++ b/Documentation/rest-api-projects.txt
@@ -5,9 +5,6 @@
 Please also take note of the general information on the
 link:rest-api.html[REST API].
 
-Endpoints
----------
-
 [[project-endpoints]]
 Project Endpoints
 -----------------
@@ -436,6 +433,7 @@
   )]}'
   {
     "kind": "gerritcodereview#project_config",
+    "description": "demo project",
     "use_contributor_agreements": {
       "value": true,
       "configured_value": "TRUE",
@@ -455,7 +453,93 @@
       "value": false,
       "configured_value": "FALSE",
       "inherited_value": true
+    },
+    "max_object_size_limit": {
+      "value": "15m",
+      "configured_value": "15m",
+      "inherited_value": "20m"
+    },
+    "submit_type": "MERGE_IF_NECESSARY",
+    "state": "ACTIVE",
+    "commentlinks": {},
+    "actions": {
+      "cookbook~hello-project": {
+        "method": "POST",
+        "label": "Say hello",
+        "title": "Say hello in different languages",
+        "enabled": true
+      }
     }
+  }
+----
+
+[[set-config]]
+Set Config
+~~~~~~~~~~
+[verse]
+'PUT /projects/link:#project-name[\{project-name\}]/config'
+
+Sets the configuration of a project.
+
+The new configuration must be provided in the request body as a
+link:#config-input[ConfigInput] entity.
+
+.Request
+----
+  PUT /projects/myproject/config HTTP/1.0
+  Content-Type: application/json;charset=UTF-8
+
+  {
+    "description": "demo project",
+    "use_contributor_agreements": "FALSE",
+    "use_content_merge": "INHERIT",
+    "use_signed_off_by": "INHERIT",
+    "require_change_id": "TRUE",
+    "max_object_size_limit": "10m",
+    "submit_type": "REBASE_IF_NECESSARY",
+    "state": "ACTIVE"
+  }
+----
+
+As response the new configuration is returned as a link:#config-info[
+ConfigInfo] entity.
+
+.Response
+----
+  HTTP/1.1 200 OK
+  Content-Disposition: attachment
+  Content-Type: application/json;charset=UTF-8
+
+  )]}'
+  {
+    "kind": "gerritcodereview#project_config",
+    "use_contributor_agreements": {
+      "value": false,
+      "configured_value": "FALSE",
+      "inherited_value": false
+    },
+    "use_content_merge": {
+      "value": true,
+      "configured_value": "INHERIT",
+      "inherited_value": true
+    },
+    "use_signed_off_by": {
+      "value": false,
+      "configured_value": "INHERIT",
+      "inherited_value": false
+    },
+    "require_change_id": {
+      "value": true,
+      "configured_value": "TRUE",
+      "inherited_value": true
+    },
+    "max_object_size_limit": {
+      "value": "10m",
+      "configured_value": "10m",
+      "inherited_value": "20m"
+    },
+    "submit_type": "REBASE_IF_NECESSARY",
+    "state": "ACTIVE",
     "commentlinks": {}
   }
 ----
@@ -499,6 +583,281 @@
   done.
 ----
 
+[[branch-endpoints]]
+Branch Endpoints
+----------------
+
+[[list-branches]]
+List Branches
+~~~~~~~~~~~~~
+[verse]
+'GET /projects/link:#project-name[\{project-name\}]/branches/'
+
+List the branches of a project.
+
+As result a list of link:#branch-info[BranchInfo] entries is
+returned.
+
+.Request
+----
+  GET /projects/work%2Fmy-project/branches/ HTTP/1.0
+----
+
+.Response
+----
+  HTTP/1.1 200 OK
+  Content-Disposition: attachment
+  Content-Type: application/json;charset=UTF-8
+
+  )]}'
+  [
+    {
+      "ref": "HEAD",
+      "revision": "master"
+    },
+    {
+      "ref": "refs/meta/config",
+      "revision": "76016386a0d8ecc7b6be212424978bb45959d668"
+    },
+    {
+      "ref": "refs/heads/master",
+      "revision": "67ebf73496383c6777035e374d2d664009e2aa5c"
+    },
+    {
+      "ref": "refs/heads/stable",
+      "revision": "64ca533bd0eb5252d2fee83f63da67caae9b4674",
+      "can_delete": true
+    }
+  ]
+----
+
+[[get-branch]]
+Get Branch
+~~~~~~~~~~
+[verse]
+'GET /projects/link:#project-name[\{project-name\}]/branches/link:#branch-id[\{branch-id\}]'
+
+Retrieves a branch of a project.
+
+.Request
+----
+  GET /projects/work%2Fmy-project/branches/master HTTP/1.0
+----
+
+As response a link:#branch-info[BranchInfo] entity is returned that
+describes the branch.
+
+.Response
+----
+  HTTP/1.1 200 OK
+  Content-Disposition: attachment
+  Content-Type: application/json;charset=UTF-8
+
+  )]}'
+  {
+    "ref": "refs/heads/master",
+    "revision": "67ebf73496383c6777035e374d2d664009e2aa5c"
+  }
+----
+
+[[create-branch]]
+Create Branch
+~~~~~~~~~~~~~
+[verse]
+'PUT /projects/link:#project-name[\{project-name\}]/branches/link:#branch-id[\{branch-id\}]'
+
+Creates a new branch.
+
+In the request body additional data for the branch can be provided as
+link:#branch-input[BranchInput].
+
+.Request
+----
+  PUT /projects/MyProject/branches/stable HTTP/1.0
+  Content-Type: application/json;charset=UTF-8
+
+  {
+    "revision": "76016386a0d8ecc7b6be212424978bb45959d668"
+  }
+----
+
+As response a link:#branch-info[BranchInfo] entity is returned that
+describes the created branch.
+
+.Response
+----
+  HTTP/1.1 201 Created
+  Content-Disposition: attachment
+  Content-Type: application/json;charset=UTF-8
+
+  )]}'
+  {
+    "ref": "refs/heads/stable",
+    "revision": "76016386a0d8ecc7b6be212424978bb45959d668",
+    "can_delete": true
+  }
+----
+
+[[delete-branch]]
+Delete Branch
+~~~~~~~~~~~~~
+[verse]
+'DELETE /projects/link:#project-name[\{project-name\}]/branches/link:#branch-id[\{branch-id\}]'
+
+Deletes a branch.
+
+.Request
+----
+  DELETE /projects/MyProject/branches/stable HTTP/1.0
+----
+
+.Response
+----
+  HTTP/1.1 204 No Content
+----
+
+[[child-project-endpoints]]
+Child Project Endpoints
+-----------------------
+
+[[list-child-projects]]
+List Child Projects
+~~~~~~~~~~~~~~~~~~~
+[verse]
+'GET /projects/link:#project-name[\{project-name\}]/children/'
+
+List the direct child projects of a project.
+
+.Request
+----
+  GET /projects/Public-Plugins/children/ HTTP/1.0
+----
+
+As result a list of link:#project-info[ProjectInfo] entries is
+returned that describe the child projects.
+
+.Response
+----
+  HTTP/1.1 200 OK
+  Content-Disposition: attachment
+  Content-Type: application/json;charset=UTF-8
+
+  )]}'
+  [
+    {
+      "kind": "gerritcodereview#project",
+      "id": "plugins%2Freplication",
+      "name": "plugins/replication",
+      "parent": "Public-Plugins",
+      "description": "Copies to other servers using the Git protocol"
+    },
+    {
+      "kind": "gerritcodereview#project",
+      "id": "plugins%2Freviewnotes",
+      "name": "plugins/reviewnotes",
+      "parent": "Public-Plugins",
+      "description": "Annotates merged commits using notes on refs/notes/review."
+    },
+    {
+      "kind": "gerritcodereview#project",
+      "id": "plugins%2Fsingleusergroup",
+      "name": "plugins/singleusergroup",
+      "parent": "Public-Plugins",
+      "description": "GroupBackend enabling users to be directly added to access rules"
+    }
+  ]
+----
+
+To resolve the child projects of a project recursively the parameter
+`recursive` can be set.
+
+Child projects that are not visible to the calling user are ignored and
+are not resolved further.
+
+.Request
+----
+  GET /projects/Public-Projects/children/?recursive HTTP/1.0
+----
+
+.Response
+----
+  HTTP/1.1 200 OK
+  Content-Disposition: attachment
+  Content-Type: application/json;charset=UTF-8
+
+  )]}'
+  [
+    {
+      "kind": "gerritcodereview#project",
+      "id": "gerrit",
+      "name": "gerrit",
+      "parent": "Public-Projects",
+      "description": "Gerrit Code Review"
+    },
+    {
+      "kind": "gerritcodereview#project",
+      "id": "plugins%2Freplication",
+      "name": "plugins/replication",
+      "parent": "Public-Plugins",
+      "description": "Copies to other servers using the Git protocol"
+    },
+    {
+      "kind": "gerritcodereview#project",
+      "id": "plugins%2Freviewnotes",
+      "name": "plugins/reviewnotes",
+      "parent": "Public-Plugins",
+      "description": "Annotates merged commits using notes on refs/notes/review."
+    },
+    {
+      "kind": "gerritcodereview#project",
+      "id": "plugins%2Fsingleusergroup",
+      "name": "plugins/singleusergroup",
+      "parent": "Public-Plugins",
+      "description": "GroupBackend enabling users to be directly added to access rules"
+    },
+    {
+      "kind": "gerritcodereview#project",
+      "id": "Public-Plugins",
+      "name": "Public-Plugins",
+      "parent": "Public-Projects",
+      "description": "Parent project for plugins/*"
+    }
+  ]
+----
+
+[[get-child-project]]
+Get Child Project
+~~~~~~~~~~~~~~~~~
+[verse]
+'GET /projects/link:#project-name[\{project-name\}]/children/link:#project-name[\{project-name\}]'
+
+Retrieves a child project. If a non-direct child project should be
+retrieved the parameter `recursive` must be set.
+
+.Request
+----
+  GET /projects/Public-Plugins/children/plugins%2Freplication HTTP/1.0
+----
+
+As response a link:#project-info[ProjectInfo] entity is returned that
+describes the child project.
+
+.Response
+----
+  HTTP/1.1 200 OK
+  Content-Disposition: attachment
+  Content-Type: application/json;charset=UTF-8
+
+  )]}'
+  {
+    "kind": "gerritcodereview#project",
+    "id": "plugins%2Freplication",
+    "name": "plugins/replication",
+    "parent": "Public-Plugins",
+    "description": "Copies to other servers using the Git protocol"
+  }
+----
+
 [[dashboard-endpoints]]
 Dashboard Endpoints
 -------------------
@@ -727,6 +1086,12 @@
 IDs
 ---
 
+[[branch-id]]
+\{branch-id\}
+~~~~~~~~~~~~~
+The name of a branch or `HEAD`. The prefix `refs/heads/` can be
+omitted.
+
 [[dashboard-id]]
 \{dashboard-id\}
 ~~~~~~~~~~~~~~~~
@@ -745,42 +1110,144 @@
 JSON Entities
 -------------
 
+[[branch-info]]
+BranchInfo
+~~~~~~~~~~
+The `BranchInfo` entity contains information about a branch.
+
+[options="header",width="50%",cols="1,^2,4"]
+|=========================
+|Field Name  ||Description
+|`ref`       ||The ref of the branch.
+|`revision`  ||The revision to which the branch points.
+|`can_delete`|`false` if not set|
+Whether the calling user can delete this branch.
+|=========================
+
+[[branch-input]]
+BranchInput
+~~~~~~~~~~~
+The `BranchInput` entity contains information for the creation of
+a new branch.
+
+[options="header",width="50%",cols="1,^2,4"]
+|=======================
+|Field Name||Description
+|`ref`     |optional|
+The name of the branch. The prefix `refs/heads/` can be
+omitted. +
+If set, must match the branch ID in the URL.
+|`revision`|optional|
+The base revision of the new branch. +
+If not set, `HEAD` will be used as base revision.
+|=======================
+
 [[config-info]]
 ConfigInfo
 ~~~~~~~~~~
 The `ConfigInfo` entity contains information about the effective project
 configuration.
 
-Fields marked with * are only visible to users who have read access to
-`refs/meta/config`.
-
-[options="header",width="50%",cols="1,6"]
-|======================================
-|Field Name                   |Description
-|`use_contributor_agreements*`|
+[options="header",width="50%",cols="1,^2,4"]
+|=========================================
+|Field Name                  ||Description
+|`description`               |optional|
+The description of the project.
+|`use_contributor_agreements`|optional|
 link:#inherited-boolean-info[InheritedBooleanInfo] that tells whether
 authors must complete a contributor agreement on the site before
 pushing any commits or changes to this project.
-|`use_content_merge*`|
+|`use_content_merge`         |optional|
 link:#inherited-boolean-info[InheritedBooleanInfo] that tells whether
 Gerrit will try to perform a 3-way merge of text file content when a
 file has been modified by both the destination branch and the change
 being submitted. This option only takes effect if submit type is not
 FAST_FORWARD_ONLY.
-|`use_signed_off_by*`|
+|`use_signed_off_by`         |optional|
 link:#inherited-boolean-info[InheritedBooleanInfo] that tells whether
 each change must contain a Signed-off-by line from either the author or
 the uploader in the commit message.
-|`require_change_id*`|
+|`require_change_id`         |optional|
 link:#inherited-boolean-info[InheritedBooleanInfo] that tells whether a
 valid link:user-changeid.html[Change-Id] footer in any commit uploaded
 for review is required. This does not apply to commits pushed directly
 to a branch or tag.
-|`commentlinks`|
-Comment link configuration for the project. Has the same format as the
-link:config-gerrit.html#_a_id_commentlink_a_section_commentlink[commentlink section]
-of `gerrit.config`.
-|======================================
+|`max_object_size_limit`     ||
+The link:config-gerrit.html#receive.maxObjectSizeLimit[max object size
+limit] of this project as a link:#max-object-size-limit-info[
+MaxObjectSizeLimitInfo] entity.
+|`submit_type`               ||
+The default submit type of the project, can be `MERGE_IF_NECESSARY`,
+`FAST_FORWARD_ONLY`, `REBASE_IF_NECESSARY`, `MERGE_ALWAYS` or
+`CHERRY_PICK`.
+|`state`                     |optional|
+The state of the project, can be `ACTIVE`, `READ_ONLY` or `HIDDEN`. +
+Not set if the project state is `ACTIVE`.
+|`commentlinks`              ||
+Map with the comment link configurations of the project. The name of
+the comment link configuration is mapped to the comment link
+configuration, which has the same format as the
+link:config-gerrit.html#_a_id_commentlink_a_section_commentlink[
+commentlink section] of `gerrit.config`.
+|`theme`                     |optional|
+The theme that is configured for the project as a link:#theme-info[
+ThemeInfo] entity.
+|`actions`                   |optional|
+Actions the caller might be able to perform on this project. The
+information is a map of view names to
+link:rest-api-changes.html#action-info[ActionInfo] entities.
+|=========================================
+
+[[config-input]]
+ConfigInput
+~~~~~~~~~~~
+The `ConfigInput` entity describes a new project configuration.
+
+[options="header",width="50%",cols="1,^2,4"]
+|=========================================
+|Field Name                  ||Description
+|`description`               |optional|
+The new description of the project. +
+If not set, the description is removed.
+|`use_contributor_agreements`|optional|
+Whether authors must complete a contributor agreement on the site
+before pushing any commits or changes to this project. +
+Can be `TRUE`, `FALSE` or `INHERIT`. +
+If not set, this setting is not updated.
+|`use_content_merge`         |optional|
+Whether Gerrit will try to perform a 3-way merge of text file content
+when a file has been modified by both the destination branch and the
+change being submitted. This option only takes effect if submit type is
+not FAST_FORWARD_ONLY. +
+Can be `TRUE`, `FALSE` or `INHERIT`. +
+If not set, this setting is not updated.
+|`use_signed_off_by`         |optional|
+Whether each change must contain a Signed-off-by line from either the
+author or the uploader in the commit message. +
+Can be `TRUE`, `FALSE` or `INHERIT`. +
+If not set, this setting is not updated.
+|`require_change_id`         |optional|
+Whether a valid link:user-changeid.html[Change-Id] footer in any commit
+uploaded for review is required. This does not apply to commits pushed
+directly to a branch or tag. +
+Can be `TRUE`, `FALSE` or `INHERIT`. +
+If not set, this setting is not updated.
+|`max_object_size_limit`     |optional|
+The link:config-gerrit.html#receive.maxObjectSizeLimit[max object size
+limit] of this project as a link:#max-object-size-limit-info[
+MaxObjectSizeLimitInfo] entity. +
+If set to `0`, the max object size limit is removed. +
+If not set, this setting is not updated.
+|`submit_type`               |optional|
+The default submit type of the project, can be `MERGE_IF_NECESSARY`,
+`FAST_FORWARD_ONLY`, `REBASE_IF_NECESSARY`, `MERGE_ALWAYS` or
+`CHERRY_PICK`. +
+If not set, the submit type is not updated.
+|`state`                     |optional|
+The state of the project, can be `ACTIVE`, `READ_ONLY` or `HIDDEN`. +
+Not set if the project state is `ACTIVE`. +
+If not set, the project state is not updated.
+|=========================================
 
 [[dashboard-info]]
 DashboardInfo
@@ -881,6 +1348,29 @@
 Not set if there is no parent.
 |================================
 
+[[max-object-size-limit-info]]
+MaxObjectSizeLimitInfo
+~~~~~~~~~~~~~~~~~~~~~~
+The `MaxObjectSizeLimitInfo` entity contains information about the
+link:config-gerrit.html#receive.maxObjectSizeLimit[max object size
+limit] of a project.
+
+[options="header",width="50%",cols="1,^2,4"]
+|===============================
+|Field Name        ||Description
+|`value`           |optional|
+The effective value of the max object size limit as a formatted string. +
+Not set if there is no limit for the object size.
+|`configured_value`|optional|
+The max object size limit that is configured on the project as a
+formatted string. +
+Not set if there is no limit for the object size configured on project
+level.
+|`inherited_value` |optional|
+The max object size limit that is inherited as a formatted string. +
+Not set if there is no global limit for the object size.
+|===============================
+
 [[project-description-input]]
 ProjectDescriptionInput
 ~~~~~~~~~~~~~~~~~~~~~~~
@@ -967,6 +1457,9 @@
 |`require_change_id`         |`INHERIT` if not set|
 Whether the usage of Change-Ids is required for the project (`TRUE`,
 `FALSE`, `INHERIT`).
+|`max_object_size_limit`     |optional|
+Max allowed Git object size for this project.
+Common unit suffixes of 'k', 'm', or 'g' are supported.
 |=========================================
 
 [[project-parent-input]]
@@ -1002,6 +1495,22 @@
 |`size_of_packed_objects`  |Size of packed objects in bytes.
 |======================================
 
+[[theme-info]]
+ThemeInfo
+~~~~~~~~~
+The `ThemeInfo` entity describes a theme.
+
+[options="header",width="50%",cols="1,^2,4"]
+|=============================
+|Field Name      ||Description
+|`css`           |optional|
+The path to the `GerritSite.css` file.
+|`header`        |optional|
+The path to the `GerritSiteHeader.html` file.
+|`footer`        |optional|
+The path to the `GerritSiteFooter.html` file.
+|=============================
+
 
 GERRIT
 ------
diff --git a/Documentation/rest-api.txt b/Documentation/rest-api.txt
index 303fc4b..7eed6ef 100644
--- a/Documentation/rest-api.txt
+++ b/Documentation/rest-api.txt
@@ -5,14 +5,22 @@
 The API is suitable for automated tools to build upon, as well as
 supporting some ad-hoc scripting use cases.
 
+See also: link:dev-rest-api.html[REST API Developers' Notes].
+
 Endpoints
 ---------
+link:rest-api-access.html[/access/]::
+  Access Right related REST endpoints
 link:rest-api-accounts.html[/accounts/]::
   Account related REST endpoints
 link:rest-api-changes.html[/changes/]::
   Change related REST endpoints
+link:rest-api-config.html[/config/]::
+  Config related REST endpoints
 link:rest-api-groups.html[/groups/]::
   Group related REST endpoints
+link:rest-api-plugins.html[/plugins/]::
+  Plugin related REST endpoints
 link:rest-api-projects.html[/projects/]::
   Project related REST endpoints
 
@@ -53,9 +61,11 @@
 ----
 
 JSON responses are encoded using UTF-8 and use content type
-`application/json`. The JSON response body starts with a magic prefix
-line that must be stripped before feeding the rest of the response
-body to a JSON parser:
+`application/json`.
+
+To prevent against Cross Site Script Inclusion (XSSI) attacks, the JSON
+response body starts with a magic prefix line that must be stripped before
+feeding the rest of the response body to a JSON parser:
 
 ----
   )]}'
diff --git a/Documentation/user-changeid.txt b/Documentation/user-changeid.txt
index a4224bd..c13faa6 100644
--- a/Documentation/user-changeid.txt
+++ b/Documentation/user-changeid.txt
@@ -53,7 +53,7 @@
 
   $ scp -p -P 29418 john.doe@review.example.com:hooks/commit-msg .git/hooks/
 
-  $ curl -o .git/hooks/commit-msg http://review.example.com/tools/hooks/commit-msg
+  $ curl -Lo .git/hooks/commit-msg http://review.example.com/tools/hooks/commit-msg
 
 Then ensure that the execute bit is set on the hook script:
 
diff --git a/Documentation/user-dashboards.txt b/Documentation/user-dashboards.txt
index 3a12b76..0945153 100644
--- a/Documentation/user-dashboards.txt
+++ b/Documentation/user-dashboards.txt
@@ -44,7 +44,7 @@
 `&` or `;` or `,`
 
 The special `foreach=...` parameter is designed to facilitate
-more easily writting similar queries in a dashboard.  The value of the
+more easily writing similar queries in a dashboard.  The value of the
 foreach parameter will be used in every query in the dashboard by
 appending it to their ends with a space (ANDing it with the queries).
 
@@ -66,7 +66,7 @@
 will be used as name (equivalent to a title in a custom dashboard) for
 the dashboard.
 
-Example dashboard config file `MyProject Dashboard`:
+Example of a dashboard config file:
 
 ----
 [dashboard]
@@ -79,6 +79,8 @@
 
 Once defined, project dashboards are accessible using stable URLs by
 using the project name, refname and pathname of the dashboard via URLs
+, e.g. create a dashboard config file named `Main` and push it
+to `refs/meta/dashboards/Site` branch of All-Projects, then access it
 like:
 ----
   /#/projects/All-Projects,dashboards/Site:Main
diff --git a/Documentation/user-notify.txt b/Documentation/user-notify.txt
index 711d1ac..558dcb5 100644
--- a/Documentation/user-notify.txt
+++ b/Documentation/user-notify.txt
@@ -22,6 +22,14 @@
 change notifications to specific subsets, for example `branch:master`
 to only see changes proposed for the master branch.
 
+Notification mails for new changes and new patch sets are not sent to
+the change owner.
+
+Notification mails for comments added on changes are not sent to the user
+who added the comment unless the user has enabled the 'CC Me On Comments I
+Write' option in the user preferences.
+
+
 Project Level Settings
 ----------------------
 
diff --git a/Documentation/user-search.txt b/Documentation/user-search.txt
index 781118f..7c4ca52 100644
--- a/Documentation/user-search.txt
+++ b/Documentation/user-search.txt
@@ -168,6 +168,11 @@
 +
 Changes that match 'MESSAGE' arbitrary string in the commit message body.
 
+[[comment]]
+comment:'TEXT'::
++
+Changes that match 'TEXT' string in any comment left by a reviewer.
+
 [[file]]
 file:^'REGEX'::
 +
@@ -187,12 +192,6 @@
 ones using a bracket expression). For example, to match all XML
 files named like 'name1.xml', 'name2.xml', and 'name3.xml' use
 `file:"^name[1-3].xml"`.
-+
-Currently this operator is only available on a watched project
-and may not be used in the search bar. The same holds true for web UI
-"My > Watched Changes", i. e. file:regex is used over the is:watched
-expression. It never produces any results, because the error message:
-"operator not permitted here: file:regex" is suppressed.
 
 [[has]]
 has:draft::
@@ -278,7 +277,7 @@
 ----------------
 
 Operator values that are not bare words (roughly A-Z, a-z, 0-9, @,
-hypen, dot and underscore) must be quoted for the query parser.
+hyphen, dot and underscore) must be quoted for the query parser.
 
 Quoting is accepted as either double quotes
 (e.g.  `message:"the value"`) or as matched
@@ -291,8 +290,8 @@
 Unless otherwise specified, operators are joined using the `AND`
 boolean operator, thereby restricting the search results.
 
-Parentheses can be used to force a particular precendence on complex
-operator expressions, otherwise OR has higher precendence than AND.
+Parentheses can be used to force a particular precedence on complex
+operator expressions, otherwise OR has higher precedence than AND.
 
 Negation
 ~~~~~~~~
@@ -311,7 +310,7 @@
 OR
 ~~
 The boolean operator `OR` (in all caps) can be used to find changes
-that match either operator.  This increases the nubmer of results
+that match either operator.  This increases the number of results
 that are returned, as more changes are considered.
 
 
@@ -320,15 +319,18 @@
 ------
 Label operators can be used to match approval scores given during
 a code review.  The specific set of supported labels depends on
-the server configuration, however `Code-Review` and `Verified`
-are the default labels provided out of the box.
+the server configuration, however the `Code-Review` label is provided
+out of the box.
 
 A label name is any of the following:
 
 * The label name.  Example: `label:Code-Review`.
 
-* The one or two character abbreviation shown in the column header
-  of change list pages.  Example: `label:R` or `label:V`.
+* The label name followed by a ',' followed by a reviewer id or a
+  group id.  To make it clear whether a user or group is being looked
+  for, precede the value by a user or group argument identifier
+  ('user=' or 'group=').  If an LDAP group is being referenced make
+  sure to use 'ldap/<groupname>'.
 
 A label name must be followed by a score, or an operator and a score.
 The easiest way to explain this is by example.
@@ -356,7 +358,20 @@
 +
 Matches changes with either a +1, +2, or any higher score.
 
-`label:Code-Review<=-1`::
+`label:CodeReview=+2,aname`::
++
+Matches changes with a +2 code review where the reviewer or group is aname.
+
+`label:CodeReview=2,user=jsmith`::
++
+Matches changes with a +2 code review where the reviewer is jsmith.
+
+`label:CodeReview=+1,group=ldap/linux.workflow`::
++
+Matches changes with a +1 code review where the reviewer is in the
+ldap/linux.workflow group.
+
+`label:CodeReview<=-1`::
 +
 Matches changes with either a -1, -2, or any lower score.
 
diff --git a/Documentation/user-signedoffby.txt b/Documentation/user-signedoffby.txt
index d07516a..56858bf 100644
--- a/Documentation/user-signedoffby.txt
+++ b/Documentation/user-signedoffby.txt
@@ -104,10 +104,10 @@
 mergers will sometimes manually convert an acker's "yep, looks good to me"
 into an Acked-by:.
 
-Acked-by: does not necessarily indicate acknowledgement of the entire patch.
+Acked-by: does not necessarily indicate acknowledgment of the entire patch.
 For example, if a patch affects multiple subsystems and has an Acked-by: from
-one subsystem maintainer then this usually indicates acknowledgement of just
-the part which affects that maintainer's code.  Judgement should be used here.
+one subsystem maintainer then this usually indicates acknowledgment of just
+the part which affects that maintainer's code.  Judgment should be used here.
 When in doubt people should refer to the original discussion in the mailing
 list archives.
 
diff --git a/ReleaseNotes/ReleaseNotes-2.8.txt b/ReleaseNotes/ReleaseNotes-2.8.txt
new file mode 100644
index 0000000..d183cca
--- /dev/null
+++ b/ReleaseNotes/ReleaseNotes-2.8.txt
@@ -0,0 +1,756 @@
+Release notes for Gerrit 2.8
+============================
+
+
+Gerrit 2.8 is now available:
+
+link:https://gerrit-releases.storage.googleapis.com/gerrit-2.8-rc0.war[
+https://gerrit-releases.storage.googleapis.com/gerrit-2.8-rc0.war]
+
+
+Schema Change
+-------------
+
+
+*WARNING:* This release contains schema changes.  To upgrade:
+----
+  java -jar gerrit.war init -d site_path
+----
+
+*WARNING:* Upgrading to 2.8.x requires the server be first upgraded to 2.1.7 (or
+a later 2.1.x version), and then to 2.8.x.  If you are upgrading from 2.2.x.x or
+later, you may ignore this warning and upgrade directly to 2.8.x.
+
+*WARNING:* The replication plugin now automatically creates missing repositories
+on the destination if during the replication of a ref the target repository is
+found to be missing. This is a change in behavior of the replication plugin. To go
+back to the old behavior, set the parameter `remote.NAME.createMissingRepositories`
+in the `replication.config` file to `false`.
+
+
+Release Highlights
+------------------
+
+
+* link:https://gerrit-documentation.storage.googleapis.com/Documentation/2.8/intro-change-screen.html[
+New change screen] with completely redesigned UI and fully using the REST API.
+
+* link:https://gerrit-documentation.storage.googleapis.com/Documentation/2.8/config-gerrit.html#index[
+Secondary indexing with Lucene and Solr].
+
+* Lots of new link:https://gerrit-documentation.storage.googleapis.com/Documentation/2.8/rest-api.html[
+REST API endpoints].
+
+* New
+link:https://gerrit-documentation.storage.googleapis.com/Documentation/2.8/dev-plugins.html#ui_extension[
+UI extension] and
+link:https://gerrit-documentation.storage.googleapis.com/Documentation/2.8/js-api.html[
+JavaScript API] for plugins.
+
+* New build system using Facebook's link:http://facebook.github.io/buck/[Buck].
+
+* New core plugin: Download Commands.
+
+
+New Features
+------------
+
+Build
+~~~~~
+
+* Gerrit is now built with
+link:https://gerrit-documentation.storage.googleapis.com/Documentation/2.8/dev-buck.html[
+Buck].
+
+* Documentation is now built with Buck and link:http://asciidoctor.org[Asciidoctor].
+
+
+Indexing and Search
+~~~~~~~~~~~~~~~~~~~
+
+Gerrit can be configured to use a
+link:https://gerrit-documentation.storage.googleapis.com/Documentation/2.8/config-gerrit.html#index[
+secondary index] with Lucene or Solr.
+
+Existing search operations use the secondary index, when enabled, to increase
+performance and reduce resource usage.
+
+The following additional search operations are possible when secondary indexing
+is enabled:
+
+* New
+link:https://gerrit-documentation.storage.googleapis.com/Documentation/2.8/user-search.html#comment[
+`comment` search operator].
+
+* The link:https://gerrit-documentation.storage.googleapis.com/Documentation/2.8/user-search.html#file[
+`file` operator] can be used to find changes on the specified file.
+
+* Regular expressions are allowed in `file` searches.
+
+
+Configuration
+~~~~~~~~~~~~~
+
+* Project owners can define `receive.maxObjectSizeLimit` in the
+link:https://gerrit-documentation.storage.googleapis.com/Documentation/2.8/config-gerrit.html#receive.maxObjectSizeLimit[
+project configuration] to further reduce the global setting.
+
+* Site administrators can define a
+link:https://gerrit-documentation.storage.googleapis.com/Documentation/2.8/config-mail.html#_footer_vm[
+footer template] that will be appended to the end of all outgoing emails after
+the 'ChangeFooter' and 'CommentFooter'.
+
+* New `topic-changed` hook and stream event is fired when a change's topic is
+edited from the Web UI or via a REST API.
+
+* New options `--list-plugins` and `--install-plugins` on the
+link:https://gerrit-documentation.storage.googleapis.com/Documentation/2.8/pgm-init.html[
+site initialization command].
+
+* New `auth.httpDisplaynameHeader` and `auth.httpEmailHeader` in the
+link:https://gerrit-documentation.storage.googleapis.com/Documentation/2.8/config-gerrit.html#__a_id_auth_a_section_auth[
+authentication configuration].
++
+When using HTTP-based authentication, the SSO can be delegated to check not only
+the user credentials but also to fetch the full user-profile.
++
+With the config properties `auth.httpDisplaynameHeader` and `auth.httpEmailHeader`
+it is possible to configure the name of the headers used for propagating this extra
+information and enforce them on the user profile during login and beyond.
+
+* link:https://gerrit-documentation.storage.googleapis.com/Documentation/2.8/config-gerrit.html#__a_id_httpd_a_section_httpd[
+Customizable registration page for HTTP authentication].
+
+* link:https://gerrit-documentation.storage.googleapis.com/Documentation/2.8/config-gerrit.html#__a_id_httpd_a_section_httpd[
+Configurable external `robots.txt` file].
+
+* Support for
+link:https://gerrit-documentation.storage.googleapis.com/Documentation/2.8/database-setup.html#createdb_oracle[
+Oracle database].
+
+* New bash completion script for autocompletion of parameters to the gerrit.sh wrapper.
+
+* The site can be
+link:https://gerrit-documentation.storage.googleapis.com/Documentation/2.8/config-auto-site-initialization.html[
+auto-initialized on server startup].
+
+* link:https://gerrit-documentation.storage.googleapis.com/Documentation/2.8/config-gerrit.html#httpd.filterClass[
+Configurable filtering of HTTP traffic through Gerrit's HTTP protocol].
+
+* Labels can be
+link:https://gerrit-documentation.storage.googleapis.com/Documentation/2.8/config-labels.html#httpd.label_copyAllScoresIfNoCodeChange[
+configured to copy scores forward to new patch sets if there is no code change].
+
+* Labels can be
+link:https://gerrit-documentation.storage.googleapis.com/Documentation/2.8/config-labels.html#httpd.label_copyAllScoresOnTrivialRebase[
+configured to copy scores forward to new patch sets for trivial rebases].
+
+Web UI
+~~~~~~
+
+
+Global
+^^^^^^
+
+* The change status is shown in a separate column on dashboards and search results.
+
+Change Screens
+^^^^^^^^^^^^^^
+
+
+* New change screen with completely redesigned UI, using the REST API.
++
+Site administrators can
+link:https://gerrit-documentation.storage.googleapis.com/Documentation/2.8/config-gerrit.html#gerrit.changeScreen[
+configure which change screen is shown by default].
++
+Users can choose which one to use in their personal preferences, either using
+the site default or explicitly choosing the old one or new one.
+
+* link:https://code.google.com/p/gerrit/issues/detail?id=141[Issue 141]:
+In the new change screen, comments can be added on a range of lines.
+
+* New button to cherry-pick the change to another branch.
+
+* When issuing a rebase via the Web UI, the committer is now the logged in
+  user, rather than "Gerrit Code Review".
++
+If the user has more than one email address, the preferred email address will
+be used.
+
+* Default user's full name to git committer name if user has not configured a
+full name in their profile.
+
+* Include comment author attributes in comment panels.
++
+Comment author's email address and name are included as attributes in comment
+panels.  This makes it easier to filter out CI-based comments using user
+scripts.
+
+* Copy reviewed flag to new patch sets for identical files.
++
+If a user has already seen and reviewed a file, the 'reviewed' flag is forwarded
+on to the next patch set when the content of the file in the next patch set is
+identical to the reviewed file.
+
+* "Uploaded Patch Set 1" change message is added on changes when they
+are uploaded.
+
+
+REST API
+~~~~~~~~
+
+* Several new link:https://gerrit-documentation.storage.googleapis.com/Documentation/2.8/rest-api.html[
+REST API endpoints] are added.
+
+* REST views can determine how long their response should be cached.
+
+* REST views can handle 'HTTP 422 Unprocessable Entity' responses.
+
+Access Rights
+^^^^^^^^^^^^^
+
+
+* link:https://gerrit-documentation.storage.googleapis.com/Documentation/2.8/rest-api-access.html#list-access[
+List access rights for project(s)]
+
+Accounts
+^^^^^^^^
+
+
+* link:https://gerrit-documentation.storage.googleapis.com/Documentation/2.8/rest-api-accounts.html#create-account[
+Create account]
+
+* link:https://gerrit-documentation.storage.googleapis.com/Documentation/2.8/rest-api-accounts.html#get-account-name[
+Get account full name]
+
+* link:https://gerrit-documentation.storage.googleapis.com/Documentation/2.8/rest-api-accounts.html#set-account-name[
+Set account full name]
+
+* link:https://gerrit-documentation.storage.googleapis.com/Documentation/2.8/rest-api-accounts.html#delete-account-name[
+Delete account full name]
+
+* link:https://gerrit-documentation.storage.googleapis.com/Documentation/2.8/rest-api-accounts.html#list-account-emails[
+List account email addresses]
+
+* link:https://gerrit-documentation.storage.googleapis.com/Documentation/2.8/rest-api-accounts.html#get-account-email[
+Get account email address]
+
+* link:https://gerrit-documentation.storage.googleapis.com/Documentation/2.8/rest-api-accounts.html#set-preferred-email[
+Set account preferred email address]
+
+* link:https://gerrit-documentation.storage.googleapis.com/Documentation/2.8/rest-api-accounts.html#create-account-email[
+Create account email]
+
+* link:https://gerrit-documentation.storage.googleapis.com/Documentation/2.8/rest-api-accounts.html#delete-account-email[
+Delete account email]
+
+* link:https://gerrit-documentation.storage.googleapis.com/Documentation/2.8/rest-api-accounts.html#get-active[
+Get account state]
+
+* link:https://gerrit-documentation.storage.googleapis.com/Documentation/2.8/rest-api-accounts.html#set-active[
+Set account state to active]
+
+* link:https://gerrit-documentation.storage.googleapis.com/Documentation/2.8/rest-api-accounts.html#delete-active[
+Set account state to inactive]
+
+* link:https://gerrit-documentation.storage.googleapis.com/Documentation/2.8/rest-api-accounts.html#get-http-password[
+Get account HTTP password]
+
+* link:https://gerrit-documentation.storage.googleapis.com/Documentation/2.8/rest-api-accounts.html#set-http-password[
+Set or generate account HTTP password]
+
+* link:https://gerrit-documentation.storage.googleapis.com/Documentation/2.8/rest-api-accounts.html#delete-http-password[
+Delete account HTTP password]
+
+* link:https://gerrit-documentation.storage.googleapis.com/Documentation/2.8/rest-api-accounts.html#list-ssh-keys[
+List account SSH keys]
+
+* link:https://gerrit-documentation.storage.googleapis.com/Documentation/2.8/rest-api-accounts.html#get-ssh-key[
+Get account SSH key]
+
+* link:https://gerrit-documentation.storage.googleapis.com/Documentation/2.8/rest-api-accounts.html#add-ssh-key[
+Add account SSH key]
+
+* link:https://gerrit-documentation.storage.googleapis.com/Documentation/2.8/rest-api-accounts.html#delete-ssh-key[
+Delete account SSH key]
+
+* link:https://gerrit-documentation.storage.googleapis.com/Documentation/2.8/rest-api-accounts.html#get-username[
+Get account username]
+
+* link:https://gerrit-documentation.storage.googleapis.com/Documentation/2.8/rest-api-accounts.html#get-starred-changes[
+Get starred changes]
+
+* link:https://gerrit-documentation.storage.googleapis.com/Documentation/2.8/rest-api-accounts.html#star-change[
+Star change]
+
+* link:https://gerrit-documentation.storage.googleapis.com/Documentation/2.8/rest-api-accounts.html#unstar-change[
+Unstar change]
+
+Changes
+^^^^^^^
+
+
+* link:https://gerrit-documentation.storage.googleapis.com/Documentation/2.8/rest-api-changes.html#rebase-change[
+Rebase change]
+
+* link:https://gerrit-documentation.storage.googleapis.com/Documentation/2.8/rest-api-changes.html#cherry-pick[
+Cherry-pick revision]
+
+* link:https://gerrit-documentation.storage.googleapis.com/Documentation/2.8/rest-api-changes.html#get-content[
+Get content of a file in a revision]
+
+* link:https://gerrit-documentation.storage.googleapis.com/Documentation/2.8/rest-api-changes.html#get-patch[
+Get revision as a formatted patch]
+
+* link:https://gerrit-documentation.storage.googleapis.com/Documentation/2.8/rest-api-changes.html#get-diff[
+Get diff of a file in a revision]
+
+* link:https://gerrit-documentation.storage.googleapis.com/Documentation/2.8/rest-api-changes.html#get-commit[
+Get parsed commit of a revision]
+
+* link:https://gerrit-documentation.storage.googleapis.com/Documentation/2.8/rest-api-changes.html#publish-draft-change[
+Publish draft change]
+
+* link:https://gerrit-documentation.storage.googleapis.com/Documentation/2.8/rest-api-changes.html#delete-draft-change[
+Delete draft change]
+
+* link:https://gerrit-documentation.storage.googleapis.com/Documentation/2.8/rest-api-changes.html#suggest-reviewers[
+Suggest reviewers]
+
+* link:https://gerrit-documentation.storage.googleapis.com/Documentation/2.8/rest-api-changes.html#get-included-in[
+Get included in]
+
+
+Config
+^^^^^^
+
+* link:https://gerrit-documentation.storage.googleapis.com/Documentation/2.8/rest-api-config.html#get-capabilities[
+Get capabilities]
+
+* link:https://gerrit-documentation.storage.googleapis.com/Documentation/2.8/rest-api-config.html#get-version[
+Get version] (of the Gerrit server)
+
+
+Projects
+^^^^^^^^
+
+
+* link:https://gerrit-documentation.storage.googleapis.com/Documentation/2.8/rest-api-projects.html#list-branches[
+List branches]
+
+* link:https://gerrit-documentation.storage.googleapis.com/Documentation/2.8/rest-api-projects.html#get-branch[
+Get branch]
+
+* link:https://gerrit-documentation.storage.googleapis.com/Documentation/2.8/rest-api-projects.html#create-branch[
+Create branch]
+
+* link:https://gerrit-documentation.storage.googleapis.com/Documentation/2.8/rest-api-projects.html#delete-branch[
+Delete branch]
+
+* link:https://gerrit-documentation.storage.googleapis.com/Documentation/2.8/rest-api-projects.html#list-child-projects[
+List child projects]
+
+* link:https://gerrit-documentation.storage.googleapis.com/Documentation/2.8/rest-api-projects.html#get-child-project[
+Get child project]
+
+* link:https://gerrit-documentation.storage.googleapis.com/Documentation/2.8/rest-api-projects.html#set-config[
+Set configuration]
+
+
+Capabilities
+~~~~~~~~~~~~
+
+
+New global capabilities are added.
+
+* link:https://gerrit-documentation.storage.googleapis.com/Documentation/2.8/access_control.html#capability_generateHttpPassword[
+Generate Http Password] allows non-administrator users to generate HTTP
+passwords for users other than themselves.
++
+This capability would typically be assigned to a non-interactive group
+to be able to generate HTTP passwords for users from a tool or web service
+that uses the Gerrit REST API.
+
+* link:https://gerrit-documentation.storage.googleapis.com/Documentation/2.8/access_control.html#capability_runAs[
+Run As] allows users to impersonate other users by setting the `X-Gerrit-RunAs`
+HTTP header on REST API calls.
++
+Site administrators do not inherit this capability;  it must be granted
+explicitly.
+
+
+Emails
+~~~~~~
+
+* The `RebasedPatchSet` template is removed.  Email notifications for rebased
+changes are now sent with the `ReplacePatchSet` template.
+
+* Comment notification emails now include context of comments that are replied
+to, and links to the file(s) in which comments are made.
+
+
+Plugins
+~~~~~~~
+
+
+Global
+^^^^^^
+
+
+* Plugins may now contribute buttons to various parts of the UI using the
+link:https://gerrit-documentation.storage.googleapis.com/Documentation/2.8/dev-plugins.html#ui_extension[
+UI extension] and
+link:https://gerrit-documentation.storage.googleapis.com/Documentation/2.8/js-api.html[
+JavaScript API].
+
+* Plugins may now provide an 'About' section on their documentation index page.
+
+* Plugins may now provide separate sections for REST API and servlet
+documentation on their index page.
+
+* Plugins may now provide
+link:https://gerrit-documentation.storage.googleapis.com/Documentation/2.8/config-validation.html#pre-merge-validation[
+pre-merge validation steps].
+
+* Plugins may now provide
+link:https://gerrit-documentation.storage.googleapis.com/Documentation/2.8/dev-plugins.html#capabilities[
+Global capabilities].
+
+* Plugins may now
+link:https://gerrit-documentation.storage.googleapis.com/Documentation/2.8/dev-plugins.html#plugin_name[
+define their own name] and get the name injected at runtime.
+
+* The "hello world" plugin is replaced with the "cookbook plugin" which has more
+examples of the plugin API's usage.
+
+* Plugins may now trigger and listen to a "project deleted"
+link:https://gerrit-documentation.storage.googleapis.com/Documentation/2.8/dev-plugins.html#events[
+event].
+
+* link:https://code.google.com/p/gerrit/issues/detail?id=2101[Issue 2101]:
+Plugins implementing LifecycleListener can use auto registration.
+
+* Plugins may bind REST endpoints with empty view names.
+
+* Plugins may now provide
+link:https://gerrit-documentation.storage.googleapis.com/Documentation/2.8/dev-plugins.html#top-menu-extensions[
+entries in Gerrit's top menu].
+
+* Plugins may now
+link:https://gerrit-documentation.storage.googleapis.com/Documentation/2.8/dev-plugins.html#stream-events[
+send events to the events stream].
+
+* Plugins may now bind multiple SSH commands to the same implementation class.
+
+* Plugins may now provide
+link:https://gerrit-documentation.storage.googleapis.com/Documentation/2.8/dev-plugins.html#download-commands[
+download schemes and download commands].
++
+Commonly used download schemes and commands are moved out of core
+Gerrit and are now implemented by a new core plugin, `download-commands`.
+
+
+
+Commit Message Length Checker
+^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+
+* Commits whose subject or body length exceeds the limit can be rejected.
+
+Replication
+^^^^^^^^^^^
+
+* Automatically create missing repositories on the destination.
++
+If during the replication of a ref the target repository is found to be missing,
+the repository is automatically created.
++
+This is a change in behavior of the replication plugin. To go back to the old
+behavior, set the parameter `remote.NAME.createMissingRepositories` in the
+`replication.config` file to `false`.
+
+* Support for replication of project deletions.
++
+The replication plugin can now be configured to listen to project deletion events
+and to replicate the project deletions. By default project deletions are *not*
+replicated.
+
+* The `{$name}` placeholder is optional when replicating a single project,
+allowing a single project to be replicated under a different name.
+
+* Project names can be matched with wildcard or regex patterns in `replication.config`.
+
+* The `replication start` command does not exit until replication is finished
+when the `--wait` option is used.
+
+* The `replication start` command displays a summary of the replication status.
+
+* Retry counts are added to replication task names, so they can be seen in the
+output of the `show-queue` command.
+
+* The `remoteNameStyle` option can be set to `basenameOnly` to replicate projects
+using only the basename on the target server.
+
+* The `startReplication` global capability is now provided by the plugin.
+
+* Pushes to each destination URI are serialized.
++
+Scheduling a retry to avoid collision with an in-flight push is differentiated
+from a retry due to a transport error.  In the case of collision avoidance, the
+job is rescheduled according to the replication delay, rather than the retry
+delay.
+
+
+ssh
+~~~
+
+
+* The `commit-msg` hook installation command is now
+link:https://gerrit-documentation.storage.googleapis.com/Documentation/2.8/config-gerrit.html#gerrit.installCommitMsgHookCommand[
+configurable].
+
+* link:https://gerrit-documentation.storage.googleapis.com/Documentation/2.8/cmd-ls-members.html[
+New `ls-members` command].
+
+* link:https://gerrit-documentation.storage.googleapis.com/Documentation/2.8/cmd-set-members.html[
+New `set-members` command].
++
+New command to manipulate group membership. Members can be added or removed
+and groups can be included or excluded in one specific group or number of groups.
+
+* The full commit message is now included in the data sent by the
+link:https://gerrit-documentation.storage.googleapis.com/Documentation/2.8/cmd-stream-events.html[
+`stream-events` command].
+
+* The link:https://gerrit-documentation.storage.googleapis.com/Documentation/2.8/cmd-show-queue.html[
+`show-queue` command] now shows the time that a task was added to the queue.
+
+
+Daemon
+~~~~~~
+
+
+* Add `--init` option to Daemon to initialize site on daemon start.
++
+The `--init` option will also upgrade an already existing site and is processed in
+non-interactive (batch) mode.
+
+
+Bug Fixes
+---------
+
+
+General
+~~~~~~~
+
+
+* Use the parent change on the same branch for rebases.
++
+Since there can be multiple changes with the same commit on different branches,
+use the parent change on the same branch during rebase.
+
+* link:https://code.google.com/p/gerrit/issues/detail?id=600[Issue 600]:
+Fix change stuck in SUBMITTED state but actually merged.
+
+* link:https://code.google.com/p/gerrit/issues/detail?id=1699[Issue 1699]:
+Fix handling of projects with trailing ".git" suffix.
+
+* Limit retrying of submitted changes to 12 hours.
+
+* Don't allow project owners to delete branches if force push is blocked.
+
+
+Configuration
+~~~~~~~~~~~~~
+
+
+* Do not persist default project state in `project.config`.
+
+* Honor the `gerrit.cannonicalWebUrl` setting when opening the browser after init.
+
+* Fix 'query disabled' error when Query Limit is set.
+
+* Honor the `gerrit.createChangeId` setting from the git config in the
+The link:https://gerrit-documentation.storage.googleapis.com/Documentation/2.8/cmd-hook-commit-msg.html[
+`commit-msg` hook].
+
+* link:https://code.google.com/p/gerrit/issues/detail?id=2045[Issue 2045]:
+Define user scope when parsing server config.
+
+* link:https://code.google.com/p/gerrit/issues/detail?id=1990[Issue 1990]:
+Support optional Certificate Revocation List (CRL) with `CLIENT_SSL_CERT_LDAP`.
+
+* Do not override error and gc logging configuration provided by the
+`-Dlog4j.configuration` parameter.
+
+Web UI
+~~~~~~
+
+
+Global
+^^^^^^
+
+
+* link:https://code.google.com/p/gerrit/issues/detail?id=1574[Issue 1574]:
+Correctly highlight matches of text in escaped HTML entities in suggestion results.
+
+* link:https://code.google.com/p/gerrit/issues/detail?id=1996[Issue 1996]:
+The "Keyboard Shortcuts" help popup can be closed by pressing the Escape key.
+
+* link:https://code.google.com/p/gerrit/issues/detail?id=2013[Issue 2013]:
+Correctly populate the list of watched changes when watching more than one project.
+
+* Display "Working..." when header is hidden.
+
+Change Screens
+^^^^^^^^^^^^^^
+
+
+* Default review comment visibility is changed to expand all recent.
++
+By default all comments within the last week are expanded, rather than
+only the most recent.
+
+* link:https://code.google.com/p/gerrit/issues/detail?id=1814[Issue 1814]:
+Sort labels alphabetically by name in the approval table.
+
+* Don't add "This patchset was cherry picked to ..." for the same change.
++
+If a patchset is cherry-picked to the same destination branch and
+ends up on the same change, it does not make sense to add the "This
+patchset was cherry picked to change ..." message.
++
+In this case, it makes more sense for the message to say "Uploaded
+patch set N" instead.
+
+Project Screens
+^^^^^^^^^^^^^^^
+
+
+* Only enable the delete branch button when branches are selected.
+
+* Disable the delete branch button while branch deletion requests are
+still being processed.
+
+User Profile Screens
+^^^^^^^^^^^^^^^^^^^^
+
+
+* The preferred email address field is shown as empty if the user has no
+preferred email address.
+
+
+REST API
+~~~~~~~~
+
+
+* Support raw input also in POST requests.
+
+* Show granted date for labels/all when using `/changes/`.
+
+* Return all revisions when `o=ALL_REVISIONS` is set on `/changes/`.
+
+ssh
+~~~
+
+
+* The `--force-message` option is removed from the
+The link:https://gerrit-documentation.storage.googleapis.com/Documentation/2.8/cmd-review.html[
+`review` command].
+
+* link:https://code.google.com/p/gerrit/issues/detail?id=1908[Issue 1908]:
+Provide more informative error messages when rejecting updates.
+
+* Remove the limit in the query of patch sets by revision.
+
+* Add `isDraft` in the `patchSet` attribute of `stream-events` data.
++
+This allows consumers of the event stream to determine whether or not
+the event is related to a draft patch set.
+
+* Normalize the case of review labels submitted via the
+The link:https://gerrit-documentation.storage.googleapis.com/Documentation/2.8/cmd-review.html[
+`review` command].
+
+* The `@CommandMetaData(descr)` annotation is deprecated in favor of `@CommandMetaData(description)`.
+
+* Improve the error message when rejecting upload for review to a read-only project.
+
+
+Plugins
+~~~~~~~
+
+Global
+^^^^^^
+
+* Better error message when a Javascript plugin cannot be loaded.
+
+* Plugin documentation links are opened in a new tab.
+
+* The GitReferenceUpdatedListener.Event API is simplified.
++
+The Event exposed the getUpdates method which implied that one Event
+could contain updates of more than one reference. However, this feature
+was never used.
++
+The API is simplified in the sense that one Event now corresponds to
+one ref update only.
+
+
+Review Notes
+^^^^^^^^^^^^
+
+* Do not try to create review notes for ref deletion events.
+
+* Fix committing the notes from the export command.
+
+* link:https://code.google.com/p/gerrit/issues/detail?id=2087[Issue 2087]:
+Fix note creation when the same commit exists in another Git repository.
+
+* Improve the export command performance.
+
+* Create review note also when newObjectId already present in another branch.
+
+Emails
+~~~~~~
+
+* Email notifications are sent for new changes created via actions in the
+Web UI such as cherry-picking or reverting a change.
+
+
+Tools
+~~~~~
+
+
+* git-exproll.sh: return non-zero on errors
+
+
+Documentation
+-------------
+
+
+* The link:https://gerrit-documentation.storage.googleapis.com/Documentation/2.8/index.html[
+documentation index page] is rewritten in a hierarchical structure.
+
+* Documentation of
+link:https://gerrit-documentation.storage.googleapis.com/Documentation/2.8/config-project-config.txt[
+project configuration] is added.
+
+* Various spelling mistakes are corrected in the documentation and previous
+release notes.
+
+
+Upgrades
+--------
+
+* Update JGit to 3.1.0.201310021548-r
+* Update gwtorm to 1.7
+* Update guice to 4.0-beta
+* Update guava to 15.0
+* Update H2 to 1.3.173
+* Update bouncycastle to 1.44
+* Update Apache Mina to 2.0.7
+* Update Apache SSHD to 0.9.0.201311081
+* asciidoctor 0.1.4 is now required to build the documentation
+* jsr305 library was removed
diff --git a/ReleaseNotes/index.txt b/ReleaseNotes/index.txt
index b656be2..28b9f65 100644
--- a/ReleaseNotes/index.txt
+++ b/ReleaseNotes/index.txt
@@ -1,6 +1,11 @@
 Gerrit Code Review - Release Notes
 ==================================
 
+[[2_8]]
+Version 2.8.x
+-------------
+* link:ReleaseNotes-2.8.html[2.8]
+
 [[2_7]]
 Version 2.7.x
 -------------
diff --git a/VERSION b/VERSION
new file mode 100644
index 0000000..23c7033
--- /dev/null
+++ b/VERSION
@@ -0,0 +1,5 @@
+# Maven style API version (e.g. '2.x-SNAPSHOT').
+# Used by :api_install and :api_deploy targets
+# when talking to the destination repository.
+#
+GERRIT_VERSION = '2.8-SNAPSHOT'
diff --git a/contrib/.pep8rc b/contrib/.pep8rc
new file mode 100644
index 0000000..568bcfb
--- /dev/null
+++ b/contrib/.pep8rc
@@ -0,0 +1,5 @@
+[pep8]
+max_line_length = 80
+show_pep8 = True
+show_source = True
+ignore = E111,E121
diff --git a/contrib/bash_completion b/contrib/bash_completion
new file mode 100644
index 0000000..6772235
--- /dev/null
+++ b/contrib/bash_completion
@@ -0,0 +1,73 @@
+# The MIT License
+#
+# Copyright (C) 2013 Sony Mobile Communications. All rights reserved.
+#
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to deal
+# in the Software without restriction, including without limitation the rights
+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+# THE SOFTWARE.
+#
+# #########################################################################
+# This bash script adds tab-completion to the gerrit.sh script.
+#
+# Testing it out without installing
+# =================================
+#
+# To test out the completion without "installing" this, just run this file
+# directly, like so:
+#
+#     . ~/path/to/bash_completion
+#
+# Note: There's a dot ('.') at the beginning of that command.
+#
+# After you do that, tab completion will immediately be made available in your
+# current Bash shell. It will not, however, be available next time you log in.
+#
+# Installing
+# ==========
+#
+# To install the completion, copy this file to the appropriate folder for
+# your distribution, for example:
+#
+#     cp ~/path/to/bash_completion /etc/bash_completion.d/gerrit_sh
+#
+# Alternatively you can invoke this file from your .bash_profile, like so:
+#
+#     . ~/path/to/bash_completion
+#
+# Do the same in your .bashrc if .bashrc doesn't invoke .bash_profile.
+#
+# The settings will take effect the next time you log in.
+#
+# Uninstalling
+# ============
+#
+# To uninstall, just remove the file from the bash completion folder, or
+# remove the line from your .bash_profile and .bashrc.
+# #########################################################################
+
+_gerrit_sh()
+{
+    local cur prev opts
+    COMPREPLY=()
+    cur="${COMP_WORDS[COMP_CWORD]}"
+    prev="${COMP_WORDS[COMP_CWORD-1]}"
+    opts="check restart run start status stop supervise"
+
+    COMPREPLY=( $(compgen -W "${opts}" -- ${cur}) )
+}
+complete -F _gerrit_sh gerrit.sh
+
diff --git a/contrib/check-valid-commit.py b/contrib/check-valid-commit.py
index ca1785e..150b310 100755
--- a/contrib/check-valid-commit.py
+++ b/contrib/check-valid-commit.py
@@ -1,5 +1,8 @@
 #!/usr/bin/env python
-import commands
+
+from __future__ import print_function
+
+import subprocess
 import getopt
 import sys
 
@@ -24,8 +27,8 @@
     try:
         opts, args = getopt.getopt(sys.argv[1:], '', \
             ['change=', 'project=', 'branch=', 'commit=', 'patchset='])
-    except getopt.GetoptError, err:
-        print 'Error: %s' % (err)
+    except getopt.GetoptError as err:
+        print('Error: %s' % (err))
         usage()
         sys.exit(-1)
 
@@ -41,7 +44,7 @@
         elif arg == '--patchset':
             patchset = value
         else:
-            print 'Error: option %s not recognized' % (arg)
+            print('Error: option %s not recognized' % (arg))
             usage()
             sys.exit(-1)
 
@@ -51,11 +54,11 @@
         sys.exit(-1)
 
     command = 'git cat-file commit %s' % (commit)
-    status, output = commands.getstatusoutput(command)
+    status, output = subprocess.getstatusoutput(command)
 
     if status != 0:
-        print 'Error running \'%s\'. status: %s, output:\n\n%s' % \
-            (command, status, output)
+        print('Error running \'%s\'. status: %s, output:\n\n%s' % \
+            (command, status, output))
         sys.exit(-1)
 
     commitMessage = output[(output.find('\n\n')+2):]
@@ -74,21 +77,21 @@
     passes(commit)
 
 def usage():
-    print 'Usage:\n'
-    print sys.argv[0] + ' --change <change id> --project <project name> ' \
-        + '--branch <branch> --commit <sha1> --patchset <patchset id>'
+    print('Usage:\n')
+    print(sys.argv[0] + ' --change <change id> --project <project name> ' \
+        + '--branch <branch> --commit <sha1> --patchset <patchset id>')
 
 def fail( commit, message ):
     command = SSH_COMMAND + FAILURE_SCORE + ' -m \\\"' \
         + _shell_escape( FAILURE_MESSAGE + '\n\n' + message) \
         + '\\\" ' + commit
-    commands.getstatusoutput(command)
+    subprocess.getstatusoutput(command)
     sys.exit(1)
 
 def passes( commit ):
     command = SSH_COMMAND + PASS_SCORE + ' -m \\\"' \
         + _shell_escape(PASS_MESSAGE) + ' \\\" ' + commit
-    commands.getstatusoutput(command)
+    subprocess.getstatusoutput(command)
 
 def _shell_escape(x):
     s = ''
diff --git a/contrib/git-exproll.sh b/contrib/git-exproll.sh
index 9526d9f..066c57c 100644
--- a/contrib/git-exproll.sh
+++ b/contrib/git-exproll.sh
@@ -126,7 +126,7 @@
 
     [ -n "$1" ] && info "ERROR $1"
 
-    exit
+    exit 128
 }
 
 debug() { [ -n "$SW_V" ] && info "$1" ; }
diff --git a/contrib/themes/diffy/etc/GerritSite.css b/contrib/themes/diffy/etc/GerritSite.css
index d476957..76c595a 100644
--- a/contrib/themes/diffy/etc/GerritSite.css
+++ b/contrib/themes/diffy/etc/GerritSite.css
@@ -15,15 +15,15 @@
 #gerrit_topmenu {
   left: 60px;
   margin-right: 60px;
-  padding-right: 10px;
   position: relative;
+  margin-bottom: 5px;
 }
 
 #diffy_logo {
   display: block !important;
   margin-bottom: -55px;
-  padding-left: 20px;
+  padding-left: 10px;
   position: relative;
-  top: -45px;
+  top: -55px;
   width: 60px;
 }
diff --git a/contrib/trivial_rebase.py b/contrib/trivial_rebase.py
index 30e60af..c97172e 100755
--- a/contrib/trivial_rebase.py
+++ b/contrib/trivial_rebase.py
@@ -36,6 +36,8 @@
 
 """
 
+from __future__ import print_function
+
 import argparse
 import json
 import re
@@ -95,7 +97,7 @@
     try:
       process = subprocess.Popen(command, cwd=cwd, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
       std_out, std_err = process.communicate()
-    except OSError, e:
+    except OSError as e:
       raise self.CheckCallError(command, cwd, e.errno, None)
     if process.returncode:
       raise self.CheckCallError(command, cwd, process.returncode, std_out, std_err)
@@ -107,9 +109,9 @@
                 '--format', 'JSON', '-c', sql_query]
     try:
       (gsql_out, _gsql_stderr) = self.CheckCall(gsql_cmd)
-    except self.CheckCallError, e:
-      print "return code is %s" % e.retcode
-      print "stdout and stderr is\n%s%s" % (e.stdout, e.stderr)
+    except self.CheckCallError as e:
+      print("return code is %s" % e.retcode)
+      print("stdout and stderr is\n%s%s" % (e.stdout, e.stderr))
       raise
 
     new_out = gsql_out.replace('}}\n', '}}\nsplit here\n')
@@ -194,7 +196,7 @@
     prev_patch_id = self.GetPatchId(prev_revision)
     cur_patch_id = self.GetPatchId(self.commit)
     if prev_patch_id == '0' and cur_patch_id == '0':
-      print "commits %s and %s are both empty or merge commits" % (prev_revision, self.commit)
+      print("commits %s and %s are both empty or merge commits" % (prev_revision, self.commit))
       return
     if cur_patch_id != prev_patch_id:
       # patch-ids don't match
@@ -238,7 +240,7 @@
 
     gerrit_review_msg = ("\'Automatically re-added by Gerrit trivial rebase "
                           "detection script.\'")
-    for acct, flags in self.acct_approvals.items():
+    for acct, flags in list(self.acct_approvals.items()):
       gerrit_review_cmd = ['gerrit', 'review', '--project', self.project,
                             '--message', gerrit_review_msg, flags, self.commit]
       email_addr = self.GetEmailFromAcctId(acct)
@@ -247,5 +249,5 @@
 if __name__ == "__main__":
   try:
     TrivialRebase().Run()
-  except AssertionError, e:
-    print >> sys.stderr, e
+  except AssertionError as e:
+    print(e, file=sys.stderr)
diff --git a/gerrit-acceptance-tests/BUCK b/gerrit-acceptance-tests/BUCK
new file mode 100644
index 0000000..cb946d6
--- /dev/null
+++ b/gerrit-acceptance-tests/BUCK
@@ -0,0 +1,42 @@
+include_defs('//gerrit-acceptance-tests/tests.defs')
+
+java_library(
+  name = 'lib',
+  srcs = glob(['src/test/java/com/google/gerrit/acceptance/*.java']),
+  deps = [
+    '//gerrit-common:server',
+    '//gerrit-extension-api:api',
+    '//gerrit-launcher:launcher',
+    '//gerrit-lucene:lucene',
+    '//gerrit-httpd:httpd',
+    '//gerrit-pgm:init-base',
+    '//gerrit-pgm:pgm',
+    '//gerrit-reviewdb:server',
+    '//gerrit-server:server',
+    '//gerrit-server:testutil',
+    '//gerrit-sshd:sshd',
+
+    '//lib:args4j',
+    '//lib:gson',
+    '//lib:guava',
+    '//lib:gwtorm',
+    '//lib:h2',
+    '//lib:jsch',
+    '//lib:junit',
+    '//lib:servlet-api-3_0',
+
+    '//lib/commons:httpclient',
+    '//lib/commons:httpcore',
+    '//lib/log:impl_log4j',
+    '//lib/log:log4j',
+    '//lib/guice:guice',
+    '//lib/jgit:jgit',
+    '//lib/jgit:junit',
+    '//lib/mina:sshd',
+  ],
+  export_deps = True,
+  visibility = [
+    '//tools/eclipse:classpath',
+    '//gerrit-acceptance-tests/...',
+  ],
+)
diff --git a/gerrit-acceptance-tests/pom.xml b/gerrit-acceptance-tests/pom.xml
deleted file mode 100644
index 63facba..0000000
--- a/gerrit-acceptance-tests/pom.xml
+++ /dev/null
@@ -1,148 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
-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.
--->
-<project xmlns="http://maven.apache.org/POM/4.0.0"
-        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
-        xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
-  <modelVersion>4.0.0</modelVersion>
-
-  <parent>
-    <groupId>com.google.gerrit</groupId>
-    <artifactId>gerrit-parent</artifactId>
-    <version>2.7</version>
-  </parent>
-
-  <artifactId>gerrit-acceptance-tests</artifactId>
-
-  <name>Gerrit Code Review - Acceptance Tests</name>
-
-  <description>
-    Gerrit Acceptance Tests
-  </description>
-
-  <dependencies>
-    <dependency>
-      <groupId>junit</groupId>
-      <artifactId>junit</artifactId>
-      <scope>test</scope>
-    </dependency>
-
-    <dependency>
-      <groupId>com.google.gerrit</groupId>
-      <artifactId>gerrit-reviewdb</artifactId>
-      <version>${project.version}</version>
-    </dependency>
-
-    <dependency>
-      <groupId>com.google.gerrit</groupId>
-      <artifactId>gerrit-main</artifactId>
-      <version>${project.version}</version>
-      <scope>runtime</scope>
-    </dependency>
-
-    <dependency>
-      <groupId>com.google.gerrit</groupId>
-      <artifactId>gerrit-server</artifactId>
-      <version>${project.version}</version>
-      <exclusions>
-        <exclusion>
-          <groupId>org.apache.tomcat</groupId>
-          <artifactId>servlet-api</artifactId>
-        </exclusion>
-      </exclusions>
-    </dependency>
-
-    <dependency>
-      <groupId>org.slf4j</groupId>
-      <artifactId>slf4j-log4j12</artifactId>
-    </dependency>
-
-    <dependency>
-      <groupId>log4j</groupId>
-      <artifactId>log4j</artifactId>
-    </dependency>
-
-    <dependency>
-      <groupId>com.google.gerrit</groupId>
-      <artifactId>gerrit-openid</artifactId>
-      <version>${project.version}</version>
-    </dependency>
-
-    <dependency>
-      <groupId>com.google.gerrit</groupId>
-      <artifactId>gerrit-sshd</artifactId>
-      <version>${project.version}</version>
-    </dependency>
-
-    <dependency>
-      <groupId>com.google.gerrit</groupId>
-      <artifactId>gerrit-httpd</artifactId>
-      <version>${project.version}</version>
-    </dependency>
-
-    <dependency>
-      <groupId>com.google.gerrit</groupId>
-      <artifactId>gerrit-pgm</artifactId>
-      <version>${project.version}</version>
-      <exclusions>
-        <exclusion>
-          <groupId>org.eclipse.jetty</groupId>
-          <artifactId>jetty-servlet</artifactId>
-        </exclusion>
-      </exclusions>
-    </dependency>
-
-    <dependency>
-      <groupId>org.eclipse.jetty</groupId>
-      <artifactId>jetty-servlet</artifactId>
-      <scope>provided</scope>
-    </dependency>
-  </dependencies>
-
-  <profiles>
-    <profile>
-      <id>acceptance</id>
-      <activation>
-        <property>
-          <name>!gerrit.acceptance-tests.skip</name>
-        </property>
-      </activation>
-      <build>
-        <plugins>
-          <plugin>
-            <groupId>org.apache.maven.plugins</groupId>
-            <artifactId>maven-failsafe-plugin</artifactId>
-            <version>2.5</version>
-            <executions>
-              <execution>
-                <id>integration-test</id>
-                <goals>
-                  <goal>integration-test</goal>
-                </goals>
-              </execution>
-              <execution>
-                <id>verify</id>
-                <goals>
-                  <goal>verify</goal>
-                </goals>
-              </execution>
-            </executions>
-          </plugin>
-        </plugins>
-      </build>
-    </profile>
-  </profiles>
-</project>
diff --git a/gerrit-acceptance-tests/src/test/java/com/google/gerrit/acceptance/AbstractDaemonTest.java b/gerrit-acceptance-tests/src/test/java/com/google/gerrit/acceptance/AbstractDaemonTest.java
index 51c7b3d..784b461 100644
--- a/gerrit-acceptance-tests/src/test/java/com/google/gerrit/acceptance/AbstractDaemonTest.java
+++ b/gerrit-acceptance-tests/src/test/java/com/google/gerrit/acceptance/AbstractDaemonTest.java
@@ -14,22 +14,52 @@
 
 package com.google.gerrit.acceptance;
 
-import org.junit.After;
-import org.junit.Before;
-
+import org.eclipse.jgit.lib.Config;
+import org.junit.Rule;
+import org.junit.rules.TestRule;
+import org.junit.runner.Description;
+import org.junit.runners.model.Statement;
 
 public abstract class AbstractDaemonTest {
+  protected GerritServer server;
 
-  private GerritServer server;
+  @Rule
+  public TestRule testRunner = new TestRule() {
+    @Override
+    public Statement apply(final Statement base, final Description description) {
+      return new Statement() {
+        @Override
+        public void evaluate() throws Throwable {
+          boolean mem = description.getAnnotation(UseLocalDisk.class) == null;
+          beforeTest(config(description), mem);
+          base.evaluate();
+          afterTest();
+        }
+      };
+    }
+  };
 
-  @Before
-  public final void beforeTest() throws Exception {
-    server = GerritServer.start();
+  private static Config config(Description description) {
+    GerritConfigs cfgs = description.getAnnotation(GerritConfigs.class);
+    GerritConfig cfg = description.getAnnotation(GerritConfig.class);
+    if (cfgs != null && cfg != null) {
+      throw new IllegalStateException("Use either @GerritConfigs or @GerritConfig not both");
+    }
+    if (cfgs != null) {
+      return ConfigAnnotationParser.parse(cfgs);
+    } else if (cfg != null) {
+      return ConfigAnnotationParser.parse(cfg);
+    } else {
+      return null;
+    }
+  }
+
+  private void beforeTest(Config cfg, boolean memory) throws Exception {
+    server = GerritServer.start(cfg, memory);
     server.getTestInjector().injectMembers(this);
   }
 
-  @After
-  public final void afterTest() throws Exception {
+  private void afterTest() throws Exception {
     server.stop();
   }
 }
diff --git a/gerrit-acceptance-tests/src/test/java/com/google/gerrit/acceptance/AccountCreator.java b/gerrit-acceptance-tests/src/test/java/com/google/gerrit/acceptance/AccountCreator.java
index f56ef07..12add3e 100644
--- a/gerrit-acceptance-tests/src/test/java/com/google/gerrit/acceptance/AccountCreator.java
+++ b/gerrit-acceptance-tests/src/test/java/com/google/gerrit/acceptance/AccountCreator.java
@@ -30,8 +30,10 @@
 import com.google.gerrit.server.account.AccountCache;
 import com.google.gerrit.server.account.GroupCache;
 import com.google.gerrit.server.ssh.SshKeyCache;
+import com.google.gerrit.server.util.TimeUtil;
 import com.google.gwtorm.server.OrmException;
 import com.google.gwtorm.server.SchemaFactory;
+
 import com.jcraft.jsch.JSch;
 import com.jcraft.jsch.JSchException;
 import com.jcraft.jsch.KeyPair;
@@ -77,7 +79,7 @@
         db.accountExternalIds().insert(Collections.singleton(extMailto));
       }
 
-      Account a = new Account(id);
+      Account a = new Account(id, TimeUtil.nowTs());
       a.setFullName(fullName);
       a.setPreferredEmail(email);
       db.accounts().insert(Collections.singleton(a));
@@ -114,6 +116,12 @@
     return create(username, null, username, (String[]) null);
   }
 
+  public TestAccount admin()
+      throws UnsupportedEncodingException, OrmException, JSchException {
+    return create("admin", "admin@example.com", "Administrator",
+      "Administrators");
+  }
+
   private AccountExternalId.Key getEmailKey(String email) {
     return new AccountExternalId.Key(AccountExternalId.SCHEME_MAILTO, email);
   }
diff --git a/gerrit-acceptance-tests/src/test/java/com/google/gerrit/acceptance/ConfigAnnotationParser.java b/gerrit-acceptance-tests/src/test/java/com/google/gerrit/acceptance/ConfigAnnotationParser.java
new file mode 100644
index 0000000..cf60fb4
--- /dev/null
+++ b/gerrit-acceptance-tests/src/test/java/com/google/gerrit/acceptance/ConfigAnnotationParser.java
@@ -0,0 +1,58 @@
+// 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.acceptance;
+
+import com.google.common.base.Splitter;
+import com.google.common.collect.Lists;
+
+import org.eclipse.jgit.lib.Config;
+
+import java.util.ArrayList;
+
+class ConfigAnnotationParser {
+
+  private static Splitter splitter = Splitter.on(".").trimResults();
+
+  static Config parse(GerritConfigs annotation) {
+    if (annotation == null) {
+      return null;
+    }
+
+    Config cfg = new Config();
+    for (GerritConfig c : annotation.value()) {
+      parse(cfg, c);
+    }
+    return cfg;
+  }
+
+  static Config parse(GerritConfig annotation) {
+    Config cfg = new Config();
+    parse(cfg, annotation);
+    return cfg;
+  }
+
+  static private void parse(Config cfg, GerritConfig c) {
+    ArrayList<String> l = Lists.newArrayList(splitter.split(c.name()));
+    if (l.size() == 2) {
+      cfg.setString(l.get(0), null, l.get(1), c.value());
+    } else if (l.size() == 3) {
+      cfg.setString(l.get(0), l.get(1), l.get(2), c.value());
+    } else {
+      throw new IllegalArgumentException(
+          "GerritConfig.name must be of the format"
+              + " section.subsection.name or section.name");
+    }
+  }
+}
diff --git a/gerrit-acceptance-tests/src/test/java/com/google/gerrit/acceptance/GerritConfig.java b/gerrit-acceptance-tests/src/test/java/com/google/gerrit/acceptance/GerritConfig.java
new file mode 100644
index 0000000..5cb1229
--- /dev/null
+++ b/gerrit-acceptance-tests/src/test/java/com/google/gerrit/acceptance/GerritConfig.java
@@ -0,0 +1,28 @@
+// 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.acceptance;
+
+import static java.lang.annotation.ElementType.METHOD;
+import static java.lang.annotation.RetentionPolicy.RUNTIME;
+
+import java.lang.annotation.Retention;
+import java.lang.annotation.Target;
+
+@Target({METHOD})
+@Retention(RUNTIME)
+public @interface GerritConfig {
+  String name();
+  String value();
+}
diff --git a/gerrit-acceptance-tests/src/test/java/com/google/gerrit/acceptance/GerritConfigs.java b/gerrit-acceptance-tests/src/test/java/com/google/gerrit/acceptance/GerritConfigs.java
new file mode 100644
index 0000000..58bb9f2
--- /dev/null
+++ b/gerrit-acceptance-tests/src/test/java/com/google/gerrit/acceptance/GerritConfigs.java
@@ -0,0 +1,27 @@
+// 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.acceptance;
+
+import static java.lang.annotation.ElementType.METHOD;
+import static java.lang.annotation.RetentionPolicy.RUNTIME;
+
+import java.lang.annotation.Retention;
+import java.lang.annotation.Target;
+
+@Target({METHOD})
+@Retention(RUNTIME)
+public @interface GerritConfigs {
+  public GerritConfig[] value();
+}
diff --git a/gerrit-acceptance-tests/src/test/java/com/google/gerrit/acceptance/GerritServer.java b/gerrit-acceptance-tests/src/test/java/com/google/gerrit/acceptance/GerritServer.java
index 65bab6a..daf9d38 100644
--- a/gerrit-acceptance-tests/src/test/java/com/google/gerrit/acceptance/GerritServer.java
+++ b/gerrit-acceptance-tests/src/test/java/com/google/gerrit/acceptance/GerritServer.java
@@ -14,10 +14,29 @@
 
 package com.google.gerrit.acceptance;
 
+import com.google.common.collect.ImmutableList;
+import com.google.gerrit.pgm.Daemon;
+import com.google.gerrit.pgm.Init;
+import com.google.gerrit.server.config.FactoryModule;
+import com.google.gerrit.server.config.GerritServerConfig;
+import com.google.gerrit.server.util.SocketUtil;
+import com.google.inject.Injector;
+import com.google.inject.Key;
+import com.google.inject.Module;
+
+import org.eclipse.jgit.errors.ConfigInvalidException;
+import org.eclipse.jgit.lib.Config;
+import org.eclipse.jgit.lib.RepositoryCache;
+import org.eclipse.jgit.util.FS;
+
+import java.io.File;
+import java.io.IOException;
 import java.lang.reflect.Field;
-import java.text.DateFormat;
-import java.text.SimpleDateFormat;
-import java.util.Date;
+import java.net.InetAddress;
+import java.net.InetSocketAddress;
+import java.net.ServerSocket;
+import java.net.URI;
+import java.net.UnknownHostException;
 import java.util.concurrent.BrokenBarrierException;
 import java.util.concurrent.Callable;
 import java.util.concurrent.CyclicBarrier;
@@ -25,22 +44,11 @@
 import java.util.concurrent.Executors;
 import java.util.concurrent.TimeUnit;
 
-import com.google.gerrit.lifecycle.LifecycleManager;
-import com.google.gerrit.pgm.Daemon;
-import com.google.gerrit.pgm.Init;
-import com.google.gerrit.server.config.FactoryModule;
-import com.google.inject.Injector;
-import com.google.inject.Module;
-
-class GerritServer {
+public class GerritServer {
 
   /** Returns fully started Gerrit server */
-  static GerritServer start() throws Exception {
-
-    final String sitePath = initSite();
-
+  static GerritServer start(Config base, boolean memory) throws Exception {
     final CyclicBarrier serverStarted = new CyclicBarrier(2);
-
     final Daemon daemon = new Daemon(new Runnable() {
       public void run() {
         try {
@@ -53,35 +61,76 @@
       }
     });
 
-    ExecutorService daemonService = Executors.newSingleThreadExecutor();
-    daemonService.submit(new Callable<Void>() {
-      public Void call() throws Exception {
-        int rc = daemon.main(new String[] {"-d", sitePath, "--headless" });
-        if (rc != 0) {
-          System.out.println("Failed to start Gerrit daemon. Check "
-              + sitePath + "/logs/error_log");
-          serverStarted.reset();
-        }
-        return null;
-      };
-    });
-
-    serverStarted.await();
-    System.out.println("Gerrit Server Started");
+    final File site;
+    ExecutorService daemonService = null;
+    if (memory) {
+      site = null;
+      Config cfg = base != null ? base : new Config();
+      mergeTestConfig(cfg);
+      cfg.setBoolean("httpd", null, "requestLog", false);
+      cfg.setBoolean("sshd", null, "requestLog", false);
+      daemon.setDatabaseForTesting(ImmutableList.<Module>of(
+          new InMemoryTestingDatabaseModule(cfg)));
+      daemon.start();
+    } else {
+      site = initSite(base);
+      daemonService = Executors.newSingleThreadExecutor();
+      daemonService.submit(new Callable<Void>() {
+        public Void call() throws Exception {
+          int rc = daemon.main(new String[] {"-d", site.getPath(), "--headless" });
+          if (rc != 0) {
+            System.out.println("Failed to start Gerrit daemon. Check "
+                + site.getPath() + "/logs/error_log");
+            serverStarted.reset();
+          }
+          return null;
+        };
+      });
+      serverStarted.await();
+      System.out.println("Gerrit Server Started");
+    }
 
     Injector i = createTestInjector(daemon);
-    return new GerritServer(i, daemon, daemonService);
+    return new GerritServer(site, i, daemon, daemonService);
   }
 
-  private static String initSite() throws Exception {
-    DateFormat df = new SimpleDateFormat("yyyyMMddHHmmss");
-    String path = "target/test_site_" + df.format(new Date());
+  private static File initSite(Config base) throws Exception {
+    File tmp = TempFileUtil.createTempDirectory();
     Init init = new Init();
-    int rc = init.main(new String[] {"-d", path, "--batch", "--no-auto-start"});
+    int rc = init.main(new String[] {
+        "-d", tmp.getPath(), "--batch", "--no-auto-start",
+        "--skip-plugins"});
     if (rc != 0) {
       throw new RuntimeException("Couldn't initialize site");
     }
-    return path;
+
+    MergeableFileBasedConfig cfg = new MergeableFileBasedConfig(
+        new File(new File(tmp, "etc"), "gerrit.config"),
+        FS.DETECTED);
+    cfg.load();
+    cfg.merge(base);
+    mergeTestConfig(cfg);
+    cfg.save();
+    return tmp;
+  }
+
+  private static void mergeTestConfig(Config cfg)
+      throws IOException {
+    InetSocketAddress http = newPort();
+    InetSocketAddress sshd = newPort();
+    String url = "http://" + format(http) + "/";
+
+    cfg.setString("gerrit", null, "canonicalWebUrl", url);
+    cfg.setString("httpd", null, "listenUrl", url);
+    cfg.setString("sshd", null, "listenAddress", format(sshd));
+    cfg.setString("cache", null, "directory", null);
+    cfg.setBoolean("sendemail", null, "enable", false);
+    cfg.setInt("cache", "projects", "checkFrequency", 0);
+    cfg.setInt("plugins", null, "checkFrequency", 0);
+  }
+
+  private static String format(InetSocketAddress s) {
+    return String.format("%s:%d", s.getAddress().getHostAddress(), s.getPort());
   }
 
   private static Injector createTestInjector(Daemon daemon) throws Exception {
@@ -103,15 +152,63 @@
     return (T) f.get(obj);
   }
 
+  private static final InetSocketAddress newPort() throws IOException {
+    ServerSocket s = new ServerSocket(0, 0, getLocalHost());
+    try {
+      return (InetSocketAddress) s.getLocalSocketAddress();
+    } finally {
+      s.close();
+    }
+  }
+
+  private static InetAddress getLocalHost() throws UnknownHostException {
+    try {
+      return InetAddress.getLocalHost();
+    } catch (UnknownHostException e1) {
+      try {
+        return InetAddress.getByName("localhost");
+      } catch (UnknownHostException e2) {
+        return InetAddress.getByName("127.0.0.1");
+      }
+    }
+  }
+
+  private File sitePath;
   private Daemon daemon;
   private ExecutorService daemonService;
   private Injector testInjector;
+  private String url;
+  private InetSocketAddress sshdAddress;
+  private InetSocketAddress httpAddress;
 
-  private GerritServer(Injector testInjector,
-      Daemon daemon, ExecutorService daemonService) {
+  private GerritServer(File sitePath, Injector testInjector, Daemon daemon,
+      ExecutorService daemonService) throws IOException, ConfigInvalidException {
+    this.sitePath = sitePath;
     this.testInjector = testInjector;
     this.daemon = daemon;
     this.daemonService = daemonService;
+
+    Config cfg = testInjector.getInstance(
+      Key.get(Config.class, GerritServerConfig.class));
+    url = cfg.getString("gerrit", null, "canonicalWebUrl");
+    URI uri = URI.create(url);
+
+    sshdAddress = SocketUtil.resolve(
+        cfg.getString("sshd", null, "listenAddress"),
+        0);
+    httpAddress = new InetSocketAddress(uri.getHost(), uri.getPort());
+  }
+
+  String getUrl() {
+    return url;
+  }
+
+  InetSocketAddress getSshdAddress() {
+    return sshdAddress;
+  }
+
+  InetSocketAddress getHttpAddress() {
+    return httpAddress;
   }
 
   Injector getTestInjector() {
@@ -119,10 +216,15 @@
   }
 
   void stop() throws Exception {
-    LifecycleManager manager = get(daemon, "manager");
-    System.out.println("Gerrit Server Shutdown");
-    manager.stop();
-    daemonService.shutdownNow();
-    daemonService.awaitTermination(Long.MAX_VALUE, TimeUnit.SECONDS);
+    daemon.getLifecycleManager().stop();
+    if (daemonService != null) {
+      System.out.println("Gerrit Server Shutdown");
+      daemonService.shutdownNow();
+      daemonService.awaitTermination(Long.MAX_VALUE, TimeUnit.SECONDS);
+    }
+    if (sitePath != null) {
+      TempFileUtil.recursivelyDelete(sitePath);
+    }
+    RepositoryCache.clear();
   }
 }
diff --git a/gerrit-acceptance-tests/src/test/java/com/google/gerrit/acceptance/InMemoryTestingDatabaseModule.java b/gerrit-acceptance-tests/src/test/java/com/google/gerrit/acceptance/InMemoryTestingDatabaseModule.java
new file mode 100644
index 0000000..5576c4f
--- /dev/null
+++ b/gerrit-acceptance-tests/src/test/java/com/google/gerrit/acceptance/InMemoryTestingDatabaseModule.java
@@ -0,0 +1,129 @@
+// 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.acceptance;
+
+import static com.google.inject.Scopes.SINGLETON;
+
+import com.google.gerrit.extensions.events.LifecycleListener;
+import com.google.gerrit.lifecycle.LifecycleModule;
+import com.google.gerrit.reviewdb.server.ReviewDb;
+import com.google.gerrit.server.config.GerritServerConfig;
+import com.google.gerrit.server.config.SitePath;
+import com.google.gerrit.server.config.SitePaths;
+import com.google.gerrit.server.config.TrackingFooters;
+import com.google.gerrit.server.config.TrackingFootersProvider;
+import com.google.gerrit.server.git.GitRepositoryManager;
+import com.google.gerrit.server.schema.DataSourceType;
+import com.google.gerrit.server.schema.SchemaModule;
+import com.google.gerrit.server.schema.SchemaVersion;
+import com.google.gerrit.testutil.InMemoryDatabase;
+import com.google.gerrit.testutil.InMemoryH2Type;
+import com.google.gerrit.testutil.InMemoryRepositoryManager;
+import com.google.gwtorm.server.OrmException;
+import com.google.gwtorm.server.OrmRuntimeException;
+import com.google.gwtorm.server.SchemaFactory;
+import com.google.inject.AbstractModule;
+import com.google.inject.Inject;
+import com.google.inject.Provides;
+import com.google.inject.Singleton;
+import com.google.inject.TypeLiteral;
+
+import org.apache.sshd.common.KeyPairProvider;
+import org.apache.sshd.server.keyprovider.SimpleGeneratorHostKeyProvider;
+import org.eclipse.jgit.lib.Config;
+
+import java.io.File;
+
+class InMemoryTestingDatabaseModule extends AbstractModule {
+  private final Config cfg;
+
+  InMemoryTestingDatabaseModule(Config cfg) {
+    this.cfg = cfg;
+  }
+
+  @Override
+  protected void configure() {
+    bind(Config.class)
+      .annotatedWith(GerritServerConfig.class)
+      .toInstance(cfg);
+
+    bind(File.class)
+      .annotatedWith(SitePath.class)
+      .toInstance(new File("UNIT_TEST_GERRIT_SITE"));
+
+    bind(GitRepositoryManager.class)
+      .toInstance(new InMemoryRepositoryManager());
+
+    bind(DataSourceType.class).to(InMemoryH2Type.class);
+    bind(InMemoryDatabase.class).in(SINGLETON);
+    bind(new TypeLiteral<SchemaFactory<ReviewDb>>() {})
+      .to(InMemoryDatabase.class);
+
+    install(new LifecycleModule() {
+      @Override
+      protected void configure() {
+        listener().to(CreateDatabase.class);
+      }
+    });
+
+    bind(SitePaths.class);
+    bind(TrackingFooters.class)
+      .toProvider(TrackingFootersProvider.class)
+      .in(SINGLETON);
+
+    install(new SchemaModule());
+    bind(SchemaVersion.class).to(SchemaVersion.C);
+  }
+
+  @Provides
+  @Singleton
+  KeyPairProvider createHostKey() {
+    return getHostKeys();
+  }
+
+  private static SimpleGeneratorHostKeyProvider keys;
+
+  private static synchronized KeyPairProvider getHostKeys() {
+    if (keys == null) {
+      keys = new SimpleGeneratorHostKeyProvider();
+      keys.setAlgorithm("RSA");
+      keys.loadKeys();
+    }
+    return keys;
+  }
+
+  static class CreateDatabase implements LifecycleListener {
+    private final InMemoryDatabase mem;
+
+    @Inject
+    CreateDatabase(InMemoryDatabase mem) {
+      this.mem = mem;
+    }
+
+    @Override
+    public void start() {
+      try {
+        mem.create();
+      } catch (OrmException e) {
+        throw new OrmRuntimeException(e);
+      }
+    }
+
+    @Override
+    public void stop() {
+      mem.drop();
+    }
+  }
+}
\ No newline at end of file
diff --git a/gerrit-acceptance-tests/src/test/java/com/google/gerrit/acceptance/MergeableFileBasedConfig.java b/gerrit-acceptance-tests/src/test/java/com/google/gerrit/acceptance/MergeableFileBasedConfig.java
new file mode 100644
index 0000000..f1baa9d
--- /dev/null
+++ b/gerrit-acceptance-tests/src/test/java/com/google/gerrit/acceptance/MergeableFileBasedConfig.java
@@ -0,0 +1,60 @@
+// 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.acceptance;
+
+import com.google.common.collect.Lists;
+
+import org.eclipse.jgit.lib.Config;
+import org.eclipse.jgit.storage.file.FileBasedConfig;
+import org.eclipse.jgit.util.FS;
+
+import java.io.File;
+
+/**
+ * A file based Config that can merge another Config instance.
+ */
+public class MergeableFileBasedConfig extends FileBasedConfig {
+  public MergeableFileBasedConfig(File cfgLocation, FS fs) {
+    super(cfgLocation, fs);
+  }
+
+  /**
+   * Merge another Config into this Config.
+   *
+   * In case a configuration parameter exists both in this instance and in the
+   * merged instance then the value in this instance will simply replaced by
+   * the value from the merged instance.
+   *
+   * @param s Config to merge into this instance
+   */
+  public void merge(Config s) {
+    if (s == null) {
+      return;
+    }
+    for (String section : s.getSections()) {
+      for (String subsection : s.getSubsections(section)) {
+        for (String name : s.getNames(section, subsection)) {
+          setStringList(section, subsection, name, Lists.newArrayList(s
+              .getStringList(section, subsection, name)));
+        }
+      }
+
+      for (String name : s.getNames(section)) {
+        setStringList(section, null, name,
+            Lists.newArrayList(s.getStringList(section, null, name)));
+      }
+    }
+  }
+}
diff --git a/gerrit-acceptance-tests/src/test/java/com/google/gerrit/acceptance/RestResponse.java b/gerrit-acceptance-tests/src/test/java/com/google/gerrit/acceptance/RestResponse.java
index 9f93489..9e5d702 100644
--- a/gerrit-acceptance-tests/src/test/java/com/google/gerrit/acceptance/RestResponse.java
+++ b/gerrit-acceptance-tests/src/test/java/com/google/gerrit/acceptance/RestResponse.java
@@ -16,11 +16,16 @@
 
 import static com.google.gerrit.httpd.restapi.RestApiServlet.JSON_MAGIC;
 
+import com.google.common.base.Preconditions;
+
 import org.apache.http.HttpResponse;
+import org.eclipse.jgit.util.IO;
+import org.eclipse.jgit.util.RawParseUtils;
 
 import java.io.IOException;
 import java.io.InputStreamReader;
 import java.io.Reader;
+import java.nio.ByteBuffer;
 
 public class RestResponse {
 
@@ -49,4 +54,19 @@
   public int getStatusCode() {
     return response.getStatusLine().getStatusCode();
   }
+
+  public String getEntityContent() throws IOException {
+    Preconditions.checkNotNull(response,
+        "Response is not initialized.");
+    Preconditions.checkNotNull(response.getEntity(),
+        "Response.Entity is not initialized.");
+      ByteBuffer buf = IO.readWholeStream(
+          response.getEntity().getContent(),
+          1024);
+      return RawParseUtils.decode(
+          buf.array(),
+          buf.arrayOffset(),
+          buf.limit())
+          .trim();
+  }
 }
diff --git a/gerrit-acceptance-tests/src/test/java/com/google/gerrit/acceptance/RestSession.java b/gerrit-acceptance-tests/src/test/java/com/google/gerrit/acceptance/RestSession.java
index 2bf6523..9132be8 100644
--- a/gerrit-acceptance-tests/src/test/java/com/google/gerrit/acceptance/RestSession.java
+++ b/gerrit-acceptance-tests/src/test/java/com/google/gerrit/acceptance/RestSession.java
@@ -14,6 +14,8 @@
 
 package com.google.gerrit.acceptance;
 
+import com.google.common.base.CharMatcher;
+import com.google.common.base.Charsets;
 import com.google.gson.Gson;
 
 import org.apache.http.auth.AuthScope;
@@ -25,21 +27,23 @@
 import org.apache.http.entity.StringEntity;
 import org.apache.http.impl.client.DefaultHttpClient;
 import org.apache.http.message.BasicHeader;
-import org.apache.http.protocol.HTTP;
 
 import java.io.IOException;
+import java.net.URI;
 
 public class RestSession {
 
   private final TestAccount account;
+  private final String url;
   DefaultHttpClient client;
 
-  public RestSession(TestAccount account) {
+  public RestSession(GerritServer server, TestAccount account) {
+    this.url = CharMatcher.is('/').trimTrailingFrom(server.getUrl());
     this.account = account;
   }
 
   public RestResponse get(String endPoint) throws IOException {
-    HttpGet get = new HttpGet("http://localhost:8080/a" + endPoint);
+    HttpGet get = new HttpGet(url + "/a" + endPoint);
     return new RestResponse(getClient().execute(get));
   }
 
@@ -48,10 +52,12 @@
   }
 
   public RestResponse put(String endPoint, Object content) throws IOException {
-    HttpPut put = new HttpPut("http://localhost:8080/a" + endPoint);
+    HttpPut put = new HttpPut(url + "/a" + endPoint);
     if (content != null) {
       put.addHeader(new BasicHeader("Content-Type", "application/json"));
-      put.setEntity(new StringEntity((new Gson()).toJson(content), HTTP.UTF_8));
+      put.setEntity(new StringEntity(
+          new Gson().toJson(content),
+          Charsets.UTF_8.name()));
     }
     return new RestResponse(getClient().execute(put));
   }
@@ -61,24 +67,27 @@
   }
 
   public RestResponse post(String endPoint, Object content) throws IOException {
-    HttpPost post = new HttpPost("http://localhost:8080/a" + endPoint);
+    HttpPost post = new HttpPost(url + "/a" + endPoint);
     if (content != null) {
       post.addHeader(new BasicHeader("Content-Type", "application/json"));
-      post.setEntity(new StringEntity((new Gson()).toJson(content), HTTP.UTF_8));
+      post.setEntity(new StringEntity(
+          new Gson().toJson(content),
+          Charsets.UTF_8.name()));
     }
     return new RestResponse(getClient().execute(post));
   }
 
   public RestResponse delete(String endPoint) throws IOException {
-    HttpDelete delete = new HttpDelete("http://localhost:8080/a" + endPoint);
+    HttpDelete delete = new HttpDelete(url + "/a" + endPoint);
     return new RestResponse(getClient().execute(delete));
   }
 
   private DefaultHttpClient getClient() {
     if (client == null) {
+      URI uri = URI.create(url);
       client = new DefaultHttpClient();
       client.getCredentialsProvider().setCredentials(
-          new AuthScope("localhost", 8080),
+          new AuthScope(uri.getHost(), uri.getPort()),
           new UsernamePasswordCredentials(account.username, account.httpPassword));
     }
     return client;
diff --git a/gerrit-acceptance-tests/src/test/java/com/google/gerrit/acceptance/SshSession.java b/gerrit-acceptance-tests/src/test/java/com/google/gerrit/acceptance/SshSession.java
index aae9236..a150eba 100644
--- a/gerrit-acceptance-tests/src/test/java/com/google/gerrit/acceptance/SshSession.java
+++ b/gerrit-acceptance-tests/src/test/java/com/google/gerrit/acceptance/SshSession.java
@@ -16,6 +16,7 @@
 
 import java.io.IOException;
 import java.io.InputStream;
+import java.net.InetSocketAddress;
 import java.util.Scanner;
 
 import com.jcraft.jsch.ChannelExec;
@@ -25,11 +26,13 @@
 
 public class SshSession {
 
+  private final InetSocketAddress addr;
   private final TestAccount account;
   private Session session;
   private String error;
 
-  public SshSession(TestAccount account) {
+  public SshSession(GerritServer server, TestAccount account) {
+    this.addr = server.getSshdAddress();
     this.account = account;
   }
 
@@ -42,7 +45,7 @@
       channel.connect();
 
       Scanner s = new Scanner(channel.getErrStream()).useDelimiter("\\A");
-      error =  s.hasNext() ? s.next() : null;
+      error = s.hasNext() ? s.next() : null;
 
       s = new Scanner(in).useDelimiter("\\A");
       return s.hasNext() ? s.next() : "";
@@ -71,7 +74,10 @@
       JSch jsch = new JSch();
       jsch.addIdentity("KeyPair",
           account.privateKey(), account.sshKey.getPublicKeyBlob(), null);
-      session = jsch.getSession(account.username, "localhost", 29418);
+      session = jsch.getSession(
+          account.username,
+          addr.getAddress().getHostAddress(),
+          addr.getPort());
       session.setConfig("StrictHostKeyChecking", "no");
       session.connect();
     }
diff --git a/gerrit-acceptance-tests/src/test/java/com/google/gerrit/acceptance/SystemGroupsIT.java b/gerrit-acceptance-tests/src/test/java/com/google/gerrit/acceptance/SystemGroupsIT.java
deleted file mode 100644
index 6ee2045..0000000
--- a/gerrit-acceptance-tests/src/test/java/com/google/gerrit/acceptance/SystemGroupsIT.java
+++ /dev/null
@@ -1,105 +0,0 @@
-// 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.acceptance;
-
-import static org.junit.Assert.assertTrue;
-
-import com.google.common.collect.Sets;
-import com.google.gerrit.acceptance.rest.group.GroupInfo;
-import com.google.gerrit.reviewdb.client.AccountGroup;
-import com.google.gerrit.reviewdb.server.ReviewDb;
-import com.google.gson.Gson;
-import com.google.gson.reflect.TypeToken;
-import com.google.gwtorm.server.OrmException;
-import com.google.gwtorm.server.SchemaFactory;
-import com.google.inject.Inject;
-
-import com.jcraft.jsch.JSchException;
-
-import org.junit.Before;
-import org.junit.Test;
-
-import java.io.IOException;
-import java.util.Map;
-import java.util.Set;
-
-/**
- * An example test that tests presence of system groups in a newly initialized
- * review site.
- *
- * The test shows how to perform these checks via SSH, REST or using Gerrit
- * internals.
- */
-public class SystemGroupsIT extends AbstractDaemonTest {
-
-  @Inject
-  private SchemaFactory<ReviewDb> reviewDbProvider;
-
-  @Inject
-  private AccountCreator accounts;
-
-  protected TestAccount admin;
-
-  @Before
-  public void setUp() throws Exception {
-    admin = accounts.create("admin", "admin@sap.com", "Administrator",
-            "Administrators");
-  }
-
-  @Test
-  public void systemGroupsCreated_ssh() throws JSchException, IOException {
-    SshSession session = new SshSession(admin);
-    String result = session.exec("gerrit ls-groups");
-    assertTrue(result.contains("Administrators"));
-    assertTrue(result.contains("Anonymous Users"));
-    assertTrue(result.contains("Non-Interactive Users"));
-    assertTrue(result.contains("Project Owners"));
-    assertTrue(result.contains("Registered Users"));
-    session.close();
-  }
-
-  @Test
-  public void systemGroupsCreated_rest() throws IOException {
-    RestSession session = new RestSession(admin);
-    RestResponse r = session.get("/groups/");
-    Gson gson = new Gson();
-    Map<String, GroupInfo> result =
-        gson.fromJson(r.getReader(), new TypeToken<Map<String, GroupInfo>>() {}.getType());
-    Set<String> names = result.keySet();
-    assertTrue(names.contains("Administrators"));
-    assertTrue(names.contains("Anonymous Users"));
-    assertTrue(names.contains("Non-Interactive Users"));
-    assertTrue(names.contains("Project Owners"));
-    assertTrue(names.contains("Registered Users"));
-  }
-
-  @Test
-  public void systemGroupsCreated_internals() throws OrmException {
-    ReviewDb db = reviewDbProvider.open();
-    try {
-      Set<String> names = Sets.newHashSet();
-      for (AccountGroup g : db.accountGroups().all()) {
-        names.add(g.getName());
-      }
-      assertTrue(names.contains("Administrators"));
-      assertTrue(names.contains("Anonymous Users"));
-      assertTrue(names.contains("Non-Interactive Users"));
-      assertTrue(names.contains("Project Owners"));
-      assertTrue(names.contains("Registered Users"));
-    } finally {
-      db.close();
-    }
-  }
-}
diff --git a/gerrit-acceptance-tests/src/test/java/com/google/gerrit/acceptance/TempFileUtil.java b/gerrit-acceptance-tests/src/test/java/com/google/gerrit/acceptance/TempFileUtil.java
index adee361..ff0ca7b 100644
--- a/gerrit-acceptance-tests/src/test/java/com/google/gerrit/acceptance/TempFileUtil.java
+++ b/gerrit-acceptance-tests/src/test/java/com/google/gerrit/acceptance/TempFileUtil.java
@@ -15,27 +15,41 @@
 package com.google.gerrit.acceptance;
 
 import java.io.File;
-import java.text.DateFormat;
-import java.text.SimpleDateFormat;
-import java.util.Date;
+import java.io.IOException;
 
 public class TempFileUtil {
-
-  private static int testCount;
-  private static DateFormat df = new SimpleDateFormat("yyyyMMddHHmmss");
-  private static final File temp = new File(new File("target"), "temp");
-
-  private static String createUniqueTestFolderName() {
-    return "test_" + (df.format(new Date()) + "_" + (testCount++));
+  public static File createTempDirectory() throws IOException {
+    File tmp = File.createTempFile("gerrit_test_", "");
+    if (!tmp.delete() || !tmp.mkdir()) {
+      throw new IOException("Cannot create " + tmp.getPath());
+    }
+    return tmp;
   }
 
-  public static File createTempDirectory() {
-    final String name = createUniqueTestFolderName();
-    final File directory = new File(temp, name);
-    if (!directory.mkdirs()) {
-      throw new RuntimeException("failed to create folder '"
-          + directory.getAbsolutePath() + "'");
+  public static void recursivelyDelete(File dir) throws IOException {
+    if (!dir.getPath().equals(dir.getCanonicalPath())) {
+      // Directory symlink reaching outside of temporary space.
+      return;
     }
-    return directory;
+    File[] contents = dir.listFiles();
+    if (contents != null) {
+      for (File d : contents) {
+        if (d.isDirectory()) {
+          recursivelyDelete(d);
+        } else {
+          deleteNowOrOnExit(d);
+        }
+      }
+    }
+    deleteNowOrOnExit(dir);
+  }
+
+  private static void deleteNowOrOnExit(File dir) {
+    if (!dir.delete()) {
+      dir.deleteOnExit();
+    }
+  }
+
+  private TempFileUtil() {
   }
 }
diff --git a/gerrit-acceptance-tests/src/test/java/com/google/gerrit/acceptance/TestAccount.java b/gerrit-acceptance-tests/src/test/java/com/google/gerrit/acceptance/TestAccount.java
index 358680f..b85ffea 100644
--- a/gerrit-acceptance-tests/src/test/java/com/google/gerrit/acceptance/TestAccount.java
+++ b/gerrit-acceptance-tests/src/test/java/com/google/gerrit/acceptance/TestAccount.java
@@ -51,13 +51,11 @@
     return new PersonIdent(username, email);
   }
 
-  public String getHttpUrl() {
-    StringBuilder b = new StringBuilder();
-    b.append("http://");
-    b.append(username);
-    b.append(":");
-    b.append(httpPassword);
-    b.append("@localhost:8080");
-    return b.toString();
+  public String getHttpUrl(GerritServer server) {
+    return String.format("http://%s:%s@%s:%d",
+        username,
+        httpPassword,
+        server.getHttpAddress().getAddress().getHostAddress(),
+        server.getHttpAddress().getPort());
   }
 }
diff --git a/gerrit-acceptance-tests/src/test/java/com/google/gerrit/acceptance/UseGerritConfigAnnotationTest.java b/gerrit-acceptance-tests/src/test/java/com/google/gerrit/acceptance/UseGerritConfigAnnotationTest.java
new file mode 100644
index 0000000..0931e12
--- /dev/null
+++ b/gerrit-acceptance-tests/src/test/java/com/google/gerrit/acceptance/UseGerritConfigAnnotationTest.java
@@ -0,0 +1,46 @@
+// 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.acceptance;
+
+import static org.junit.Assert.assertEquals;
+
+import com.google.gerrit.server.config.GerritServerConfig;
+import com.google.inject.Inject;
+
+import org.eclipse.jgit.lib.Config;
+import org.junit.Test;
+
+public class UseGerritConfigAnnotationTest extends AbstractDaemonTest {
+
+  @Inject
+  @GerritServerConfig
+  Config serverConfig;
+
+  @Test
+  @GerritConfig(name="x.y", value="z")
+  public void testOne() {
+    assertEquals("z", serverConfig.getString("x", null, "y"));
+  }
+
+  @Test
+  @GerritConfigs({
+      @GerritConfig(name="x.y", value="z"),
+      @GerritConfig(name="a.b", value="c"),
+  })
+  public void testMultiple() {
+    assertEquals("z", serverConfig.getString("x", null, "y"));
+    assertEquals("c", serverConfig.getString("a", null, "b"));
+  }
+}
diff --git a/gerrit-acceptance-tests/src/test/java/com/google/gerrit/acceptance/UseLocalDisk.java b/gerrit-acceptance-tests/src/test/java/com/google/gerrit/acceptance/UseLocalDisk.java
new file mode 100644
index 0000000..f9367ec
--- /dev/null
+++ b/gerrit-acceptance-tests/src/test/java/com/google/gerrit/acceptance/UseLocalDisk.java
@@ -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.acceptance;
+
+import static java.lang.annotation.ElementType.METHOD;
+import static java.lang.annotation.RetentionPolicy.RUNTIME;
+
+import java.lang.annotation.Retention;
+import java.lang.annotation.Target;
+
+@Target({METHOD})
+@Retention(RUNTIME)
+public @interface UseLocalDisk {
+}
diff --git a/gerrit-acceptance-tests/src/test/java/com/google/gerrit/acceptance/git/AbstractPushForReview.java b/gerrit-acceptance-tests/src/test/java/com/google/gerrit/acceptance/git/AbstractPushForReview.java
new file mode 100644
index 0000000..a6ce132
--- /dev/null
+++ b/gerrit-acceptance-tests/src/test/java/com/google/gerrit/acceptance/git/AbstractPushForReview.java
@@ -0,0 +1,196 @@
+// 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.acceptance.git;
+
+import static com.google.gerrit.acceptance.git.GitUtil.cloneProject;
+import static com.google.gerrit.acceptance.git.GitUtil.createProject;
+import static com.google.gerrit.acceptance.git.GitUtil.initSsh;
+
+import com.google.gerrit.acceptance.AbstractDaemonTest;
+import com.google.gerrit.acceptance.AccountCreator;
+import com.google.gerrit.acceptance.SshSession;
+import com.google.gerrit.acceptance.TestAccount;
+import com.google.gerrit.reviewdb.client.Change;
+import com.google.gerrit.reviewdb.client.Project;
+import com.google.gerrit.reviewdb.server.ReviewDb;
+import com.google.gwtorm.server.OrmException;
+import com.google.gwtorm.server.SchemaFactory;
+import com.google.inject.Inject;
+
+import com.jcraft.jsch.JSchException;
+
+import org.eclipse.jgit.api.Git;
+import org.eclipse.jgit.api.errors.GitAPIException;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+
+import java.io.IOException;
+
+public abstract class AbstractPushForReview extends AbstractDaemonTest {
+  protected enum Protocol {
+    SSH, HTTP
+  }
+
+  @Inject
+  private AccountCreator accounts;
+
+  @Inject
+  private SchemaFactory<ReviewDb> reviewDbProvider;
+
+  private TestAccount admin;
+  private Project.NameKey project;
+  private Git git;
+  private ReviewDb db;
+  private String sshUrl;
+
+  @Before
+  public void setUp() throws Exception {
+    admin =
+        accounts.create("admin", "admin@example.com", "Administrator",
+            "Administrators");
+
+    project = new Project.NameKey("p");
+    initSsh(admin);
+    SshSession sshSession = new SshSession(server, admin);
+    createProject(sshSession, project.get());
+    sshUrl = sshSession.getUrl();
+    sshSession.close();
+
+    db = reviewDbProvider.open();
+  }
+
+  protected void selectProtocol(Protocol p) throws GitAPIException, IOException {
+    String url;
+    switch (p) {
+      case SSH:
+        url = sshUrl;
+        break;
+      case HTTP:
+        url = admin.getHttpUrl(server);
+        break;
+      default:
+        throw new IllegalArgumentException("unexpected protocol: " + p);
+    }
+    git = cloneProject(url + "/" + project.get());
+  }
+
+  @After
+  public void cleanup() {
+    db.close();
+  }
+
+  @Test
+  public void testPushForMaster() throws GitAPIException, OrmException,
+      IOException {
+    PushOneCommit.Result r = pushTo("refs/for/master");
+    r.assertOkStatus();
+    r.assertChange(Change.Status.NEW, null);
+  }
+
+  @Test
+  public void testPushForMasterWithTopic() throws GitAPIException,
+      OrmException, IOException {
+    // specify topic in ref
+    String topic = "my/topic";
+    PushOneCommit.Result r = pushTo("refs/for/master/" + topic);
+    r.assertOkStatus();
+    r.assertChange(Change.Status.NEW, topic);
+
+    // specify topic as option
+    r = pushTo("refs/for/master%topic=" + topic);
+    r.assertOkStatus();
+    r.assertChange(Change.Status.NEW, topic);
+  }
+
+  @Test
+  public void testPushForMasterWithCc() throws GitAPIException, OrmException,
+      IOException, JSchException {
+    // cc one user
+    TestAccount user = accounts.create("user", "user@example.com", "User");
+    String topic = "my/topic";
+    PushOneCommit.Result r = pushTo("refs/for/master/" + topic + "%cc=" + user.email);
+    r.assertOkStatus();
+    r.assertChange(Change.Status.NEW, topic);
+
+    // cc several users
+    TestAccount user2 =
+        accounts.create("another-user", "another.user@example.com", "Another User");
+    r = pushTo("refs/for/master/" + topic + "%cc=" + admin.email + ",cc="
+        + user.email + ",cc=" + user2.email);
+    r.assertOkStatus();
+    r.assertChange(Change.Status.NEW, topic);
+
+    // cc non-existing user
+    String nonExistingEmail = "non.existing@example.com";
+    r = pushTo("refs/for/master/" + topic + "%cc=" + admin.email + ",cc="
+        + nonExistingEmail + ",cc=" + user.email);
+    r.assertErrorStatus("user \"" + nonExistingEmail + "\" not found");
+  }
+
+  @Test
+  public void testPushForMasterWithReviewer() throws GitAPIException,
+      OrmException, IOException, JSchException {
+    // add one reviewer
+    TestAccount user = accounts.create("user", "user@example.com", "User");
+    String topic = "my/topic";
+    PushOneCommit.Result r = pushTo("refs/for/master/" + topic + "%r=" + user.email);
+    r.assertOkStatus();
+    r.assertChange(Change.Status.NEW, topic, user);
+
+    // add several reviewers
+    TestAccount user2 =
+        accounts.create("another-user", "another.user@example.com", "Another User");
+    r = pushTo("refs/for/master/" + topic + "%r=" + admin.email + ",r=" + user.email
+        + ",r=" + user2.email);
+    r.assertOkStatus();
+    // admin is the owner of the change and should not appear as reviewer
+    r.assertChange(Change.Status.NEW, topic, user, user2);
+
+    // add non-existing user as reviewer
+    String nonExistingEmail = "non.existing@example.com";
+    r = pushTo("refs/for/master/" + topic + "%r=" + admin.email + ",r="
+        + nonExistingEmail + ",r=" + user.email);
+    r.assertErrorStatus("user \"" + nonExistingEmail + "\" not found");
+  }
+
+  @Test
+  public void testPushForMasterAsDraft() throws GitAPIException, OrmException,
+      IOException {
+    // create draft by pushing to 'refs/drafts/'
+    PushOneCommit.Result r = pushTo("refs/drafts/master");
+    r.assertOkStatus();
+    r.assertChange(Change.Status.DRAFT, null);
+
+    // create draft by using 'draft' option
+    r = pushTo("refs/for/master%draft");
+    r.assertOkStatus();
+    r.assertChange(Change.Status.DRAFT, null);
+  }
+
+  @Test
+  public void testPushForNonExistingBranch() throws GitAPIException,
+      OrmException, IOException {
+    String branchName = "non-existing";
+    PushOneCommit.Result r = pushTo("refs/for/" + branchName);
+    r.assertErrorStatus("branch " + branchName + " not found");
+  }
+
+  private PushOneCommit.Result pushTo(String ref) throws GitAPIException,
+      IOException {
+    PushOneCommit push = new PushOneCommit(db, admin.getIdent());
+    return push.to(git, ref);
+  }
+}
diff --git a/gerrit-acceptance-tests/src/test/java/com/google/gerrit/acceptance/git/BUCK b/gerrit-acceptance-tests/src/test/java/com/google/gerrit/acceptance/git/BUCK
new file mode 100644
index 0000000..6014118
--- /dev/null
+++ b/gerrit-acceptance-tests/src/test/java/com/google/gerrit/acceptance/git/BUCK
@@ -0,0 +1,38 @@
+include_defs('//gerrit-acceptance-tests/tests.defs')
+
+acceptance_tests(
+  srcs = ['SubmitOnPushIT.java'],
+  deps = [':util'],
+)
+
+acceptance_tests(
+  srcs = ['HttpPushForReviewIT.java', 'SshPushForReviewIT.java'],
+  deps = [':push_for_review'],
+)
+
+java_library(
+  name = 'push_for_review',
+  srcs = ['AbstractPushForReview.java'],
+  deps = [
+    ':util',
+    '//gerrit-acceptance-tests:lib',
+  ],
+)
+
+java_library(
+  name = 'util',
+  srcs = [
+    'GitUtil.java',
+    'PushOneCommit.java',
+  ],
+  deps = [
+    '//gerrit-acceptance-tests:lib',
+    '//gerrit-reviewdb:server',
+    '//lib:guava',
+    '//lib:gwtorm',
+    '//lib:jsch',
+    '//lib/jgit:jgit',
+    '//lib:junit',
+  ],
+  visibility = ['//gerrit-acceptance-tests/...'],
+)
diff --git a/gerrit-acceptance-tests/src/test/java/com/google/gerrit/acceptance/git/GitUtil.java b/gerrit-acceptance-tests/src/test/java/com/google/gerrit/acceptance/git/GitUtil.java
index 045207c..c17598f 100644
--- a/gerrit-acceptance-tests/src/test/java/com/google/gerrit/acceptance/git/GitUtil.java
+++ b/gerrit-acceptance-tests/src/test/java/com/google/gerrit/acceptance/git/GitUtil.java
@@ -18,12 +18,14 @@
 import com.goo