3 # Copyright (C) 1995-2005 The Free Software Foundation, Inc.
5 # This program is free software; you can redistribute it and/or modify
6 # it under the terms of the GNU General Public License as published by
7 # the Free Software Foundation; either version 2, or (at your option)
10 # This program is distributed in the hope that it will be useful,
11 # but WITHOUT ANY WARRANTY; without even the implied warranty of
12 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 # GNU General Public License for more details.
15 # sandbox_status - identify files added, changed, or removed
16 # in CVS working directory
18 # Contributed by Lowell Skoog <fluke!lowell@uunet.uu.net>
20 # This program should be run in a working directory that has been
21 # checked out using CVS. It identifies files that have been added,
22 # changed, or removed in the working directory, but not "cvs
23 # committed". It also determines whether the files have been "cvs
24 # added" or "cvs removed". For directories, it is only practical to
25 # determine whether they have been added.
30 # If we can't run CVS commands in this directory
31 cvs status .
> /dev
/null
2>&1
35 echo "$name: there is no version here; bailing out" 1>&2
39 # Identify files added to working directory
43 if [ $file = '.' -o $file = '..' ] ; then
48 if [ -f $file ] ; then
49 if cvs status
$file |
grep -s '^From:[ ]*New file' ; then
50 echo "file added: $file - not CVS committed"
51 changes
=`expr $changes + 1`
52 elif cvs status
$file |
grep -s '^From:[ ]*no entry for' ; then
53 echo "file added: $file - not CVS added, not CVS committed"
54 changes
=`expr $changes + 1`
58 elif [ -d $file -a $file != CVS.adm
] ; then
63 # If CVS commands don't work inside
64 cvs status .
> /dev
/null
2>&1
66 echo "directory added: $file - not CVS added"
67 changes
=`expr $changes + 1`
75 # Identify changed files
76 changedfiles
=`cvs diff | egrep '^diff' | awk '{print $3}'`
77 for file in $changedfiles ; do
78 echo "file changed: $file - not CVS committed"
79 changes
=`expr $changes + 1`
82 # Identify files removed from working directory
83 removedfiles
=`cvs status | egrep '^File:[ ]*no file' | awk '{print $4}'`
85 # Determine whether each file has been cvs removed
86 for file in $removedfiles ; do
87 if cvs status
$file |
grep -s '^From:[ ]*-' ; then
88 echo "file removed: $file - not CVS committed"
90 echo "file removed: $file - not CVS removed, not CVS committed"
92 changes
=`expr $changes + 1`