Add a python command to output git revision info.

This command outputs the git revision of the current
codec_runner_intel_gen package (based on the tags it was uploaded with).
This is useful when creating commit messages of rolls.

Change-Id: I211fe7ec42b871b83a5d4fd728cecbf2bf0a5574
diff --git a/fuchsia/current_revision.py b/fuchsia/current_revision.py
new file mode 100644
index 0000000..f66775e
--- /dev/null
+++ b/fuchsia/current_revision.py
@@ -0,0 +1,39 @@
+#!/usr/bin/env python3.8
+# Copyright 2022 The Fuchsia Authors. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+# Print information about what git revisions the currently downloaded jiri
+# package was built from.
+import subprocess
+import tempfile
+import json
+import os
+
+dir_path = os.path.dirname(os.path.realpath(__file__))
+
+fuchsia_root = os.path.abspath(os.path.join(dir_path, "../../../../"))
+cipd_path = os.path.join(fuchsia_root, ".jiri_root/bin/cipd")
+
+package_name = "fuchsia/third_party/intel/media-driver/codec_runner_intel_gen-debug-x64"
+version = subprocess.check_output(
+    [
+        "jiri", "manifest", "-element=" + package_name,
+        '-template="{{.Version}}"',
+        os.path.join(fuchsia_root, "integration/fuchsia/prebuilts")
+    ]).strip().strip(b'"')
+
+with tempfile.NamedTemporaryFile() as temp_file:
+    tag_output = subprocess.check_output(
+        [
+            cipd_path, "describe", package_name, "-version", version,
+            "-json-output", temp_file.name
+        ])
+
+    tagjson = json.load(temp_file)
+    tags = tagjson["result"]["tags"]
+    for result in tags:
+        tagvalue = result["tag"]
+        if "git_revision" not in tagvalue:
+            continue
+        print(tagvalue)