On Sun, Apr 01, 2018 at 10:46:14AM -0700, Eliot Miranda wrote:
Hi Alistair,
_,,,^..^,,,_ (phone)
On Mar 31, 2018, at 1:42 PM, Alistair Grant <akgrant0710@gmail.com> wrote:
git doesn't provide a substitution mechanism like sccs, but the script we have that embeds the date can just as easily embed the hash. In .git_filters/RevDateURL.smudge there's a line that retrieves the commit date from git:
$date = `git log --format=%ad -1`;
to get the (short) hash we can simply add:
$shorthash = `git log --format=%h -1`;
The string substitution can then proceed as for the date.
I think it would be worthwhile having both the date and hash in the --version info.
I'm happy to add this in and update the --version output if there's general agreement.
Yes please!!! The conventional alternative is to invoke git log from the makefiles and lass in the commit hash as a compiler-line default me. But this is messy and slows down compilation (unless there is a special rule for just one file, and that's fragile). I much prefer having the commit somewhere in source.
Done: $ git log --oneline | head 5a5b1c7 vm version string: add commit short hash 4c4686e Skip SUnit testing in Sista builds 79c0809 Merge pull request #230 from smalltalking/Cog 804ed5c Fixed typo in the download URL $ products/cogspur64linuxht/pharo --version 5.0-201804012008-version_hash Sun Apr 1 22:15:07 CEST 2018 gcc 5.4.0 [Production Spur 64-bit VM] CoInterpreter VMMaker.oscog-eem.2361 uuid: 7ca2f89a-de70-422f-b92b-54f91ac4e47b Apr 1 2018 StackToRegisterMappingCogit VMMaker.oscog-eem.2361 uuid: 7ca2f89a-de70-422f-b92b-54f91ac4e47b Apr 1 2018 VM: 201804012008-version_hash alistair@4c0a4b2bdb79:vmmaker/opensmalltalk-vm $ Date: Sun Apr 1 22:08:11 2018 +0200 $ Hash: 5a5b1c7 $ Plugins: 201804012008-version_hash alistair@4c0a4b2bdb79:vmmaker/opensmalltalk-vm $ Linux 4c0a4b2bdb79 4.13.0-37-generic #42~16.04.1-Ubuntu SMP Wed Mar 7 16:03:28 UTC 2018 x86_64 x86_64 x86_64 GNU/Linux plugin path: products/cogspur64linuxht/lib/pharo/5.0-201804012008-version_hash [default: /home/alistair/vmmaker/opensmalltalk-vm/products/cogspur64linuxht/lib/pharo/5.0-201804012008-version_hash/] As expected, the hash is also included in: - the VirtualMachine object (in Pharo, and the equivalent in squeak) - crash.dmp - kill -USR1 output https://github.com/OpenSmalltalk/opensmalltalk-vm/pull/233 if anyone wants to take a look.
If you do go ahead with this also consider modifying the makefiles to ensure that updateSCCSVersions has been run at least once before the bulk of the build is done.
I'll think about this separately. updateSCCSVersions is quite slow to execute on Windows in a VM, and I think there are other proposed changes waiting to be reviewed. Cheers, Alistair