]> thyrsus.com Git - coverity-submit.git/commitdiff
A useful default for the -b option.
authorEric S. Raymond <esr@thyrsus.com>
Wed, 25 Sep 2013 11:27:55 +0000 (07:27 -0400)
committerEric S. Raymond <esr@thyrsus.com>
Wed, 25 Sep 2013 11:27:55 +0000 (07:27 -0400)
NEWS
coverity-submit
coverity-submit.xml

diff --git a/NEWS b/NEWS
index 030b73a9715bed65a6323978668c6268bed7d8f3..0675c0bb34e4b8a51490e33e28c3fbaa0f1b4e21 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -2,6 +2,7 @@
 
 1.10 @
     The -t option dow defaults to a build timestamp.
+    In a git repo, the -b option now defaults to `git describe HEAD`.
 
 1.9 @ 2013-05-23
     The -v option now preserves the build log for diagnostic purposes.
index b6e1ed2bf9a8c3f019f2770ff2c6d52b283e64ab..b8597f4fa8907d7272e3ffbf2b8658beffc2b623 100755 (executable)
@@ -4,10 +4,18 @@
 #
 # By Eric S. Raymond, May 2012.  BSD terms apply.
 #
-import os, sys, ConfigParser, getopt, tempfile, shutil, datetime
+import os, sys, ConfigParser, getopt, tempfile, shutil, datetime, commands
 
 version = "1.9"
 
+def commit_id():
+    "If we're in a repository directory, try to extract a commit description."
+    if os.path.exists(".git"):
+        (status, output) = commands.getstatusoutput("git describe HEAD")
+    if status == 0:
+        return output
+    return None
+
 if __name__ == '__main__':
     name = email = project = token = url = None
 
@@ -37,7 +45,7 @@ if __name__ == '__main__':
     # Deduce what project and directory to operate on (and go there).
     noexec = False
     verbose = False
-    build_version = None
+    build_version = commit_id()
     description = datetime.datetime.now().isoformat()
     (opts, args) = getopt.getopt(sys.argv[1:], "b:nt:v")
     for (opt, arg) in opts:
index e83e3686cac8eec91a37e49c92006a3f8261465d..6ede095c3b1c182c403f7451c0cec9858f611ec1 100644 (file)
@@ -120,7 +120,10 @@ build-log.txt from the run to your working directory.</para>
 
 <para>The <option>-b</option> option specifies an arbitrary build
 version to associate with the submission. A repository commit level
-would be a good thing to use for this.</para>
+would be a good thing to use for this. If coverity-submit is run 
+at the top level of a version-control repository, the build version may 
+default to a description of the head commit; presently this feature
+is supported for git only.</para>
 
 <para>The <option>-t</option> option specifies an arbitrary project
 tag or description to associate with the submission. This text is