[m-rev.] for review: record the git revision the Mercury compiler was compiled with

Sebastian Godelet sebastian.godelet at outlook.com
Fri Apr 17 13:33:58 AEST 2015


Hi Julien,

On 17/04/2015 09:44, Julien Fischer wrote:
>
> Hi Sebastian,
>
> On Sat, 4 Apr 2015, Sebastian Godelet wrote:
>
>> Hi,
>>
>> I think this functionality would be nice to have as I've seen it
>> already in some other tools which are configured and build from git
>> repositories.
>
> Is it all that useful?  For my current workspace (on the master branch),
> 'git describe --tags' gives:
I think it is useful sometimes, for example several month ago there was 
a rather involved rebuilding step required (something like 3 steps), and
I'd to remember if I already build after a certain date (with the 
correct commit compiled in).
Maybe my work-flow is a little bit different since I'm working only on a 
fork with specific branches for not yet submitted/unmerged patches, but 
sometimes it is helpful to check which exact revision the compiler is 
build with, especially after not having recompiled for some time.
Having a git commit number helps when looking into the git graph log.
>
>      version-14_01_1-493-g9acc9db
Actually that does seem confusing. I think that comes from merging the
git tagged version branches, and then 493 following commits.
Maybe it would be better to use `git rev-parse --short HEAD`,
yielding g9acc9db only.

An alternative could then be:
Mercury Compiler, version DEV-g9acc9db, on i686-pc-mingw32
>
> I don't find that information all that useful.  In fact, it's a bit
> confusing because the tag mentioned is version-14_01_1, even though
> this is the master branch.
>
>> --
>>
>> Record the git revision the Mercury compiler was compiled with
>>
>> It can be useful to check the git revision from which the Mercury
>> compiler was compiled from.
>>
>> compiler/handle_options.m:
>>    In display_compiler_version/2 write out the git revision the
>>    compiler was compiled from.
>
> If we are displaying this information, then it should be displayed
> everywhere that prints out the version information.  In addition
> to the above that also means in:
>
>      profiler/mercury_profile.m
>      slice/mcov.m
>      trace/mercury_trace_internal.c
>
>> configure.ac:
>>    define GIT_REVISION macro and collect git describe output,
>
> s/define/Define/
>
>>    also define MR_GIT_REVISION in lieu of MR_VERSION.
>
> "in lieu" means "in place of", I think you mean "in addition to"
> there.
Oh yes, you are right. I haven't used English for quite a while now.
>
>> library/library.m:
>>    Move version/2 to version/3 and also output the git revision of the
>>    compiler. Make version/2 a wrapper for version/3 by ignoring the
>>    git revision output.
>>
>> java/runtime/Constants.java.in:
>> library/erlang_conf.hrl.in:
>> runtime/mercury_conf.h.in:
>> runtime/mercury_dotnet.cs.in:
>>    Add the grade specific MR_GIT_REVISION constant.
>
> How is it grade specific?
I mean the specific constant used for each different backend (Java, 
Erlang, C#, C). Sorry to use the grade term in a vague way.
>
> ...
>
>> diff --git a/configure.ac b/configure.ac
>> index b11f4b1..d21c243 100644
>> --- a/configure.ac
>> +++ b/configure.ac
>> @@ -189,6 +189,16 @@ AC_CANONICAL_HOST
>> FULLARCH="$host"
>> AC_SUBST(FULLARCH)
>> AC_DEFINE_UNQUOTED(MR_FULLARCH, "$FULLARCH")
>> +AC_MSG_CHECKING([git revision])
>> +GIT_REVISION=$(git describe --tags 2>/dev/null)
>> +if test -z "$GIT_REVISION"; then
>> +  AC_MSG_RESULT([no])
>> +  GIT_REVISION="unknown"
>> +else
>> +  AC_MSG_RESULT([$GIT_REVISION])
>> +fi
>> +AC_SUBST(GIT_VESION)
>
> s/GIT_VESION/GIT_REVISION/.
Thanks for catching this, I did a rename but have missed this.
>
>> +AC_DEFINE_UNQUOTED(MR_GIT_REVISION, "$GIT_REVISION")
>> . ./VERSION
>> AC_DEFINE_UNQUOTED(MR_VERSION, "$VERSION")
>> if test "$prefix" = "NONE"; then
>> @@ -268,6 +278,7 @@ AC_SUBST(CYGPATHU)
>> PREFIX="`$CYGPATH $PREFIX`"
>> LIBDIR="`$CYGPATH $PREFIX/lib/mercury`"
>> NONSHARED_LIB_DIR=${MERCURY_NONSHARED_LIB_DIR=$PREFIX/lib/nonshared}
>> +AC_SUBST(GIT_REVISION)
>> AC_SUBST(VERSION)
>> AC_SUBST(PREFIX)
>> AC_SUBST(NONSHARED_LIB_DIR)
>
> ...
>
>> diff --git a/runtime/mercury_conf.h.in b/runtime/mercury_conf.h.in
>> index d70d1e5..9796b1d 100644
>> --- a/runtime/mercury_conf.h.in
>> +++ b/runtime/mercury_conf.h.in
>> @@ -497,6 +497,11 @@
>> #define MR_FULLARCH "unknown"
>>
>> /*
>> +** Which git revision is used to build Mercury?
>
> s/is/was/
>
> Cheers,
> Julien.



More information about the reviews mailing list