]> thyrsus.com Git - coverity-submit.git/commitdiff
commiit_id() for hg, bzr, svn. Also, correct Morgan Greywolf's patch.
authorEric S. Raymond <esr@thyrsus.com>
Wed, 25 Sep 2013 17:07:31 +0000 (13:07 -0400)
committerEric S. Raymond <esr@thyrsus.com>
Wed, 25 Sep 2013 17:07:31 +0000 (13:07 -0400)
NEWS
coverity-submit

diff --git a/NEWS b/NEWS
index c98a8fa108991bfc0c6951bc5a9b79ae2f95ae50..2f2956c283981ca179be5a5992efd27833448817 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -2,6 +2,7 @@
 
 Repository head:
     Sane defaults for name and userid (patch by Morgan Greywolf).
+    The -b option now has a smart default for hg, bzr, and svn. 
 
 1.10 @ 2013-09-25
     The -t option now defaults to a build timestamp.
index 56c3ffe7cd01573a7d866747a9e458770d9c6efc..42218ab2c84d267064c423cdf12c565a80c43000 100755 (executable)
@@ -10,8 +10,14 @@ version = "1.10"
 
 def commit_id():
     "If we're in a repository directory, try to extract a commit description."
-    if os.path.exists(".git"):
+    if os.system("git rev-parse HEAD >/dev/null 2>&1") == 0:
         (status, output) = commands.getstatusoutput("git describe HEAD")
+    elif os.system("hg root >/dev/null 2>&1") == 0:
+        (status, output) = commands.getstatusoutput("hg --id")
+    elif os.system("bzr root >/dev/null 2>&1") == 0:
+        (status, output) = commands.getstatusoutput("bzr version-info --custom --template='{revision_id}\n'")
+    elif os.system("svn info >/dev/null 2>&1") == 0:
+        (status, output) = commands.getstatusoutput("svnversion")
     if status == 0:
         return output
     return None
@@ -51,9 +57,9 @@ if __name__ == '__main__':
     if not "ALL" in config.sections():
         config.add_section("ALL")
     if not config.has_option("ALL", "name"):
-        config.set("ALL", "name") = deduce_name()
+        config.set("ALL", "name", deduce_name())
     if not config.has_option("ALL", "userid"):
-        config.set("ALL", "userid") = deduce_userid()
+        config.set("ALL", "userid", deduce_userid())
     name = config.get("ALL", "name")
     userid = config.get("ALL", "userid")
     if config.has_option("ALL", "tools"):