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-unix |
Initial commit
Diffstat (limited to 'support/vc/bzr-unix')
-rw-r--r-- | support/vc/bzr-unix/vc | 25 | ||||
-rw-r--r-- | support/vc/bzr-unix/vc-bzr.awk | 62 |
2 files changed, 87 insertions, 0 deletions
diff --git a/support/vc/bzr-unix/vc b/support/vc/bzr-unix/vc new file mode 100644 index 0000000000..e9c3f47a8f --- /dev/null +++ b/support/vc/bzr-unix/vc @@ -0,0 +1,25 @@ +#!/bin/sh +# This is file 'vc' from the vc bundle for TeX. +# The original file can be found at CTAN:support/vc. +# This file is Public Domain. + +# Parse command line options. +full=0 +mod=0 +while [ -n "$(echo $1 | grep '-')" ]; do + case $1 in + -f ) full=1 ;; + -m ) mod=1 ;; + * ) echo 'usage: vc [-f] [-m]' + exit 1 + esac + shift +done +# English locale. +LC_ALL=C +if [ "$mod" = 1 ] +then + 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 +fi diff --git a/support/vc/bzr-unix/vc-bzr.awk b/support/vc/bzr-unix/vc-bzr.awk new file mode 100644 index 0000000000..cec1628f4b --- /dev/null +++ b/support/vc/bzr-unix/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}%" + } +} |