# HG changeset patch # User Teemu Piippo # Date 1418232171 -7200 # Node ID 8be472cb0bcae158749f8e4d052e5f9396dc7ec7 # Parent 4dd5bde4e777c4d2c1134cc05762c94224b1eb34 - improvements to updaterevision diff -r 4dd5bde4e777 -r 8be472cb0bca sources/version.cpp --- 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; } diff -r 4dd5bde4e777 -r 8be472cb0bca updaterevision/updaterevision.py --- 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)