Re: How to remove cvs watches set by other users

Shane Turner <[email protected]>
Newsgroups gmane.comp.version-control.cvs.general
Message-ID <[email protected]>
Rez wrote:
> Hi all
>  
> How do I remove cvs watches set by other users who are no longer with 
> our company?  Is there any way to do this?
>  
> Thanks
>  
> Rez

Here's how I remove cvs watches from my repository (cvs 1.11.22). There
may of course be bugs. It requires filesystem access to the repository.
In general it looks for all of the fileattr files with watches or edits
for the OLDUSER, saves the list, and backs them all up. Then you feed
the list to xargs and and perl to re-write all of the fileattr files
without the entries for the OLDUSER. WARNING: It does not lock the
directories! This hasn't been an issue for me, but there could be
weirdness if someone runs a command that would edit the same fileattr
files you are modifying.

export CVSROOT=<PATH_TO_YOUR_CVSROOT>
export OLDUSER=/USERNAME/
find $CVSROOT -type f -name fileattr -print0 | xargs --null grep -lZ 
"\<$OLDUSER\>>" | tee /tmp/fileattr_list.txt |
  tar --null -T - -zcf /tmp/fileattr_backup.tar.gz
cat /tmp/fileattr_list.txt | xargs --null perl -wpi -e '
BEGIN {
  use Getopt::Std;

  our ($opt_u);

  getopts("u:");

  die "Username not set (-u)" unless $opt_u;

  $username=$opt_u;
}

s/([,=])($username>[^,;]*?)(?=[,;]|$)/$1/go; # Clean up entries for the 
username that are within or ending the line
s/,,/,/g;                                    # Clean up entries with 
double commas
s/(?==),//g;                                 # Clean up entries that 
start with a comma
s/,(?=;_\w*=)//g;                            # Clean up entries that end 
with a comma
s/,$//;                                      # Clean up commas at  the 
end of a line
' -- -u $OLDUSER

I hope the commands are of some use to you.


Shane Turner
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.