Paste: clay, fix for version info

Author: elrood
Mode: patch
Date: Sun, 1 Aug 2010 08:12:32
Plain Text |
diff --git a/cmake/FindMercurial.cmake b/cmake/FindMercurial.cmake
--- a/cmake/FindMercurial.cmake
+++ b/cmake/FindMercurial.cmake
@@ -14,6 +14,9 @@
         "\\1" Mercurial_VERSION "${Mercurial_VERSION}")
 
     MACRO(Mercurial_WC_INFO dir prefix)
+        SET(Mercurial_TMP_LC_ALL "$ENV{LC_ALL}")
+        SET(ENV{LC_ALL} C)
+
         EXECUTE_PROCESS(COMMAND ${Mercurial_EXECUTABLE} log -l1 ${dir}
             OUTPUT_VARIABLE ${prefix}_WC_INFO
             ERROR_VARIABLE Mercurial_info_error
@@ -32,5 +35,19 @@
         ELSE()
             MESSAGE(SEND_ERROR "\"${Mercurial_EXECUTABLE} log -l1 ${dir}\" failed with output:\n${Mercurial_info_error}")
         ENDIF()
+
+        SET(ENV{LC_ALL} ${Mercurial_TMP_LC_ALL})
+    ENDMACRO()
+
+    MACRO(Mercurial_WC_ID dir prefix)
+        EXECUTE_PROCESS(COMMAND ${Mercurial_EXECUTABLE} id ${dir}
+            OUTPUT_VARIABLE ${prefix}_WC_ID
+            ERROR_VARIABLE Mercurial_id_error
+            RESULT_VARIABLE Mercurial_id_result
+            OUTPUT_STRIP_TRAILING_WHITESPACE)
+
+        IF(NOT Mercurial_id_result EQUAL 0)
+            MESSAGE(SEND_ERROR "\"${Mercurial_EXECUTABLE} id ${dir}\" failed with output:\n${Mercurial_id_error}")
+        ENDIF()
     ENDMACRO()
 ENDIF()
diff --git a/compiler/src/CMakeLists.txt b/compiler/src/CMakeLists.txt
--- a/compiler/src/CMakeLists.txt
+++ b/compiler/src/CMakeLists.txt
@@ -29,5 +29,5 @@
 endif()
 
 if(Mercurial_FOUND AND EXISTS "${PROJECT_SOURCE_DIR}/.hg")
-    Mercurial_WC_INFO(${PROJECT_SOURCE_DIR} HG)
+    Mercurial_WC_ID(${PROJECT_SOURCE_DIR} HG)
     set_property(SOURCE main.cpp APPEND PROPERTY
@@ -33,5 +33,5 @@
     set_property(SOURCE main.cpp APPEND PROPERTY
-        COMPILE_DEFINITIONS "HG_CHANGESET=\"${HG_WC_CHANGESET}\";HG_DATE=\"${HG_WC_DATE}\"")
+        COMPILE_DEFINITIONS "HG_ID=\"${HG_WC_ID}\"")
 endif()
 
 add_executable(clay ${SOURCES})
diff --git a/compiler/src/main.cpp b/compiler/src/main.cpp
--- a/compiler/src/main.cpp
+++ b/compiler/src/main.cpp
@@ -406,8 +406,8 @@
         }
         else if (strstr(argv[i], "-v") == argv[i]) {
             cerr << "clay compiler ("
-#ifdef HG_CHANGESET
-                 << "hg r" << HG_CHANGESET << ", "
+#ifdef HG_ID
+                 << "hg id " << HG_ID << ", "
 #endif
 #ifdef SVN_REVISION
                  << "llvm r" << SVN_REVISION << ", "

New Annotation

Summary:
Author:
Mode:
Body: