Why no "hg id --template..." ?

Marcin Kasperski Marcin.Kasperski at softax.com.pl
Mon Mar 31 03:14:20 CDT 2008


> As Matt already wrote, you can use `hg log -r .' to get revision data
> for the working directory.

Thanks, this is what I looked for, for some reason I missed this.
Maybe it would make sense to mention in helps somewhere (neither hg
help log, nor hg help id mention such possibility).

PS I found another possibility, which is slightly better for me as it
automatically updates version information even if I do not run any
build script (= I can run different commands/scripts from the
directory).

(.hg/hgrc)

[hooks]
update.version = `hg root`/.hg/update_version_info.sh $HG_PARENT1 $HG_PARENT2
commit.version = `hg root`/.hg/update_version_info.sh $HG_NODE

(.hg/update_version_info.sh)

#!/bin/bash

if [ -n "$2" ]
then
    echo "Merge - skipping VersionInfo.py rebuild"
    exit 0
fi

echo "Rebuilding VersionInfo.py (rev $1)"
hg log -r $1 --template "# File generated by update_version_info.sh\nREVISION='{node|short}'\nDATE='{date|shortdate}'\n" > `hg root`/VersionInfo.py


-- 
----------------------------------------------------------------------
| Marcin Kasperski   |    You have the right to accept your
| http://mekk.waw.pl | responsibilites instead of having them
|                    |         assigned to you. (Beck)
----------------------------------------------------------------------



More information about the Mercurial mailing list