Skip to content

Commit

Permalink
Merge 5a5b1c7 into 4c4686e
Browse files Browse the repository at this point in the history
  • Loading branch information
akgrant43 committed Apr 2, 2018
2 parents 4c4686e + 5a5b1c7 commit e7fd00b
Show file tree
Hide file tree
Showing 3 changed files with 38 additions and 4 deletions.
1 change: 1 addition & 0 deletions .git_filters/RevDateURL.clean
Expand Up @@ -3,3 +3,4 @@
s/\$Date[^\$]*\$/\$Date\$/;
s/\$Rev[^\$]*\$/\$Rev\$/;
s/\$URL[^\$]*\$/\$URL\$/;
s/\$Hash[^\$]*\$/\$Hash\$/;
4 changes: 4 additions & 0 deletions .git_filters/RevDateURL.smudge
Expand Up @@ -27,10 +27,14 @@ $url =~ s/\s+//gm;
$date = `git log --format=%ad -1`;
$date =~ s/\s+$//m;

$shorthash = `git log --format=%h -1`;
$shorthash =~ s/\s+$//m;

while (<STDIN>) {
s/\$Date[^\$]*\$/\$Date: $date \$/;
s/\$URL[^\$]*\$/\$URL: $url \$/;
s/\$Rev[^\$]*\$/\$Rev: $myrev \$/;
s/\$Hash[^\$]*\$/\$Hash: $shorthash \$/;
} continue {
print or die "-p destination: $!\n";
}
37 changes: 33 additions & 4 deletions platforms/Cross/vm/sqSCCSVersion.h
Expand Up @@ -37,6 +37,9 @@ static char SvnRawRevisionDate[] = "$Date$";
static char SvnRawRepositoryURL[] = "$URL$";
# define URL_START (SvnRawRepositoryURL + 6)

static char SvnRawRevisionShortHash[] = "$Hash$";
# define SHORTHASH_START (SvnRawRevisionShortHash + 7)

static char *
revisionAsString()
{
Expand All @@ -63,6 +66,13 @@ repositoryURL()
*maybe_platforms = 0;
return URL_START;
}

static char *
revisionShortHash()
{
return SHORTHASH_START;
}

# undef REV_START
# undef URL_START
#elif GIT
Expand All @@ -76,6 +86,9 @@ static char GitRawRevisionDate[] = "$Date$";
static char GitRawRepositoryURL[] = "$URL$";
# define URL_START (GitRawRepositoryURL + 6)

static char SvnRawRevisionShortHash[] = "$Hash$";
# define SHORTHASH_START (SvnRawRevisionShortHash + 7)

static char *
revisionAsString()
{
Expand All @@ -102,6 +115,13 @@ repositoryURL()
*maybe_platforms = 0;
return URL_START;
}

static char *
revisionShortHash()
{
return SHORTHASH_START;
}

# undef REV_START
# undef URL_START
#else /* SUBVERSION */
Expand All @@ -111,6 +131,10 @@ revisionAsString() { return "?"; }

static char *
repositoryURL() { return "unknown"; }

static char *
revisionShortHash() { return "unknown"; }

#endif /* SUBVERSION */

static char *sourceVersion = 0;
Expand All @@ -120,22 +144,27 @@ sourceVersionString(char separator)
{
if (!sourceVersion) {
#if 1 /* a) mingw32 doesn't have asprintf and b) on Mac OS it segfaults. */
char *fmt = "VM: " PREFIX "%s %s Date: %s%cPlugins: " PREFIX "%s %s";
char *fmt = "VM: " PREFIX "%s %s%cDate: %s Hash: %s%cPlugins: " PREFIX "%s %s";
int len = strlen(fmt)
+ strlen(revisionAsString())
+ strlen(repositoryURL())
+ strlen(revisionDateAsString())
+ strlen(revisionShortHash())
+ strlen(pluginsRevisionAsString())
+ strlen(pluginsRepositoryURL());
sourceVersion = malloc(len);
snprintf(sourceVersion, len, fmt,
revisionAsString(), repositoryURL(), revisionDateAsString(),
revisionAsString(), repositoryURL(),
separator,
revisionDateAsString(), revisionShortHash(),
separator,
pluginsRevisionAsString(), pluginsRepositoryURL());
#else
asprintf(&sourceVersion,
"VM: " PREFIX "%s %s Date: %s%cPlugins: " PREFIX "%s %s",
revisionAsString(), repositoryURL(), revisionDateAsString(),
"VM: " PREFIX "%s %s%cDate: %s Hash: %s%cPlugins: " PREFIX "%s %s",
revisionAsString(), repositoryURL(),
separator,
revisionDateAsString(), revisionShortHash(),
separator,
pluginsRevisionAsString(), pluginsRepositoryURL());
#endif
Expand Down

0 comments on commit e7fd00b

Please sign in to comment.