diff options
author | Norbert Preining <norbert@preining.info> | 2019-09-02 13:46:59 +0900 |
---|---|---|
committer | Norbert Preining <norbert@preining.info> | 2019-09-02 13:46:59 +0900 |
commit | e0c6872cf40896c7be36b11dcc744620f10adf1d (patch) | |
tree | 60335e10d2f4354b0674ec22d7b53f0f8abee672 /support/vc/bzr-windows |
Initial commit
Diffstat (limited to 'support/vc/bzr-windows')
-rw-r--r-- | support/vc/bzr-windows/vc-bzr.awk | 62 | ||||
-rw-r--r-- | support/vc/bzr-windows/vc.bat | 25 |
2 files changed, 87 insertions, 0 deletions
diff --git a/support/vc/bzr-windows/vc-bzr.awk b/support/vc/bzr-windows/vc-bzr.awk new file mode 100644 index 0000000000..cec1628f4b --- /dev/null +++ b/support/vc/bzr-windows/vc-bzr.awk @@ -0,0 +1,62 @@ +# This is file 'vc-bzr.awk' from the vc bundle for TeX. +# The original file can be found at CTAN:support/vc. +# This file is Public Domain. +BEGIN { +### Assume clean working copy. + Clean = "True" +} +/^revision-id:/ { RevisionId = substr($0, 2+match($0, ":")) } +/^date:/ { Date = substr($0, 2+match($0, ":")) } +/^build-date:/ { BuildDate = substr($0, 2+match($0, ":")) } +/^revno:/ { RevNo = substr($0, 2+match($0, ":")) } +/^branch-nick:/ { BranchNick = substr($0, 2+match($0, ":")) } +/^clean:/ { Clean = substr($0, 2+match($0, ":")) } +END { +### Extract relevant information from variables. + elements = split(RevisionId, elem, "-") + Author = elem[1] + for (i=2; i<elements-2; i++) { + Author = Author "-" elem[i] + } + LongDate = substr(Date, 1, 25) + DateRAW = substr(LongDate, 1, 10) + DateISO = DateRAW + DateTEX = DateISO + gsub("-", "/", DateTEX) + Time = substr(LongDate, 12, 14) + if (Clean=="True") { + modified = 0 + } else { + modified = 1 + } +### Write file identification to vc.tex. + print "%%% This file has been generated by the vc bundle for TeX." + print "%%% Do not edit this file!" + print "%%%" +### Write Bazaar specific macros. + print "%%% Define Bazaar specific macros." + print "\\gdef\\BZRRevisionId{" RevisionId "}%" + print "\\gdef\\BZRDate{" Date "}%" + print "\\gdef\\BZRBuildDate{" BuildDate "}%" + print "\\gdef\\BZRRevNo{" RevNo "}%" + if (full==1) { + print "\\gdef\\BZRBranchNick{" BranchNick "}%" + } +### Write generic version control macros. + print "%%% Define generic version control macros." + print "\\gdef\\VCRevision{\\BZRRevNo}%" + print "\\gdef\\VCAuthor{" Author "}%" + print "\\gdef\\VCDateRAW{" DateRAW "}%" + print "\\gdef\\VCDateISO{" DateISO "}%" + print "\\gdef\\VCDateTEX{" DateTEX "}%" + print "\\gdef\\VCTime{" Time "}%" + print "\\gdef\\VCModifiedText{\\textcolor{red}{with local modifications!}}%" +### Is working copy modified? + print "%%% Is working copy modified?" + print "\\gdef\\VCModified{" modified "}%" + if (modified==0) { + print "\\gdef\\VCRevisionMod{\\VCRevision}%" + } else { + print "\\gdef\\VCRevisionMod{\\VCRevision~\\VCModifiedText}%" + } +} diff --git a/support/vc/bzr-windows/vc.bat b/support/vc/bzr-windows/vc.bat new file mode 100644 index 0000000000..9ea3cbbebf --- /dev/null +++ b/support/vc/bzr-windows/vc.bat @@ -0,0 +1,25 @@ +@echo off +REM This is file 'vc.bat' from the vc bundle for TeX. +REM The original file can be found at CTAN:support/vc. +REM This file is Public Domain. + +setlocal +REM Parse command line options. +set full=0 +set mod=0 +:loopParams +if "%1" NEQ "" ( + if "%1"=="-f" (set full=1) else if "%1"=="-m" (set mod=1) else ( + echo usage: vc [-f] [-m] + exit /b 1 + ) + shift + goto loopParams +) +REM English locale. +set LC_ALL=C +if "%mod%"=="1" ( + bzr version-info --check-clean|gawk -v full=%full% -f vc-bzr.awk > vc.tex +) else ( + bzr version-info |gawk -v full=%full% -f vc-bzr.awk > vc.tex +) |