~abentley/bzrtools/bzrtools.dev

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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
#! /bin/sh
## Copyright (C) 2004 Jan Hudec
##
## See the file "COPYING" for further information about
## the copyright and warranty status of this work.

. "$abadir/aba-lib"

# one-liner description for aba help
cmd_desc () {
    aba_desc cvs-inventory "Inventory from CVS/Entries files"
}

# short help for aba command -h, --help
cmd_help () {
    cat <<EOH
aba cvs-inventory [dir]
Generate inventory listing from CVS/Entries files."
EOH
}

# extended help for aba command -H or aba help command
cmd_ext_help () {
    cat <<EOH

This command processes CVS metafiles and generates CVS analog of
tla inventory --both --sources
EOH
}	

aw_cvs_cat_patterns () {
    sed -n 's/\([\\|.+()]\)/\\\1/g;s/*/.*/g;s/?/./g;/./p' < $1
}

aw_cvs_cat_entries () {
    base=${1%CVS/Entries} # Strip
    base=${base#./} # Normalize
    sed -n "s:[^/]*/\([^/]*\).*:$base\1:p" < $1
    cat <<END-OF-CVS-METAS
${base}CVS
${base}CVS/Entries
${base}CVS/Repository
${base}CVS/Root
END-OF-CVS-METAS
    if [ -r "$1.Log" ]; then
	sed -n "s:[^/]*/\([^/]*\).*:$base\1:p" < "$1.Log"
	cat <<END-OF-CVS-METAS
${base}CVS/Entries.Log
END-OF-CVS-METAS
    fi
}

aw_cvs_cat_all_entries () {
    while read line; do
	aw_cvs_cat_entries "$line"
    done
}

aw_cvs_tla_inventory () {
    tla inventory -s -B
}

# executes the command ("$@" are the arguments after the command name)
cmd_exec () {
    test -n "$1" && { cd "$1" || { echo "* Can't chdir to $1" >&2; exit 1; } }
    find -path '*/CVS/Entries' | aw_cvs_cat_all_entries
}

aba_run "$@"
# arch-tag: 86262ef1-e994-461c-b608-b47cbdf45fe2