Made changes suggested by Michael:

- removed unused/misused $opc_X
- modified command line repo calls
- fixed ifndef block
This commit is contained in:
hanlet
2022-05-17 12:14:29 -05:00
parent 2afa4ea390
commit 5997018fb0
+8 -9
View File
@@ -29,8 +29,7 @@ our $opt_t = '.';
our $opt_N = 'VCSVERSION';
our $opt_V = $now;
our $opt_T = 'VCSREVISION';
our $opt_C = $now;
our $RevDate = $now;
my $vcs;
my $cv;
@@ -57,7 +56,7 @@ if (!$vcs && -d "$opt_t/_darcs") { # Darcs
my $hasmod = `darcs whatsnew --repodir="$opt_t" -l`;
$opt_V .= '-dirty' unless $?;
}
$cv = `darcs optimize --reorder; darcs changes --context | sort | md5sum`; # this is untested
$cv = ""; # ToDo
}
if (!$vcs && -d "$opt_t/.hg") { # Mercurial
print "== Found <top>/.hg directory\n" if $opt_v;
@@ -74,7 +73,7 @@ if (!$vcs && -d "$opt_t/.hg") { # Mercurial
chomp $hasmod;
$opt_V .= '-dirty' if $hasmod ne '';
}
$cv = `hg log -l1 --template '{date(date, "%s")}'` # this is untested
$cv = `hg log -l1 --template '{date|isodate}'` # this is untested
}
if (!$vcs && -d "$opt_t/.git") { # Git
print "== Found <top>/.git directory\n" if $opt_v;
@@ -104,7 +103,7 @@ if (!$vcs && -d "$opt_t/.svn") { # Subversion
chomp $hasmod;
$opt_V .= '-dirty' if $hasmod ne '';
}
$cv = `svn info --show-item revision`; # this is untested
$cv = `svn info --show-item last-changed-date`; # this is untested
}
if (!$vcs && -d "$opt_t/.bzr") { # Bazaar
print "== Found <top>/.bzr directory\n" if $opt_v;
@@ -116,7 +115,7 @@ if (!$vcs && -d "$opt_t/.bzr") { # Bazaar
$opt_V = $result;
$vcs = 'Bazaar';
}
$cv = `bzr version-info -q -timestamp`; # this is untested
$cv = `bzr version-info -q --custom --template='{date}'`;
}
if (!$vcs) {
print "== No VCS directories\n" if $opt_v;
@@ -130,7 +129,7 @@ if (!$vcs) {
}
chomp $cv;
$opt_C=$vcs . ': ' . $cv;
$RevDate=$vcs . ': ' . $cv;
my $output = << "__END";
/* Generated file, do not edit! */
@@ -140,8 +139,8 @@ my $output = << "__END";
#ifndef $opt_N
#define $opt_N \"$opt_V\"
#endif
#ifndef $opt_T
#define ${opt_N}_DATE \"$opt_C\"
#ifndef ${opt_N}_DATE
#define ${opt_N}_DATE \"$RevDate\"
#endif
__END