Add a basic consistency checker for changes
In the past, Gerrit bugs, lack of transactions, and unreliable NoSQL
backends have at various times produced a bewildering variety of
corrupt states. Similarly, we are not immune from bugs being
introduced in the future.
Add a tool to detect and explain some of these possible states.
Change-Id: Ia91b35b140bf05254877f413003d12cf779b775c
diff --git a/Documentation/rest-api-changes.txt b/Documentation/rest-api-changes.txt
index 584c661..bb9bb3a 100644
--- a/Documentation/rest-api-changes.txt
+++ b/Documentation/rest-api-changes.txt
@@ -1134,6 +1134,52 @@
HTTP/1.1 204 No Content
----
+[[check-change]]
+=== Check change
+--
+'GET /changes/link:#change-id[\{change-id\}]/check'
+--
+
+Performs consistency checks on the change, and returns a
+link:#check-result[CheckResult] entity.
+
+.Request
+----
+ GET /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/check HTTP/1.0
+----
+
+.Response
+----
+ HTTP/1.1 200 OK
+ Content-Disposition: attachment
+ Content-Type: application/json;charset=UTF-8
+
+ )]}'
+ {
+ "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,
+ "insertions": 34,
+ "deletions": 101,
+ "_sortkey": "0023412400000f7d",
+ "_number": 3965,
+ "owner": {
+ "name": "John Doe"
+ }
+ },
+ "messages": [
+ "Current patch set 1 not found"
+ ]
+ }
+----
+
[[edit-endpoints]]
== Change Edit Endpoints
@@ -3861,6 +3907,24 @@
|`restore_path`|optional|Path to file to restore.
|===========================
+[[check-result]]
+=== CheckResult
+The `CheckResult` entity contains the results of a consistency check on
+a change.
+
+[options="header",cols="1,6"]
+|===========================
+|Field Name|Description
+|`change`|
+link:#change-info[ChangeInfo] entity containing information about the change,
+as in link:#get-change[Get Change] with no options. Some fields not marked
+optional may be missing if a consistency check failed, but at least
+`id`, `project`, `branch`, and `_number` will be present.
+|`messages`|
+List of messages describing potential problems with the change. May be
+empty if no problems were found.
+|===========================
+
GERRIT
------
Part of link:index.html[Gerrit Code Review]