[Bf-blender-cvs] [5f24004] master: Buildinfo: suppress error prints when building local branches

Sergey Sharybin noreply at git.blender.org
Fri Nov 29 13:44:54 CET 2013


Commit: 5f2400414acd5374a49ffc42cb50b5fe4275655b
Author: Sergey Sharybin
Date:   Fri Nov 29 18:19:42 2013 +0600
http://developer.blender.org/rB5f2400414acd5374a49ffc42cb50b5fe4275655b

Buildinfo: suppress error prints when building local branches

Before this console output contained messages about branch is not
configured to use any upstream branch which is not useful information
at all.

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

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

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

diff --git a/build_files/cmake/buildinfo.cmake b/build_files/cmake/buildinfo.cmake
index c31a7cf..fc5cb01 100644
--- a/build_files/cmake/buildinfo.cmake
+++ b/build_files/cmake/buildinfo.cmake
@@ -17,7 +17,8 @@ if(EXISTS ${SOURCE_DIR}/.git)
 		execute_process(COMMAND git rev-parse --short @{u}
 		                WORKING_DIRECTORY ${SOURCE_DIR}
 		                OUTPUT_VARIABLE MY_WC_HASH
-		                OUTPUT_STRIP_TRAILING_WHITESPACE)
+		                OUTPUT_STRIP_TRAILING_WHITESPACE
+		                ERROR_QUIET)
 
 		if (MY_WC_HASH STREQUAL "")
 			# Local branch, not set to upstream.
@@ -25,7 +26,7 @@ if(EXISTS ${SOURCE_DIR}/.git)
 			execute_process(COMMAND git rev-parse --short HEAD
 			                WORKING_DIRECTORY ${SOURCE_DIR}
 			                OUTPUT_VARIABLE MY_WC_HASH
-		        	        OUTPUT_STRIP_TRAILING_WHITESPACE)
+			                OUTPUT_STRIP_TRAILING_WHITESPACE)
 		endif()
 
 		execute_process(COMMAND git rev-parse --abbrev-ref HEAD
@@ -55,7 +56,8 @@ if(EXISTS ${SOURCE_DIR}/.git)
 			execute_process(COMMAND git log @{u}..
 			                WORKING_DIRECTORY ${SOURCE_DIR}
 			                OUTPUT_VARIABLE _git_unpushed_log
-			                OUTPUT_STRIP_TRAILING_WHITESPACE)
+			                OUTPUT_STRIP_TRAILING_WHITESPACE
+			                ERROR_QUIET)
 			if(NOT _git_unpushed_log STREQUAL "")
 				set(MY_WC_BRANCH "${MY_WC_BRANCH} (modified)")
 			endif()
diff --git a/build_files/scons/tools/Blender.py b/build_files/scons/tools/Blender.py
index 0f02502..d9c2edf 100644
--- a/build_files/scons/tools/Blender.py
+++ b/build_files/scons/tools/Blender.py
@@ -419,11 +419,18 @@ def buildinfo(lenv, build_type):
             build_commit_timestamp = '0'
             build_branch = 'unknown'
         else:
-            build_hash = os.popen('git rev-parse --short @{u}').read().strip()
+            import subprocess
+            no_upstream = False
+
+            process = subprocess.Popen(['git', 'rev-parse', '--short', '@{u}'],
+                                        stdout=subprocess.PIPE, stderr=subprocess.PIPE)
+            build_hash, stderr = process.communicate()
+
             build_branch = os.popen('git rev-parse --abbrev-ref HEAD').read().strip()
 
             if build_hash == '':
                 build_hash = os.popen('git rev-parse --short HEAD').read().strip()
+                no_upstream = True
 
             # ## Check for local modifications
             has_local_changes = False
@@ -434,7 +441,7 @@ def buildinfo(lenv, build_type):
 
             if changed_files:
                 has_local_changes = True
-            else:
+            elif no_upstream == False:
                 unpushed_log = os.popen('git log @{u}..').read().strip()
                 has_local_changes = unpushed_log != ''




More information about the Bf-blender-cvs mailing list