[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

[tor-commits] [metrics-lib/master] Write build revision to index.json files.



commit 02ad9fcde0d48cdab7c8128b1193d5740ea97a99
Author: iwakeh <iwakeh@xxxxxxxxxxxxxx>
Date:   Fri Sep 15 14:07:07 2017 +0000

    Write build revision to index.json files.
    
    Implements part of task-21414.
    Adapt IndexNode to supply a revision.
---
 CHANGELOG.md                                       |  7 ++++++
 src/build                                          |  2 +-
 .../org/torproject/descriptor/index/IndexNode.java | 26 +++++++++++++++++-----
 3 files changed, 28 insertions(+), 7 deletions(-)

diff --git a/CHANGELOG.md b/CHANGELOG.md
index 2c40c10..b7021d8 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,3 +1,10 @@
+# Changes in version 2.?.? - 2017-??-??
+
+ * Medium changes
+   - Add new optional "build_revision" field to index.json with the
+     Git revision supplied by the calling software.
+
+
 # Changes in version 2.1.0 - 2017-09-15
 
  * Major changes
diff --git a/src/build b/src/build
index a64b94a..78e533f 160000
--- a/src/build
+++ b/src/build
@@ -1 +1 @@
-Subproject commit a64b94a635e5396266d5c5b5cf88850b9f4b6a24
+Subproject commit 78e533fdc84e20769a8a155d1426cbea59c6e7cc
diff --git a/src/main/java/org/torproject/descriptor/index/IndexNode.java b/src/main/java/org/torproject/descriptor/index/IndexNode.java
index 516bbdf..8b61b75 100644
--- a/src/main/java/org/torproject/descriptor/index/IndexNode.java
+++ b/src/main/java/org/torproject/descriptor/index/IndexNode.java
@@ -46,6 +46,11 @@ public class IndexNode {
   @SerializedName("index_created")
   public final String created;
 
+  /** The software's build revision JSON as 'build_revision' field. */
+  @Expose
+  @SerializedName("build_revision")
+  public final String revision;
+
   /** Path (i.e. base url) is exposed in JSON. */
   @Expose
   public final String path;
@@ -60,20 +65,29 @@ public class IndexNode {
 
   /* Added to satisfy Gson. */
   private IndexNode() {
-    created = null;
-    path = null;
-    files = null;
-    directories = null;
+    this.created = null;
+    this.revision = null;
+    this.path = null;
+    this.files = null;
+    this.directories = null;
   }
 
-  /** An index node is the top-level node in the JSON structure. */
+  /** For backwards compatibility and testing. */
   public IndexNode(String created, String path,
             SortedSet<FileNode> files,
             SortedSet<DirectoryNode> directories) {
+    this(created, null, path, files, directories);
+  }
+
+  /** An index node is the top-level node in the JSON structure. */
+  public IndexNode(String created, String revision, String path,
+            SortedSet<FileNode> files,
+            SortedSet<DirectoryNode> directories) {
+    this.created = created;
+    this.revision = revision;
     this.path = path;
     this.files = files;
     this.directories = directories;
-    this.created = created;
   }
 
   /**

_______________________________________________
tor-commits mailing list
tor-commits@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits