Replace SCM_IS_MASTER with SCM_COMMITS_AHEAD_MASTER
This commit is contained in:
parent
3948ac9513
commit
02f57a4778
|
@ -18,6 +18,10 @@ if(GIT_FOUND)
|
||||||
execute_process(WORKING_DIRECTORY ${PROJECT_SOURCE_DIR} COMMAND ${GIT_EXECUTABLE} rev-parse --abbrev-ref HEAD
|
execute_process(WORKING_DIRECTORY ${PROJECT_SOURCE_DIR} COMMAND ${GIT_EXECUTABLE} rev-parse --abbrev-ref HEAD
|
||||||
OUTPUT_VARIABLE DOLPHIN_WC_BRANCH
|
OUTPUT_VARIABLE DOLPHIN_WC_BRANCH
|
||||||
OUTPUT_STRIP_TRAILING_WHITESPACE)
|
OUTPUT_STRIP_TRAILING_WHITESPACE)
|
||||||
|
# defines DOLPHIN_WC_COMMITS_AHEAD_MASTER
|
||||||
|
execute_process(WORKING_DIRECTORY ${PROJECT_SOURCE_DIR} COMMAND ${GIT_EXECUTABLE} rev-list --count HEAD ^master
|
||||||
|
OUTPUT_VARIABLE DOLPHIN_WC_COMMITS_AHEAD_MASTER
|
||||||
|
OUTPUT_STRIP_TRAILING_WHITESPACE)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
# version number
|
# version number
|
||||||
|
@ -35,12 +39,7 @@ if(NOT DOLPHIN_WC_REVISION)
|
||||||
set(DOLPHIN_WC_DESCRIBE "${DOLPHIN_VERSION_MAJOR}.${DOLPHIN_VERSION_MINOR}")
|
set(DOLPHIN_WC_DESCRIBE "${DOLPHIN_VERSION_MAJOR}.${DOLPHIN_VERSION_MINOR}")
|
||||||
set(DOLPHIN_WC_REVISION "${DOLPHIN_WC_DESCRIBE} (no further info)")
|
set(DOLPHIN_WC_REVISION "${DOLPHIN_WC_DESCRIBE} (no further info)")
|
||||||
set(DOLPHIN_WC_BRANCH "master")
|
set(DOLPHIN_WC_BRANCH "master")
|
||||||
endif()
|
set(DOLPHIN_WC_COMMITS_AHEAD_MASTER 0)
|
||||||
|
|
||||||
if(DOLPHIN_WC_BRANCH STREQUAL "master" OR DOLPHIN_WC_BRANCH STREQUAL "stable")
|
|
||||||
set(DOLPHIN_WC_IS_STABLE "1")
|
|
||||||
else()
|
|
||||||
set(DOLPHIN_WC_IS_STABLE "0")
|
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
configure_file(
|
configure_file(
|
||||||
|
|
|
@ -20,7 +20,8 @@ namespace Common
|
||||||
const std::string& GetScmRevStr()
|
const std::string& GetScmRevStr()
|
||||||
{
|
{
|
||||||
static const std::string scm_rev_str = "Dolphin "
|
static const std::string scm_rev_str = "Dolphin "
|
||||||
#if !SCM_IS_MASTER
|
// Note this macro can be empty if the master branch does not exist.
|
||||||
|
#if 1 - SCM_COMMITS_AHEAD_MASTER - 1 != 0
|
||||||
"[" SCM_BRANCH_STR "] "
|
"[" SCM_BRANCH_STR "] "
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -74,4 +75,10 @@ const std::string& GetNetplayDolphinVer()
|
||||||
return netplay_dolphin_ver;
|
return netplay_dolphin_ver;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int GetScmCommitsAheadMaster()
|
||||||
|
{
|
||||||
|
// Note this macro can be empty if the master branch does not exist.
|
||||||
|
return SCM_COMMITS_AHEAD_MASTER + 0;
|
||||||
|
}
|
||||||
|
|
||||||
} // namespace Common
|
} // namespace Common
|
||||||
|
|
|
@ -14,4 +14,5 @@ const std::string& GetScmRevGitStr();
|
||||||
const std::string& GetScmDistributorStr();
|
const std::string& GetScmDistributorStr();
|
||||||
const std::string& GetScmUpdateTrackStr();
|
const std::string& GetScmUpdateTrackStr();
|
||||||
const std::string& GetNetplayDolphinVer();
|
const std::string& GetNetplayDolphinVer();
|
||||||
|
int GetScmCommitsAheadMaster();
|
||||||
} // namespace Common
|
} // namespace Common
|
||||||
|
|
|
@ -5,6 +5,7 @@ var outfile = "./scmrev.h";
|
||||||
var cmd_revision = " rev-parse HEAD";
|
var cmd_revision = " rev-parse HEAD";
|
||||||
var cmd_describe = " describe --always --long --dirty";
|
var cmd_describe = " describe --always --long --dirty";
|
||||||
var cmd_branch = " rev-parse --abbrev-ref HEAD";
|
var cmd_branch = " rev-parse --abbrev-ref HEAD";
|
||||||
|
var cmd_commits_ahead = " rev-list --count HEAD ^master";
|
||||||
|
|
||||||
function GetGitExe()
|
function GetGitExe()
|
||||||
{
|
{
|
||||||
|
@ -76,7 +77,7 @@ var gitexe = GetGitExe();
|
||||||
var revision = GetFirstStdOutLine(gitexe + cmd_revision);
|
var revision = GetFirstStdOutLine(gitexe + cmd_revision);
|
||||||
var describe = GetFirstStdOutLine(gitexe + cmd_describe);
|
var describe = GetFirstStdOutLine(gitexe + cmd_describe);
|
||||||
var branch = GetFirstStdOutLine(gitexe + cmd_branch);
|
var branch = GetFirstStdOutLine(gitexe + cmd_branch);
|
||||||
var isStable = +("master" == branch || "stable" == branch);
|
var commits_ahead = GetFirstStdOutLine(gitexe + cmd_commits_ahead);
|
||||||
|
|
||||||
// Get environment information.
|
// Get environment information.
|
||||||
var distributor = wshShell.ExpandEnvironmentStrings("%DOLPHIN_DISTRIBUTOR%");
|
var distributor = wshShell.ExpandEnvironmentStrings("%DOLPHIN_DISTRIBUTOR%");
|
||||||
|
@ -91,7 +92,7 @@ var out_contents =
|
||||||
"#define SCM_REV_STR \"" + revision + "\"\n" +
|
"#define SCM_REV_STR \"" + revision + "\"\n" +
|
||||||
"#define SCM_DESC_STR \"" + describe + "\"\n" +
|
"#define SCM_DESC_STR \"" + describe + "\"\n" +
|
||||||
"#define SCM_BRANCH_STR \"" + branch + "\"\n" +
|
"#define SCM_BRANCH_STR \"" + branch + "\"\n" +
|
||||||
"#define SCM_IS_MASTER " + isStable + "\n" +
|
"#define SCM_COMMITS_AHEAD_MASTER " + commits_ahead + "\n" +
|
||||||
"#define SCM_DISTRIBUTOR_STR \"" + distributor + "\"\n" +
|
"#define SCM_DISTRIBUTOR_STR \"" + distributor + "\"\n" +
|
||||||
"#define SCM_UPDATE_TRACK_STR \"" + default_update_track + "\"\n";
|
"#define SCM_UPDATE_TRACK_STR \"" + default_update_track + "\"\n";
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
#define SCM_REV_STR "${DOLPHIN_WC_REVISION}"
|
#define SCM_REV_STR "${DOLPHIN_WC_REVISION}"
|
||||||
#define SCM_DESC_STR "${DOLPHIN_WC_DESCRIBE}"
|
#define SCM_DESC_STR "${DOLPHIN_WC_DESCRIBE}"
|
||||||
#define SCM_BRANCH_STR "${DOLPHIN_WC_BRANCH}"
|
#define SCM_BRANCH_STR "${DOLPHIN_WC_BRANCH}"
|
||||||
#define SCM_IS_MASTER ${DOLPHIN_WC_IS_STABLE}
|
#define SCM_COMMITS_AHEAD_MASTER ${DOLPHIN_WC_COMMITS_AHEAD_MASTER}
|
||||||
#define SCM_DISTRIBUTOR_STR "${DISTRIBUTOR}"
|
#define SCM_DISTRIBUTOR_STR "${DISTRIBUTOR}"
|
||||||
#define SCM_UPDATE_TRACK_STR "${DOLPHIN_DEFAULT_UPDATE_TRACK}"
|
#define SCM_UPDATE_TRACK_STR "${DOLPHIN_DEFAULT_UPDATE_TRACK}"
|
||||||
|
|
Loading…
Reference in New Issue