[PATCH] - perform hg id instead of hg tip

Darshaka Pathirana dpat at syn-net.org
Tue Apr 15 13:04:31 CEST 2008


diff -r d242af548735 -r a08d09f7caa9 owbuild/owbuild/OWGetMercurialRevision.cmake
--- a/owbuild/owbuild/OWGetMercurialRevision.cmake	Tue Apr 08 14:12:05 2008 +0200
+++ b/owbuild/owbuild/OWGetMercurialRevision.cmake	Fri Apr 11 21:50:35 2008 +0200
@@ -1,7 +1,7 @@
 # - ow_get_hg_revision(revision)
 # Gets current subversion revision number
 #
-# Performs a hg tip command line on ${CMAKE_SOURCE_DIR} directory
+# Performs a hg id command line on ${CMAKE_SOURCE_DIR} directory
 # You need to install the mercurial command line, check http://www.selenic.com/mercurial
 # if you don't have it already
 # ow_get_hg_revision() is being called by OWInitializationInfo.cmake that sets
@@ -27,16 +27,20 @@
 	endif (NOT MERCURIAL_FOUND)
 
 	
-	set(${revision} 0)
+	set(${output} 0)
 	if (MERCURIAL_HG_EXECUTABLE)
 		execute_process(
 			COMMAND
-				${MERCURIAL_HG_EXECUTABLE} tip --template "{node|short}"
-			OUTPUT_VARIABLE ${revision}
+				${MERCURIAL_HG_EXECUTABLE} id
+			OUTPUT_VARIABLE output
 		)
 
 	else (MERCURIAL_HG_EXECUTABLE)
 		message("Mercurial (hg) command line not found, it is recommended to install it")
 	endif (MERCURIAL_HG_EXECUTABLE)
 
+	STRING(REGEX REPLACE "\\+.*" "" rev "${output}")
+	STRING(REGEX REPLACE " +.*" "" rev "${rev}")
+	set(${revision} ${rev})
+
 endmacro (ow_get_hg_revision)



More information about the QuteCom-dev mailing list