summaryrefslogtreecommitdiff
path: root/support/vc/hg-unix/vc
blob: 9916f854bb626fe32efdeefb852d2de756daa820 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
#!/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.
mod=0
while [ -n "$(echo $1 | grep '-')" ]; do
	case $1 in 
		-m )	mod=1 ;;
		*  )
			echo 'usage: vc [-m]'
			exit 1
			;;
	esac
	shift
done

logformat=""
logformat="${logformat}Hash: {node}"
logformat="${logformat}Abr. Hash: {node|short}"
logformat="${logformat}Branch: {branch}"
logformat="${logformat}Parent1 Hash: {p1node}"
logformat="${logformat}Parent2 Hash: {p2node}"
logformat="${logformat}Abr. Parent1 Hash: {p1node|short}"
logformat="${logformat}Abr. Parent2 Hash: {p2node|short}"
logformat="${logformat}Author Name: {author|user}"
logformat="${logformat}Author Email: {author|email}"
logformat="${logformat}Author Date: {date|isodatesec}"

LC_ALL=C
hg log --pager=off -r . --template "${logformat}" \
	| gawk -v script=log -f vc-hg.awk \
	> vc.tex

if [ "$mod" = 1 ]; then
	hg status --pager=off \
		| gawk -v script=status -f vc-hg.awk \
		>> vc.tex
fi