~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
#! /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-syn-inventory "Add/remove files acoording to CVS trunk."
}

# short help for aba command -h, --help
cmd_help () {
    cat <<EOH
aba cvs-sync-inventory [dir]
Look in CVS/Entries for files CVS knows about, add all files to arch and
remove files, that ceased to exist.
EOH
}

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

log () {
    echo "* $*"
}

aw_cvs_process_diff () {
    while read line; do
	case $line in
	    \<\ *)
		if ! test -r "${line#< }"; then
		    log "Removing \"${line#<}\""
		    tla remove "${line#< }" || true
		fi;;
	    \>\ *) 
		log "Adding \"${line#> }\""
		tla add "${line#> }" || true
		;;
	esac
    done
}

# executes the command ("$@" are the arguments after the command name)
cmd_exec () {
    test -n "$1" && { cd "$1" || { echo "* Can't cd to $1" >&2; exit 1; } }
    cd $(tla tree-root) || exit 1
    log "Generating CVS inventory"
    aba cvs-inventory > ,,inventory$$.cvs
    log "Generating TLA inventory"
    tla inventory -s -B > ,,inventory$$.tla
    sort -u ,,inventory$$.cvs -o ,,inventory$$.cvs
    sort -u ,,inventory$$.tla -o ,,inventory$$.tla
    diff ,,inventory$$.tla ,,inventory$$.cvs | aw_cvs_process_diff
    rm ,,inventory$$.cvs ,,inventory$$.tla
}

aba_run "$@"
# arch-tag: 03097d92-2a99-4a3d-9bd2-2a324e2e607f