[Bf-blender-cvs] [50fbebe0] master: Buildinfo fixes

Sergey Sharybin noreply at git.blender.org
Tue Nov 19 17:22:29 CET 2013


Commit: 50fbebe0a443d10b3b5525c9a7e152acc32b4527
Author: Sergey Sharybin
Date:   Tue Nov 19 22:01:43 2013 +0600
http://developer.blender.org/rB50fbebe0a443d10b3b5525c9a7e152acc32b4527

Buildinfo fixes

- Use -M suffix if working tree does have uncommitted
  modifications.
- Local commits are considered local changes as well

===================================================================

M	CMakeLists.txt
M	build_files/cmake/buildinfo.cmake
M	build_files/scons/tools/Blender.py

===================================================================

diff --git a/CMakeLists.txt b/CMakeLists.txt
index d3a4d65..d96c41b 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -1,3 +1,4 @@
+
 # ***** BEGIN GPL LICENSE BLOCK *****
 #
 # This program is free software; you can redistribute it and/or
diff --git a/build_files/cmake/buildinfo.cmake b/build_files/cmake/buildinfo.cmake
index 3893866..2cc92df 100644
--- a/build_files/cmake/buildinfo.cmake
+++ b/build_files/cmake/buildinfo.cmake
@@ -22,12 +22,6 @@ if(EXISTS ${SOURCE_DIR}/.git/)
 		                OUTPUT_VARIABLE MY_WC_BRANCH
 		                OUTPUT_STRIP_TRAILING_WHITESPACE)
 
-		# Get latest version tag
-		execute_process(COMMAND git describe --match "v[0-9]*" --abbrev=0
-		                WORKING_DIRECTORY ${SOURCE_DIR}
-		                OUTPUT_VARIABLE _git_latest_version_tag
-		                OUTPUT_STRIP_TRAILING_WHITESPACE)
-
 		execute_process(COMMAND git log -1 --format=%ct
 		                WORKING_DIRECTORY ${SOURCE_DIR}
 		                OUTPUT_VARIABLE MY_WC_COMMIT_TIMESTAMP
@@ -44,11 +38,20 @@ if(EXISTS ${SOURCE_DIR}/.git/)
 		                OUTPUT_STRIP_TRAILING_WHITESPACE)
 
 		if(NOT _git_changed_files STREQUAL "")
-			set(MY_WC_CHANGE "${MY_WC_CHANGE}M")
+			set(MY_WC_BRANCH "${MY_WC_BRANCH} (modified)")
+		else()
+			# Unpushed commits are also considered local odifications
+			execute_process(COMMAND git log @{u}..
+			                WORKING_DIRECTORY ${SOURCE_DIR}
+			                OUTPUT_VARIABLE _git_unpushed_log
+			                OUTPUT_STRIP_TRAILING_WHITESPACE)
+			if(NOT _git_unpushed_log STREQUAL "")
+				set(MY_WC_BRANCH "${MY_WC_BRANCH} (modified)")
+			endif()
+			unset(_git_unpushed_log)
 		endif()
 
 		unset(_git_changed_files)
-		unset(_git_latest_version_tag)
 	endif()
 endif()
 
diff --git a/build_files/scons/tools/Blender.py b/build_files/scons/tools/Blender.py
index e750ce0..894c8db 100644
--- a/build_files/scons/tools/Blender.py
+++ b/build_files/scons/tools/Blender.py
@@ -421,6 +421,22 @@ def buildinfo(lenv, build_type):
         else:
             build_hash = os.popen('git rev-parse --short HEAD').read().strip()
             build_branch = os.popen('git rev-parse --abbrev-ref HEAD').read().strip()
+
+            # ## Check for local modifications
+            has_local_changes = False
+
+            # Update GIT index before getting dirty files
+            os.system('git update-index -q --refresh')
+            changed_files = os.popen('git diff-index --name-only HEAD --').read().strip()
+
+            if changed_files:
+                has_local_changes = True
+            else:
+                unpushed_log = os.popen('git log @{u}..').read().strip()
+                has_local_changes = unpushed_log != ''
+
+            if has_local_changes:
+                build_branch += ' (modified)'
     else:
         build_hash = 'unknown'
         build_commit_timestamp = '0'




More information about the Bf-blender-cvs mailing list