From f217db38f148f249beade7d254500517f2c33e39 Mon Sep 17 00:00:00 2001 From: SoftCoder Date: Fri, 29 Nov 2013 13:13:30 -0800 Subject: [PATCH] - changed to git version stamp --- CMakeLists.txt | 80 ++++++++----------- source/glest_game/CMakeLists.txt | 4 +- source/glest_game/facilities/game_util.cpp | 36 ++++----- source/glest_game/facilities/game_util.h | 6 +- source/glest_game/game/game.cpp | 2 +- source/glest_game/main/main.cpp | 4 +- .../menu/menu_state_custom_game.cpp | 6 +- source/glest_game/menu/menu_state_root.cpp | 4 +- .../glest_game/network/client_interface.cpp | 10 +-- source/glest_game/network/connection_slot.cpp | 10 +-- .../glest_game/network/server_interface.cpp | 2 +- .../include/platform/common/platform_common.h | 4 +- .../platform/common/platform_common.cpp | 32 ++++---- 13 files changed, 95 insertions(+), 105 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 9d4dc053..e536903c 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -24,28 +24,6 @@ IF ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang") ADD_DEFINITIONS("-Qunused-arguments -Wno-switch") ENDIF() -FUNCTION(Subversion_IS_WC FOLDER RESULT_VAR) - IF(Subversion_FOUND) - - # SVN info does not like .. as paths, so be sure that we use a full path - GET_FILENAME_COMPONENT(ABS_FOLDER ${FOLDER} ABSOLUTE) - EXECUTE_PROCESS(COMMAND ${Subversion_SVN_EXECUTABLE} info ${ABS_FOLDER} - RESULT_VARIABLE INFO_RESULT - OUTPUT_VARIABLE IGNORED - ERROR_VARIABLE IGNORED) - IF(INFO_RESULT EQUAL 0) - SET(${RESULT_VAR} TRUE PARENT_SCOPE) - ELSE() - SET(${RESULT_VAR} FALSE PARENT_SCOPE) - ENDIF() - - ELSE() - MESSAGE(STATUS "Cannot check whether folder ${FOLDER} is a svn working copy because svn was not found. Returning FALSE.") - SET(${RESULT_VAR} FALSE PARENT_SCOPE) - ENDIF() - -ENDFUNCTION() - OPTION(BUILD_MEGAGLEST_MODEL_IMPORT_EXPORT_TOOLS "Build model import/export tools" ON) OPTION(BUILD_MEGAGLEST_MODEL_VIEWER "Build model viewer" ON) OPTION(BUILD_MEGAGLEST_MAP_EDITOR "Build map editor" ON) @@ -207,30 +185,42 @@ IF(CMAKE_COMPILER_IS_GNUCXX OR MINGW) SET(CMAKE_CXX_FLAGS_MINSIZEREL "-O3 ${CMAKE_CXX_FLAGS_MINSIZEREL} -O3 ") SET(CMAKE_EXE_LINKER_FLAGS_MINSIZEREL "${CMAKE_EXE_LINKER_FLAGS_MINSIZEREL} -s") ## Strip binary - SET(HAS_SVN "FALSE") + # Get the git revision info for the binary + SET(HAS_GIT "FALSE") - OPTION(WANT_SVN_STAMP "use svn stamp" ON) - IF(WANT_SVN_STAMP) - # The stuff below gets SVN Global Revision # but ONLY when calling cmake! - # the FindSubversion.cmake module is part of the standard distribution - include(FindSubversion) + OPTION(WANT_GIT_STAMP "use git revision stamp" ON) + IF(WANT_GIT_STAMP) + # The stuff below gets GIT Global Revision # but ONLY when calling cmake! + # the FindGit.cmake module is part of the standard distribution + include(FindGit) - Subversion_IS_WC(${PROJECT_SOURCE_DIR} HAS_SVN) - IF(${HAS_SVN} STREQUAL "TRUE") - MESSAGE(STATUS "Found SVN and using SVN version stamping...") - # extract working copy information for SOURCE_DIR into MY_XXX variables - Subversion_WC_INFO(${PROJECT_SOURCE_DIR} MG) - #add_definitions(-DSVNVERSION="${MG_WC_REVISION}") + IF(GIT_FOUND) + SET(HAS_GIT "TRUE") + MESSAGE(STATUS "Found GIT and using GIT version stamping...") + + # Get the current commit SHA1 + execute_process( + COMMAND git log -1 --format=%h + WORKING_DIRECTORY ${PROJECT_SOURCE_DIR} + OUTPUT_VARIABLE GIT_SHA1 + OUTPUT_STRIP_TRAILING_WHITESPACE + ) + + # Get the current version counter + execute_process( + COMMAND git rev-list HEAD --count + WORKING_DIRECTORY ${PROJECT_SOURCE_DIR} + OUTPUT_VARIABLE GIT_COMMIT_COUNT + OUTPUT_STRIP_TRAILING_WHITESPACE + ) + + MESSAGE(STATUS "Using GIT revision stamp: [${GIT_COMMIT_COUNT}.${GIT_SHA1}]") + ENDIF() ENDIF() - SET(SVN_VERSION_CMD "-DSVNVERSION='\\\"${MG_WC_REVISION}\\\"'") + SET(GIT_VERSION_CMD "-DGITVERSION='\\\"${GIT_COMMIT_COUNT}.${GIT_SHA1}\\\"'") - IF(UNIX AND NOT APPLE AND ${HAS_SVN} STREQUAL "TRUE") - # We do some funky character escaping to get the right stuff written out to - # the final Makefile so we get the SVN Global Revsion # - SET(SVN_VERSION_CMD "-DSVNVERSION='\\\"`svnversion -n ${PROJECT_SOURCE_DIR}`\\\"'") - ENDIF() IF(CMAKE_INSTALL_PREFIX STREQUAL "") MESSAGE(STATUS "*NOTE: NOT USING a Custom Data Install Path...") @@ -262,13 +252,13 @@ IF(CMAKE_COMPILER_IS_GNUCXX OR MINGW) MESSAGE(STATUS "*NOTE: Custom Data Install Path is [${CUSTOM_DATA_INSTALL_PATH}]") ENDIF() - SET(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} ${SVN_VERSION_CMD} ${CUSTOM_DATA_INSTALL_PATH_VALUE}") - SET(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} ${SVN_VERSION_CMD} ${CUSTOM_DATA_INSTALL_PATH_VALUE}") - SET(CMAKE_CXX_FLAGS_RELWITHDEBINFO "${CMAKE_CXX_FLAGS_RELWITHDEBINFO} ${SVN_VERSION_CMD} ${CUSTOM_DATA_INSTALL_PATH_VALUE}") - SET(CMAKE_CXX_FLAGS_MINSIZEREL "${CMAKE_CXX_FLAGS_MINSIZEREL} ${SVN_VERSION_CMD} ${CUSTOM_DATA_INSTALL_PATH_VALUE}") + SET(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} ${GIT_VERSION_CMD} ${CUSTOM_DATA_INSTALL_PATH_VALUE}") + SET(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} ${GIT_VERSION_CMD} ${CUSTOM_DATA_INSTALL_PATH_VALUE}") + SET(CMAKE_CXX_FLAGS_RELWITHDEBINFO "${CMAKE_CXX_FLAGS_RELWITHDEBINFO} ${GIT_VERSION_CMD} ${CUSTOM_DATA_INSTALL_PATH_VALUE}") + SET(CMAKE_CXX_FLAGS_MINSIZEREL "${CMAKE_CXX_FLAGS_MINSIZEREL} ${GIT_VERSION_CMD} ${CUSTOM_DATA_INSTALL_PATH_VALUE}") # We do some funky character escaping to get the right stuff written out to - # the final Makefile so we get the SVN Global Revsion # + # the final Makefile so we get the GIT Global Revsion # string(REPLACE "'" "\"" CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG}") string(REPLACE "'" "\"" CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE}") string(REPLACE "'" "\"" CMAKE_CXX_FLAGS_RELWITHDEBINFO "${CMAKE_CXX_FLAGS_RELWITHDEBINFO}") diff --git a/source/glest_game/CMakeLists.txt b/source/glest_game/CMakeLists.txt index 0c9bec82..bf9e7294 100644 --- a/source/glest_game/CMakeLists.txt +++ b/source/glest_game/CMakeLists.txt @@ -297,9 +297,9 @@ IF(BUILD_MEGAGLEST) DESTINATION ${MEGAGLEST_MANPAGE_INSTALL_PATH}) ENDIF() - # Check if we are running from an SVN folder structure or tarballs + # Check if we are running from an GIT folder structure or tarballs IF(EXISTS "${PROJECT_SOURCE_DIR}/mk/linux/megaglest.desktop") - MESSAGE(STATUS "**Source package detected svn folder structure.") + MESSAGE(STATUS "**Source package detected git folder structure.") # Installation of the program desktop file INSTALL(FILES diff --git a/source/glest_game/facilities/game_util.cpp b/source/glest_game/facilities/game_util.cpp index eb1167e5..4224fb67 100644 --- a/source/glest_game/facilities/game_util.cpp +++ b/source/glest_game/facilities/game_util.cpp @@ -28,20 +28,20 @@ namespace Glest { namespace Game { const char *mailString = " http://bugs.megaglest.org"; const string glestVersionString = "v3.9.0"; -#if defined(SVNVERSION) -const string SVN_RawRev = string(SVNVERSION); -const string SVN_Rev = string("Rev: ") + string(SVNVERSION); -#elif defined(SVNVERSIONHEADER) -#include "svnversion.h" -const string SVN_RawRev = string(SVNVERSION); -const string SVN_Rev = string("Rev: ") + string(SVNVERSION); +#if defined(GITVERSION) +const string GIT_RawRev = string(GITVERSION); +const string GIT_Rev = string("Rev: ") + string(GITVERSION); +#elif defined(GITVERSIONHEADER) +#include "gitversion.h" +const string GIT_RawRev = string(GITVERSION); +const string GIT_Rev = string("Rev: ") + string(GITVERSION); #else -const string SVN_RawRev = "$4790$"; -const string SVN_Rev = "$Rev$"; +const string GIT_RawRev = "$4790$"; +const string GIT_Rev = "$Rev$"; #endif -string getRAWSVNRevisionString() { - return SVN_RawRev; +string getRAWGITRevisionString() { + return GIT_RawRev; } string getCrashDumpFileName(){ return "megaglest" + glestVersionString + ".dmp"; @@ -110,8 +110,8 @@ string getPlatformNameString() { return platform; } -string getSVNRevisionString() { - return SVN_Rev; +string getGITRevisionString() { + return GIT_Rev; } string getCompilerNameString() { @@ -162,10 +162,10 @@ string getNetworkVersionString() { return version; } -string getNetworkVersionSVNString() { +string getNetworkVersionGITString() { static string version = ""; if(version == "") { - version = glestVersionString + "-" + getCompilerNameString() + "-" + getSVNRevisionString(); + version = glestVersionString + "-" + getCompilerNameString() + "-" + getGITRevisionString(); } return version; } @@ -185,7 +185,7 @@ string getNetworkPlatformFreeVersionString() { string getAboutString1(int i) { switch(i) { case 0: return "MegaGlest " + glestVersionString + " (" + "Shared Library " + sharedLibVersionString + ")"; - case 1: return "Built: " + string(__DATE__) + " " + SVN_Rev; + case 1: return "Built: " + string(__DATE__) + " " + GIT_Rev; case 2: return "Copyright 2001-2012 The MegaGlest Team"; } return ""; @@ -333,10 +333,10 @@ string getGameReadWritePath(string lookupKey) { void initSpecialStrings() { getCrashDumpFileName(); getPlatformNameString(); - getSVNRevisionString(); + getGITRevisionString(); getCompilerNameString(); getNetworkVersionString(); - getNetworkVersionSVNString(); + getNetworkVersionGITString(); getNetworkPlatformFreeVersionString(); getCompileDateTime(); } diff --git a/source/glest_game/facilities/game_util.h b/source/glest_game/facilities/game_util.h index 8261b1cb..059c74ea 100644 --- a/source/glest_game/facilities/game_util.h +++ b/source/glest_game/facilities/game_util.h @@ -34,11 +34,11 @@ extern const string networkVersionString; void initSpecialStrings(); string getCrashDumpFileName(); string getPlatformNameString(); -string getSVNRevisionString(); -string getRAWSVNRevisionString(); +string getGITRevisionString(); +string getRAWGITRevisionString(); string getCompilerNameString(); string getNetworkVersionString(); -string getNetworkVersionSVNString(); +string getNetworkVersionGITString(); string getNetworkPlatformFreeVersionString(); string getAboutString1(int i); string getAboutString2(int i); diff --git a/source/glest_game/game/game.cpp b/source/glest_game/game/game.cpp index d8a4cdf8..7200745f 100644 --- a/source/glest_game/game/game.cpp +++ b/source/glest_game/game/game.cpp @@ -5037,7 +5037,7 @@ void Game::DumpCRCWorldLogIfRequired(string fileSuffix) { #endif logFile << "World CRC debug information:" << std::endl; logFile << "============================" << std::endl; - logFile << "Software version: " << glestVersionString << "-" << getCompilerNameString() << "-" << getSVNRevisionString() << std::endl; + logFile << "Software version: " << glestVersionString << "-" << getCompilerNameString() << "-" << getGITRevisionString() << std::endl; logFile << "Maximum framecount: " << world.getFaction(0)->getCRC_DetailsForWorldFrameCount() << std::endl; diff --git a/source/glest_game/main/main.cpp b/source/glest_game/main/main.cpp index 68ddbb1a..7a194edd 100644 --- a/source/glest_game/main/main.cpp +++ b/source/glest_game/main/main.cpp @@ -4099,7 +4099,7 @@ int glestMain(int argc, char** argv) { printf("\nSwitchSetupRequest sizeof = " MG_SIZE_T_SPECIFIER "",SwitchSetupRequest().getDataSize()); } - printf("\nSVN: [%s]",getSVNRevisionString().c_str()); + printf("\nGIT: [%s]",getGITRevisionString().c_str()); #ifdef USE_STREFLOP @@ -4124,7 +4124,7 @@ int glestMain(int argc, char** argv) { } setGameVersion(glestVersionString); - setGameSVNVersion(getRAWSVNRevisionString()); + setGameGITVersion(getRAWGITRevisionString()); if( hasCommandArgument(argc, argv,GAME_ARGS[GAME_ARG_OPENGL_INFO]) == true || hasCommandArgument(argc, argv,GAME_ARGS[GAME_ARG_SDL_INFO]) == true || diff --git a/source/glest_game/menu/menu_state_custom_game.cpp b/source/glest_game/menu/menu_state_custom_game.cpp index 573989ee..f39cb32e 100644 --- a/source/glest_game/menu/menu_state_custom_game.cpp +++ b/source/glest_game/menu/menu_state_custom_game.cpp @@ -222,7 +222,7 @@ MenuStateCustomGame::MenuStateCustomGame(Program *program, MainMenu *mainMenu, labelLocalGameVersion.setText(glestVersionString); } else { - labelLocalGameVersion.setText(glestVersionString + " [" + getCompileDateTime() + ", " + getSVNRevisionString() + "]"); + labelLocalGameVersion.setText(glestVersionString + " [" + getCompileDateTime() + ", " + getGITRevisionString() + "]"); } xoffset=70; @@ -707,7 +707,7 @@ void MenuStateCustomGame::reloadUI() { labelLocalGameVersion.setText(glestVersionString); } else { - labelLocalGameVersion.setText(glestVersionString + " [" + getCompileDateTime() + ", " + getSVNRevisionString() + "]"); + labelLocalGameVersion.setText(glestVersionString + " [" + getCompileDateTime() + ", " + getGITRevisionString() + "]"); } //vector teamItems, controlItems, results , rMultiplier; @@ -2970,7 +2970,7 @@ void MenuStateCustomGame::publishToMasterserver() { //?status=waiting&system=linux&info=titus publishToServerInfo["glestVersion"] = glestVersionString; - publishToServerInfo["platform"] = getPlatformNameString() + "-" + getSVNRevisionString(); + publishToServerInfo["platform"] = getPlatformNameString() + "-" + getGITRevisionString(); publishToServerInfo["binaryCompileDate"] = getCompileDateTime(); //game info: diff --git a/source/glest_game/menu/menu_state_root.cpp b/source/glest_game/menu/menu_state_root.cpp index 0c27d8a6..d1083d7f 100644 --- a/source/glest_game/menu/menu_state_root.cpp +++ b/source/glest_game/menu/menu_state_root.cpp @@ -49,7 +49,7 @@ MenuStateRoot::MenuStateRoot(Program *program, MainMenu *mainMenu): } else { labelVersion.init(405, yPos); - labelVersion.setText(glestVersionString + " [" + getCompileDateTime() + ", " + getSVNRevisionString() + "]"); + labelVersion.setText(glestVersionString + " [" + getCompileDateTime() + ", " + getGITRevisionString() + "]"); } yPos-=55; @@ -110,7 +110,7 @@ void MenuStateRoot::reloadUI() { labelVersion.setText(glestVersionString); } else { - labelVersion.setText(glestVersionString + " [" + getCompileDateTime() + ", " + getSVNRevisionString() + "]"); + labelVersion.setText(glestVersionString + " [" + getCompileDateTime() + ", " + getGITRevisionString() + "]"); } buttonNewGame.setText(lang.getString("NewGame")); diff --git a/source/glest_game/network/client_interface.cpp b/source/glest_game/network/client_interface.cpp index 86ee684c..41bbaf54 100644 --- a/source/glest_game/network/client_interface.cpp +++ b/source/glest_game/network/client_interface.cpp @@ -553,7 +553,7 @@ void ClientInterface::updateLobby() { if(SystemFlags::getSystemSettingType(SystemFlags::debugNetwork).enabled) SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s Line: %d] got NetworkMessageIntro, networkMessageIntro.getGameState() = %d, versionString [%s], sessionKey = %d, playerIndex = %d, serverFTPPort = %d\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__,networkMessageIntro.getGameState(),versionString.c_str(),sessionKey,playerIndex,serverFTPPort); //check consistency - bool compatible = checkVersionComptability(networkMessageIntro.getVersionString(), getNetworkVersionSVNString()); + bool compatible = checkVersionComptability(networkMessageIntro.getVersionString(), getNetworkVersionGITString()); if(SystemFlags::getSystemSettingType(SystemFlags::debugNetwork).enabled) SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s Line: %d] got NetworkMessageIntro, networkMessageIntro.getGameState() = %d, versionString [%s], sessionKey = %d, playerIndex = %d, serverFTPPort = %d\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__,networkMessageIntro.getGameState(),versionString.c_str(),sessionKey,playerIndex,serverFTPPort); @@ -568,12 +568,12 @@ void ClientInterface::updateLobby() { if(strncmp(platformFreeVersion.c_str(),networkMessageIntro.getVersionString().c_str(),strlen(platformFreeVersion.c_str())) != 0) { string playerNameStr = getHumanPlayerName(); sErr = "Server and client binary mismatch!\nYou have to use the exactly same binaries!\n\nServer: " + networkMessageIntro.getVersionString() + - "\nClient: " + getNetworkVersionSVNString() + " player [" + playerNameStr + "]"; + "\nClient: " + getNetworkVersionGITString() + " player [" + playerNameStr + "]"; printf("%s\n",sErr.c_str()); sendTextMessage("Server and client binary mismatch!!",-1, true,""); sendTextMessage(" Server:" + networkMessageIntro.getVersionString(),-1, true,""); - sendTextMessage(" Client: "+ getNetworkVersionSVNString(),-1, true,""); + sendTextMessage(" Client: "+ getNetworkVersionGITString(),-1, true,""); sendTextMessage(" Client player [" + playerNameStr + "]",-1, true,""); } else { @@ -581,7 +581,7 @@ void ClientInterface::updateLobby() { string playerNameStr = getHumanPlayerName(); sErr = "Warning, Server and client are using the same version but different platforms.\n\nServer: " + networkMessageIntro.getVersionString() + - "\nClient: " + getNetworkVersionSVNString() + " player [" + playerNameStr + "]"; + "\nClient: " + getNetworkVersionGITString() + " player [" + playerNameStr + "]"; //printf("%s\n",sErr.c_str()); } @@ -604,7 +604,7 @@ void ClientInterface::updateLobby() { //send intro message Lang &lang= Lang::getInstance(); NetworkMessageIntro sendNetworkMessageIntro( - sessionKey,getNetworkVersionSVNString(), + sessionKey,getNetworkVersionGITString(), getHumanPlayerName(), -1, nmgstOk, diff --git a/source/glest_game/network/connection_slot.cpp b/source/glest_game/network/connection_slot.cpp index f36f941f..0755823a 100644 --- a/source/glest_game/network/connection_slot.cpp +++ b/source/glest_game/network/connection_slot.cpp @@ -678,7 +678,7 @@ void ConnectionSlot::update(bool checkForNewClients,int lockedSlotIndex) { NetworkMessageIntro networkMessageIntro( sessionKey, - getNetworkVersionSVNString(), + getNetworkVersionGITString(), getHostName(), playerIndex, nmgstOk, @@ -954,7 +954,7 @@ void ConnectionSlot::update(bool checkForNewClients,int lockedSlotIndex) { //check consistency if(SystemFlags::getSystemSettingType(SystemFlags::debugNetwork).enabled) SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__); - bool compatible = checkVersionComptability(getNetworkVersionSVNString(), networkMessageIntro.getVersionString()); + bool compatible = checkVersionComptability(getNetworkVersionGITString(), networkMessageIntro.getVersionString()); if(SystemFlags::getSystemSettingType(SystemFlags::debugNetwork).enabled) SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__); @@ -967,12 +967,12 @@ void ConnectionSlot::update(bool checkForNewClients,int lockedSlotIndex) { if(strncmp(platformFreeVersion.c_str(),networkMessageIntro.getVersionString().c_str(),strlen(platformFreeVersion.c_str())) != 0) { string playerNameStr = name; - sErr = "Server and client binary mismatch!\nYou have to use the exactly same binaries!\n\nServer: " + getNetworkVersionSVNString() + + sErr = "Server and client binary mismatch!\nYou have to use the exactly same binaries!\n\nServer: " + getNetworkVersionGITString() + "\nClient: " + networkMessageIntro.getVersionString() + " player [" + playerNameStr + "]"; printf("%s\n",sErr.c_str()); serverInterface->sendTextMessage("Server and client binary mismatch!!",-1, true,"",lockedSlotIndex); - serverInterface->sendTextMessage(" Server:" + getNetworkVersionSVNString(),-1, true,"",lockedSlotIndex); + serverInterface->sendTextMessage(" Server:" + getNetworkVersionGITString(),-1, true,"",lockedSlotIndex); serverInterface->sendTextMessage(" Client: "+ networkMessageIntro.getVersionString(),-1, true,"",lockedSlotIndex); serverInterface->sendTextMessage(" Client player [" + playerNameStr + "]",-1, true,"",lockedSlotIndex); } @@ -980,7 +980,7 @@ void ConnectionSlot::update(bool checkForNewClients,int lockedSlotIndex) { versionMatched = true; string playerNameStr = name; - sErr = "Warning, Server and client are using the same version but different platforms.\n\nServer: " + getNetworkVersionSVNString() + + sErr = "Warning, Server and client are using the same version but different platforms.\n\nServer: " + getNetworkVersionGITString() + "\nClient: " + networkMessageIntro.getVersionString() + " player [" + playerNameStr + "]"; //printf("%s\n",sErr.c_str()); if(SystemFlags::getSystemSettingType(SystemFlags::debugNetwork).enabled) SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s Line: %d] %s\n",__FILE__,__FUNCTION__,__LINE__,sErr.c_str()); diff --git a/source/glest_game/network/server_interface.cpp b/source/glest_game/network/server_interface.cpp index f7de5b70..0b364cc5 100644 --- a/source/glest_game/network/server_interface.cpp +++ b/source/glest_game/network/server_interface.cpp @@ -2775,7 +2775,7 @@ std::map ServerInterface::publishToMasterserver() { } publishToServerInfo["uuid"] = Config::getInstance().getString("PlayerId",""); publishToServerInfo["glestVersion"] = glestVersionString; - publishToServerInfo["platform"] = getPlatformNameString() + "-" + getSVNRevisionString(); + publishToServerInfo["platform"] = getPlatformNameString() + "-" + getGITRevisionString(); publishToServerInfo["binaryCompileDate"] = getCompileDateTime(); publishToServerInfo["serverTitle"] = getHumanPlayerName() + "'s game"; publishToServerInfo["tech"] = this->getGameSettings()->getTech(); diff --git a/source/shared_lib/include/platform/common/platform_common.h b/source/shared_lib/include/platform/common/platform_common.h index ed34644f..a46ac4f2 100644 --- a/source/shared_lib/include/platform/common/platform_common.h +++ b/source/shared_lib/include/platform/common/platform_common.h @@ -186,9 +186,9 @@ void findAll(const string &path, vector &results, bool cutExtension=fals vector getFolderTreeContentsListRecursively(const string &path, const string &filterFileExt, bool includeFolders=false, vector *recursiveMap=NULL); string getGameVersion(); -string getGameSVNVersion(); +string getGameGITVersion(); void setGameVersion(string version); -void setGameSVNVersion(string svn); +void setGameGITVersion(string git); string getCRCCacheFilePath(); void setCRCCacheFilePath(string path); diff --git a/source/shared_lib/sources/platform/common/platform_common.cpp b/source/shared_lib/sources/platform/common/platform_common.cpp index 6851fe2c..2e913828 100644 --- a/source/shared_lib/sources/platform/common/platform_common.cpp +++ b/source/shared_lib/sources/platform/common/platform_common.cpp @@ -91,7 +91,7 @@ const time_t REFRESH_CRC_DAY_SECONDS = 60 * 60 * 24; static string crcCachePath = ""; static string gameVersion = ""; -static string gameSVNVersion = ""; +static string gameGITVersion = ""; namespace Private { @@ -373,7 +373,7 @@ void findAll(const string &path, vector &results, bool cutExtension, boo if(*p == '/') begin = p+1; } - if(!(strcmp(".", begin)==0 || strcmp("..", begin)==0 || strcmp(".svn", begin)==0)) { + if(!(strcmp(".", begin)==0 || strcmp("..", begin)==0 || strcmp(".git", begin)==0)) { results.push_back(begin); } else { @@ -472,7 +472,7 @@ void removeFolder(const string &path) { for(int i = (int)results.size() -1; i >= 0; --i) { string item = results[i]; - //if(item.find(".svn") != string::npos) { + //if(item.find(".git") != string::npos) { // printf("!!!!!!!!!!!!!!!!!! FOUND SPECIAL FOLDER [%s] in [%s]\n",item.c_str(),path.c_str()); //} @@ -646,14 +646,14 @@ void setCRCCacheFilePath(string path) { string getGameVersion() { return gameVersion; } -string getGameSVNVersion() { - return gameSVNVersion; +string getGameGITVersion() { + return gameGITVersion; } void setGameVersion(string version) { gameVersion = version; } -void setGameSVNVersion(string svn) { - gameSVNVersion = svn; +void setGameGITVersion(string git) { + gameGITVersion = git; } string getCRCCacheFileName(std::pair cacheKeys) { @@ -705,23 +705,23 @@ pair hasCachedFileCRCValue(string crcCacheFile, uint32 &value) { } char gameVer[500]=""; - char svnVer[500]=""; + char gitVer[500]=""; char actualFilePath[8096]=""; int readbytes = fscanf(fp,"%20ld,%20u,%20ld\n%499s\n%499s\n%8095s", &refreshDate, &crcValue, &lastUpdateDate, &gameVer[0], - &svnVer[0], + &gitVer[0], &actualFilePath[0]); refreshDate = Shared::PlatformByteOrder::fromCommonEndian(refreshDate); crcValue = Shared::PlatformByteOrder::fromCommonEndian(crcValue); lastUpdateDate = Shared::PlatformByteOrder::fromCommonEndian(lastUpdateDate); string readGameVer = Shared::PlatformByteOrder::fromCommonEndian(string(gameVer)); - string readSvnVer = Shared::PlatformByteOrder::fromCommonEndian(string(svnVer)); + string readGitVer = Shared::PlatformByteOrder::fromCommonEndian(string(gitVer)); string readActualFilePath = Shared::PlatformByteOrder::fromCommonEndian(string(actualFilePath)); - if(SystemFlags::VERBOSE_MODE_ENABLED) printf("CRC readGameVer [%s] [%s]\n%s\n",readGameVer.c_str(),readSvnVer.c_str(),readActualFilePath.c_str()); + if(SystemFlags::VERBOSE_MODE_ENABLED) printf("CRC readGameVer [%s] [%s]\n%s\n",readGameVer.c_str(),readGitVer.c_str(),readActualFilePath.c_str()); if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) { SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s] Line: %d for Cache file [%s] readbytes = %d\n",__FILE__,__FUNCTION__,__LINE__,crcCacheFile.c_str(),readbytes); @@ -744,7 +744,7 @@ pair hasCachedFileCRCValue(string crcCacheFile, uint32 &value) { time_t tBadCRCDate = mktime( &future ); result.second = lastUpdateDate; - if( readGameVer != "" && readSvnVer != "" && + if( readGameVer != "" && readGitVer != "" && refreshDate > 0 && refreshDate > tBadCRCDate && time(NULL) < refreshDate) { @@ -816,7 +816,7 @@ void writeCachedFileCRCValue(string crcCacheFile, uint32 &crcValue, string actua strftime(szBuf1,100,"%Y-%m-%d %H:%M:%S",loctime); string writeGameVer = Shared::PlatformByteOrder::toCommonEndian(gameVersion); - string writeGameSVNVersion = Shared::PlatformByteOrder::toCommonEndian(gameSVNVersion); + string writeGameGITVersion = Shared::PlatformByteOrder::toCommonEndian(gameGITVersion); string writeActualFileName = Shared::PlatformByteOrder::toCommonEndian(actualFileName); fprintf(fp,"%20ld,%20u,%20ld", @@ -826,7 +826,7 @@ void writeCachedFileCRCValue(string crcCacheFile, uint32 &crcValue, string actua fprintf(fp,"\n%s\n%s\n%s", writeGameVer.c_str(), - writeGameSVNVersion.c_str(), + writeGameGITVersion.c_str(), writeActualFileName.c_str()); fclose(fp); @@ -1040,7 +1040,7 @@ uint32 getFolderTreeContentsCheckSumRecursively(const string &path, const string if(isdir(p) == false) { bool addFile = true; - if(EndsWith(p, ".") == true || EndsWith(p, "..") == true || EndsWith(p, ".svn") == true) { + if(EndsWith(p, ".") == true || EndsWith(p, "..") == true || EndsWith(p, ".git") == true) { addFile = false; } else if(filterFileExt != "") { @@ -1359,7 +1359,7 @@ vector > getFolderTreeContentsCheckSumListRecursively(c if(isdir(p) == false) { bool addFile = true; - if(EndsWith(p, ".") == true || EndsWith(p, "..") == true || EndsWith(p, ".svn") == true) { + if(EndsWith(p, ".") == true || EndsWith(p, "..") == true || EndsWith(p, ".git") == true) { addFile = false; } else if(filterFileExt != "") {