info-cvs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Removing 'watchers' who have left


From: Jim.Hyslop
Subject: Removing 'watchers' who have left
Date: Wed, 23 Feb 2005 15:17:46 -0500

With our repository having been around for quite a while, and many people
having left (in particular co-op students who are around for four months),
our list of 'watchers' now has quite a bit of dead wood in it. "cvs
watchers" lists people who haven't been around for a while.

Until someone implements an 'rwatch' command (or at least adds a '-w [who]'
option to watch) the only alternatives I know of are to manually edit the
CVS/fileattr file in the repository, or to impersonate the person who left,
check out everything they worked on and issue a 'cvs watch remove' command.

To simplify manually editing the CVS/fileattr file, I've put together these
scripts:

#!/bin/bash
# file: unwatch
if ! test "$1" ; then
        echo usage: $0 unwatch username
        echo where username is the user who is to be removed from watches
        exit 1;
fi
execdir=`echo "$0" | sed 's/\/[^\/]*$//'`
find -name fileattr -exec $execdir/dounwatch {} $1 \;

#!/bin/bash
# file: dounwatch
USER="$2"
sed -e
's/\([=;,]\)'$USER'>[^;,]*/\1/;s/_watchers=$//;s/_watchers=,/_watchers=/;s/_
watchers=;//;s/,\([;,]\)/\1/;s/[;,]$//' $1 | grep "=" > $1.tmp
mv $1 $1.bk
mv $1.tmp $1

(the 'sed' line is all one line in the script)

The intent is to run this script from the $CVSROOT directory.

Running 'unwatch userA' against a fileattr (in my home directory) with these
contents:

FFile   _watchers=userA>edit+unedit+commit
FFile1  _watchers=userA>edit+unedit+commit,userB>edit+unedit+commit
FFile2  _watchers=userB>edit+unedit+commit,userA>edit+unedit+commit
FFile3
_watchers=userA>edit+unedit+commit,userB>edit+unedit+commit,userC>edit+unedi
t+commit
FFile4
_watchers=userB>edit+unedit+commit,userA>edit+unedit+commit,userC>edit+unedi
t+commit
FFile5
_watchers=userB>edit+unedit+commit,userC>edit+unedit+commit,userA>edit+unedi
t+commit
FFile6  _watched=
FFile7  _watched=;_watchers=userA>edit+unedit+commit
FFile8
_watched=;_watchers=userA>edit+unedit+commit,userB>edit+unedit+commit
FFile9
_watched=;_watchers=userB>edit+unedit+commit,userA>edit+unedit+commit
FFile10
_watched=;_watchers=userA>edit+unedit+commit,userB>edit+unedit+commit,userC>
edit+unedit+commit
FFile11
_watched=;_watchers=userB>edit+unedit+commit,userA>edit+unedit+commit,userC>
edit+unedit+commit
FFile12
_watched=;_watchers=userB>edit+unedit+commit,userC>edit+unedit+commit,userA>
edit+unedit+commit
FFile13 _watchers=userA>edit+unedit+commit;_watched=
FFile14
_watchers=userA>edit+unedit+commit,userB>edit+unedit+commit;_watched=
FFile15
_watchers=userB>edit+unedit+commit,userA>edit+unedit+commit;_watched=
FFile16
_watchers=userA>edit+unedit+commit,userB>edit+unedit+commit,userC>edit+unedi
t+commit;_watched=
FFile17
_watchers=userB>edit+unedit+commit,userA>edit+unedit+commit,userC>edit+unedi
t+commit;_watched=
FFile18
_watchers=userB>edit+unedit+commit,userC>edit+unedit+commit,userA>edit+unedi
t+commit;_watched=
D
_watchers=userB>edit+unedit+commit,userC>edit+unedit+commit,userA>edit+unedi
t+commit;_watched=

seems to work OK. Can anyone see any test cases I've overlooked? Any other
options I've overlooked?

-- 
Jim Hyslop
Senior Software Designer
Leitch Technology International Inc. ( http://www.leitch.com
<http://www.leitch.com>  )
Columnist, C/C++ Users Journal ( http://www.cuj.com/experts
<http://www.cuj.com/experts>  )







reply via email to

[Prev in Thread] Current Thread [Next in Thread]