Work around MinGW mangling of "host:/path"
[msysgit/historical-msysgit.git] / lib / cvs / contrib / cvscheck
blobf711b430e0f340b87f6971aff0bc5e3a349e1072
1 #! /bin/sh
3 # cvscheck - identify files added, changed, or removed
4 # in CVS working directory
6 # Contributed by Lowell Skoog <fluke!lowell@uunet.uu.net>
7 #
8 # This program should be run in a working directory that has been
9 # checked out using CVS. It identifies files that have been added,
10 # changed, or removed in the working directory, but not "cvs
11 # committed". It also determines whether the files have been "cvs
12 # added" or "cvs removed". For directories, it is only practical to
13 # determine whether they have been added.
15 name=cvscheck
16 changes=0
18 # If we can't run CVS commands in this directory
19 cvs status . > /dev/null 2>&1
20 if [ $? != 0 ] ; then
22 # Bail out
23 echo "$name: there is no version here; bailing out" 1>&2
24 exit 1
27 # Identify files added to working directory
28 for file in .* * ; do
30 # Skip '.' and '..'
31 if [ $file = '.' -o $file = '..' ] ; then
32 continue
35 # If a regular file
36 if [ -f $file ] ; then
37 if cvs status $file | grep -s '^From:[ ]*New file' ; then
38 echo "file added: $file - not CVS committed"
39 changes=`expr $changes + 1`
40 elif cvs status $file | grep -s '^From:[ ]*no entry for' ; then
41 echo "file added: $file - not CVS added, not CVS committed"
42 changes=`expr $changes + 1`
45 # Else if a directory
46 elif [ -d $file -a $file != CVS.adm ] ; then
48 # Move into it
49 cd $file
51 # If CVS commands don't work inside
52 cvs status . > /dev/null 2>&1
53 if [ $? != 0 ] ; then
54 echo "directory added: $file - not CVS added"
55 changes=`expr $changes + 1`
58 # Move back up
59 cd ..
61 done
63 # Identify changed files
64 changedfiles=`cvs diff | egrep '^diff' | awk '{print $3}'`
65 for file in $changedfiles ; do
66 echo "file changed: $file - not CVS committed"
67 changes=`expr $changes + 1`
68 done
70 # Identify files removed from working directory
71 removedfiles=`cvs status | egrep '^File:[ ]*no file' | awk '{print $4}'`
73 # Determine whether each file has been cvs removed
74 for file in $removedfiles ; do
75 if cvs status $file | grep -s '^From:[ ]*-' ; then
76 echo "file removed: $file - not CVS committed"
77 else
78 echo "file removed: $file - not CVS removed, not CVS committed"
80 changes=`expr $changes + 1`
81 done
83 exit $changes