]> git.wh0rd.org - home.git/blob - .bin/cvs-import
bugz: update progs to use ~/.bugzrc
[home.git] / .bin / cvs-import
1 #!/bin/bash
2
3 if [[ $# -eq 0 ]] || [[ $1 == "-h" ]] ; then
4 echo "Usage: ${0##*/} <dir to import> [more dirs]"
5 exit 1
6 fi
7
8 dir=$1
9 if [[ ! -e ${dir} ]] ; then
10 echo "cvs-import: $1: directory does not exist" 1>&2
11 exit 1
12 fi
13 dir=$(realpath "${dir}")
14
15 echo "Importing ${dir} and kids"
16 cd ${dir}/..
17 cvs -Q add ${dir##*/}
18
19 find_files() {
20 find . -mindepth $1 -maxdepth $1 '!' '(' -name 'CVS' -o -wholename '*/CVS/*' ')' -print0
21 }
22
23 cd ${dir}
24 i=1
25 while [[ -n $(find_files ${i}) ]] ; do
26 echo "Importing at depth ${i}"
27 find_files ${i} | xargs -0 cvs -Q add
28 ((++i))
29 done
30
31 echo "Done"