From f88947974829e27af7bc6361652b69f3eb4d72cd Mon Sep 17 00:00:00 2001 From: Josh Berdine Date: Mon, 10 Oct 2016 04:08:19 -0700 Subject: [PATCH] [buck] Add --version-vcs option Reviewed By: jvillard Differential Revision: D3993889 fbshipit-source-id: c4d61a3 --- infer/src/base/Config.ml | 8 ++++++++ infer/src/base/Version.mli | 1 + 2 files changed, 9 insertions(+) diff --git a/infer/src/base/Config.ml b/infer/src/base/Config.ml index 26e1e96c8..37d0c94bc 100644 --- a/infer/src/base/Config.ml +++ b/infer/src/base/Config.ml @@ -1142,6 +1142,10 @@ and version_json = ~exes:CLOpt.[Analyze;Clang;Java;Print] "Print version json formatted" +and version_vcs = + CLOpt.mk_bool ~long:"version-vcs" + ~exes:CLOpt.[Analyze;Clang;Java;Print] "Print version control system commit and exit" + and whole_seconds = CLOpt.mk_bool ~deprecated:["whole_seconds"] ~long:"whole-seconds" "Print whole seconds only" @@ -1258,6 +1262,10 @@ let post_parsing_initialization () = F.fprintf F.std_formatter "%s@." Version.versionJson ; exit 0 ); + if !version_vcs then ( + F.fprintf F.std_formatter "%s@." Version.commit ; + exit 0 + ); let set_minor_heap_size nMb = (* increase the minor heap size to speed up gc *) let ctrl = Gc.get () in diff --git a/infer/src/base/Version.mli b/infer/src/base/Version.mli index 35b421ad4..4e3f31424 100644 --- a/infer/src/base/Version.mli +++ b/infer/src/base/Version.mli @@ -9,5 +9,6 @@ open! Utils +val commit : string val versionString : string val versionJson : string