~abentley/bzrtools/bzrtools.dev

« back to all changes in this revision

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

  • Committer: Alexander Belchenko
  • Date: 2008-04-28 15:35:42 UTC
  • mto: This revision was merged to the branch mainline in revision 635.
  • Revision ID: bialix@ukr.net-20080428153542-x9noc2v7uxr5w1b0
properly using HardlinkFeature in tests.

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-inventory "Inventory from CVS/Entries files"
12
 
}
13
 
 
14
 
# short help for aba command -h, --help
15
 
cmd_help () {
16
 
    cat <<EOH
17
 
aba cvs-inventory [dir]
18
 
Generate inventory listing from CVS/Entries files."
19
 
EOH
20
 
}
21
 
 
22
 
# extended help for aba command -H or aba help command
23
 
cmd_ext_help () {
24
 
    cat <<EOH
25
 
 
26
 
This command processes CVS metafiles and generates CVS analog of
27
 
tla inventory --both --sources
28
 
EOH
29
 
}       
30
 
 
31
 
aw_cvs_cat_patterns () {
32
 
    sed -n 's/\([\\|.+()]\)/\\\1/g;s/*/.*/g;s/?/./g;/./p' < $1
33
 
}
34
 
 
35
 
aw_cvs_cat_entries () {
36
 
    base=${1%CVS/Entries} # Strip
37
 
    base=${base#./} # Normalize
38
 
    sed -n "s:[^/]*/\([^/]*\).*:$base\1:p" < $1
39
 
    cat <<END-OF-CVS-METAS
40
 
${base}CVS
41
 
${base}CVS/Entries
42
 
${base}CVS/Repository
43
 
${base}CVS/Root
44
 
END-OF-CVS-METAS
45
 
    if [ -r "$1.Log" ]; then
46
 
        sed -n "s:[^/]*/\([^/]*\).*:$base\1:p" < "$1.Log"
47
 
        cat <<END-OF-CVS-METAS
48
 
${base}CVS/Entries.Log
49
 
END-OF-CVS-METAS
50
 
    fi
51
 
}
52
 
 
53
 
aw_cvs_cat_all_entries () {
54
 
    while read line; do
55
 
        aw_cvs_cat_entries "$line"
56
 
    done
57
 
}
58
 
 
59
 
aw_cvs_tla_inventory () {
60
 
    tla inventory -s -B
61
 
}
62
 
 
63
 
# executes the command ("$@" are the arguments after the command name)
64
 
cmd_exec () {
65
 
    test -n "$1" && { cd "$1" || { echo "* Can't chdir to $1" >&2; exit 1; } }
66
 
    find -path '*/CVS/Entries' | aw_cvs_cat_all_entries
67
 
}
68
 
 
69
 
aba_run "$@"
70
 
# arch-tag: 86262ef1-e994-461c-b608-b47cbdf45fe2