# HG changeset patch
# User Matteo Facchinetti
# Date 1314285764 -7200
# Node ID f3cec8694f653dfe75fa21ab31928ca46ea17aa3
# Parent  569e7d9e2406550e2756ed724a9232148c2709ab
Add automatic HG changeset id information in "-v" param

diff -r 569e7d9e2406 -r f3cec8694f65 Makefile.am
--- a/Makefile.am	Thu Aug 25 08:56:28 2011 +0200
+++ b/Makefile.am	Thu Aug 25 17:22:44 2011 +0200
@@ -6,6 +6,9 @@
 
 ACLOCAL_AMFLAGS=-I config
 
+HGVERSION= $(shell hg -R $(top_srcdir) parents --template '{node|short}' 2> /dev/null || grep node $(top_srcdir)/.hg_archival.txt 2> /dev/null || true )
+AM_CXXFLAGS += -DHGVERSION="\"${HGVERSION}\""
+
 iec2c_LDADD = stage1_2/libstage1_2.a \
 	stage3/libstage3.a \
 	stage4/generate_c/libstage4_c.a \
diff -r 569e7d9e2406 -r f3cec8694f65 Makefile.in
--- a/Makefile.in	Thu Aug 25 08:56:28 2011 +0200
+++ b/Makefile.in	Thu Aug 25 17:22:44 2011 +0200
@@ -220,9 +220,11 @@
 top_build_prefix = @top_build_prefix@
 top_builddir = @top_builddir@
 top_srcdir = @top_srcdir@
-AM_CXXFLAGS = -g -Wall -Wpointer-arith -Wwrite-strings -Wno-unused 
+AM_CXXFLAGS = -g -Wall -Wpointer-arith -Wwrite-strings -Wno-unused \
+	-DHGVERSION="\"${HGVERSION}\""
 SUBDIRS = absyntax absyntax_utils stage1_2 stage3 stage4 
 ACLOCAL_AMFLAGS = -I config
+HGVERSION = $(shell hg -R $(top_srcdir) parents --template '{node|short}' 2> /dev/null || grep node $(top_srcdir)/.hg_archival.txt 2> /dev/null || true )
 iec2c_LDADD = stage1_2/libstage1_2.a \
 	stage3/libstage3.a \
 	stage4/generate_c/libstage4_c.a \
diff -r 569e7d9e2406 -r f3cec8694f65 main.cc
--- a/main.cc	Thu Aug 25 08:56:28 2011 +0200
+++ b/main.cc	Thu Aug 25 17:22:44 2011 +0200
@@ -135,7 +135,8 @@
       printusage(argv[0]);
       return 0;
     case 'v':
-      fprintf(stdout, "%s version %s\n", PACKAGE_NAME, PACKAGE_VERSION);      
+      fprintf(stdout, "%s version %s\n"
+		      "changeset id: %s\n", PACKAGE_NAME, PACKAGE_VERSION, HGVERSION);      
       return 0;        
     case 'f':
       stage1_2_options.full_token_loc = true;