Add custom stamp to add its-base revision to version number

Change-Id: I87bacf25e25e58ee4c648963912056726cd297dc
diff --git a/tools/ b/tools/
new file mode 100644
index 0000000..fea9351
--- /dev/null
+++ b/tools/
@@ -0,0 +1,30 @@
+import os
+import sys
+# As this plugin is typically only sym-linked into a gerrit checkout and both os.getcwd and
+# os.path.abspath follow symbolic links, they would not allow us to find the gerrit root
+# directory. So we have to resort to the PWD environment variable to find the place we're
+# symlinked to.
+# We append __file__ to avoid having to require to run it from a well-know directory.
+ABS_FILE_PARTS = os.path.join(os.getenv('PWD'), __file__).split(os.sep)
+GERRIT_ROOT = os.sep.join(ABS_FILE_PARTS[:-4])
+sys.path = [os.sep.join([GERRIT_ROOT, 'tools'])] + sys.path
+from workspace_status_release import revision
+def get_plugin_revision(name):
+    os.chdir(os.path.join(GERRIT_ROOT, 'plugins', name))
+    ret=revision(GERRIT_VERSION)
+    return ret