Wed, 10 Dec 2014 19:22:51 +0200
- improvements to updaterevision
sources/version.cpp | file | annotate | diff | comparison | revisions | |
updaterevision/updaterevision.py | file | annotate | diff | comparison | revisions |
--- a/sources/version.cpp Wed Dec 10 19:17:00 2014 +0200 +++ b/sources/version.cpp Wed Dec 10 19:22:51 2014 +0200 @@ -44,7 +44,13 @@ static char buffer[128] = {0}; if (buffer[0] == '\0') - snprintf (buffer, sizeof buffer, "%s-%s", version_string(), REVISION_STRING); + { + char* ptr = &buffer[0]; + snprintf (ptr, sizeof buffer - (ptr - buffer), "%s-%s", version_string(), HG_NODE); + + if (strcmp (HG_BRANCH, "default") != 0) + snprintf (ptr, sizeof buffer - (ptr - buffer), " (%s)", HG_BRANCH); + } return buffer; } @@ -52,5 +58,5 @@ FUNCTION changeset_date_string() -> const char* { - return REVISION_DISPLAY_DATE; + return HG_DATE_STRING; }
--- a/updaterevision/updaterevision.py Wed Dec 10 19:17:00 2014 +0200 +++ b/updaterevision/updaterevision.py Wed Dec 10 19:22:51 2014 +0200 @@ -59,17 +59,15 @@ if subprocess.check_output (['hg', 'id', '-n']).replace ('\n', '')[-1] == '+': rev += '+' -if branch != 'default': - rev += '-%s' % branch - if rev == oldrev: print "%s is up to date at %s" % (sys.argv[1], rev) quit (0) with open (sys.argv[1], 'w') as fp: fp.write ('// %s\n' % rev) - fp.write ('#define REVISION_STRING "%s"\n' % rev) - fp.write ('#define REVISION_DATE "%s"\n' % datestring) - fp.write ('#define REVISION_DISPLAY_DATE "%s"\n' % date.strftime ('%d %b %Y')) - fp.write ('#define REVISION_TIME %d\n' % int (timestamp)) + fp.write ('#define HG_NODE "%s"\n' % rev) + fp.write ('#define HG_BRANCH "%s"\n' % branch) + fp.write ('#define HG_DATE_VERSION "%s"\n' % datestring) + fp.write ('#define HG_DATE_STRING "%s"\n' % date.strftime ('%d %b %Y')) + fp.write ('#define HG_DATE_TIME %d\n' % int (timestamp)) print '%s updated to %s' % (sys.argv[1], rev)