~abentley/bzrtools/bzrtools.dev

« back to all changes in this revision

Viewing changes to fai/aba/commands/cvs-sync-inventory

  • Committer: Robert Collins
  • Date: 2005-09-13 10:46:27 UTC
  • mto: (147.2.6) (364.1.3 bzrtools)
  • mto: This revision was merged to the branch mainline in revision 324.
  • Revision ID: robertc@robertcollins.net-20050913104627-51f938950a907475
handle inaccessible sibling archives somewhat - note version-0 is still not handled

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#! /bin/sh
 
2
## Copyright (C) 2004 Jan Hudec
 
3
##
 
4
## See the file "COPYING" for further information about
 
5
## the copyright and warranty status of this work.
 
6
 
 
7
. "$abadir/aba-lib"
 
8
 
 
9
# one-liner description for aba help
 
10
cmd_desc () {
 
11
    aba_desc cvs-syn-inventory "Add/remove files acoording to CVS trunk."
 
12
}
 
13
 
 
14
# short help for aba command -h, --help
 
15
cmd_help () {
 
16
    cat <<EOH
 
17
aba cvs-sync-inventory [dir]
 
18
Look in CVS/Entries for files CVS knows about, add all files to arch and
 
19
remove files, that ceased to exist.
 
20
EOH
 
21
}
 
22
 
 
23
# extended help for aba command -H or aba help command
 
24
cmd_ext_help () 
 
25
{
 
26
    cat <<EOH
 
27
EOH
 
28
}
 
29
 
 
30
log () {
 
31
    echo "* $*"
 
32
}
 
33
 
 
34
aw_cvs_process_diff () {
 
35
    while read line; do
 
36
        case $line in
 
37
            \<\ *)
 
38
                if ! test -r "${line#< }"; then
 
39
                    log "Removing \"${line#<}\""
 
40
                    tla remove "${line#< }" || true
 
41
                fi;;
 
42
            \>\ *) 
 
43
                log "Adding \"${line#> }\""
 
44
                tla add "${line#> }" || true
 
45
                ;;
 
46
        esac
 
47
    done
 
48
}
 
49
 
 
50
# executes the command ("$@" are the arguments after the command name)
 
51
cmd_exec () {
 
52
    test -n "$1" && { cd "$1" || { echo "* Can't cd to $1" >&2; exit 1; } }
 
53
    cd $(tla tree-root) || exit 1
 
54
    log "Generating CVS inventory"
 
55
    aba cvs-inventory > ,,inventory$$.cvs
 
56
    log "Generating TLA inventory"
 
57
    tla inventory -s -B > ,,inventory$$.tla
 
58
    sort -u ,,inventory$$.cvs -o ,,inventory$$.cvs
 
59
    sort -u ,,inventory$$.tla -o ,,inventory$$.tla
 
60
    diff ,,inventory$$.tla ,,inventory$$.cvs | aw_cvs_process_diff
 
61
    rm ,,inventory$$.cvs ,,inventory$$.tla
 
62
}
 
63
 
 
64
aba_run "$@"
 
65
# arch-tag: 03097d92-2a99-4a3d-9bd2-2a324e2e607f