From 85c6d50fd6d62eaddb90e1e8caa6f7bc2853a874 Mon Sep 17 00:00:00 2001 From: "Eric S. Raymond" Date: Wed, 25 Sep 2013 13:07:31 -0400 Subject: [PATCH] commiit_id() for hg, bzr, svn. Also, correct Morgan Greywolf's patch. --- NEWS | 1 + coverity-submit | 12 +++++++++--- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/NEWS b/NEWS index c98a8fa..2f2956c 100644 --- 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. diff --git a/coverity-submit b/coverity-submit index 56c3ffe..42218ab 100755 --- a/coverity-submit +++ b/coverity-submit @@ -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"): -- 2.43.0