Info Node: (cvsbook.info)Finding Out Who Is Watching What
(cvsbook.info)Finding Out Who Is Watching What
Finding Out Who Is Watching What
--------------------------------
Sometimes you may want to know who's watching before you even run cvs
edit or want to see who is editing what without adding yourself to any
watch lists. Or you may have forgotten exactly what your own status is.
After setting and unsetting a few watches and committing some files,
it's easy to lose track of what you're watching and editing.
CVS provides two commands to show who's watching and who's editing files
- cvs watchers and cvs editors:
floss$ whoami
jrandom
floss$ cvs watch add hello.c
floss$ cvs watchers hello.c
hello.c jrandom edit unedit commit
floss$ cvs watch remove -a unedit hello.c
floss$ cvs watchers hello.c
hello.c jrandom edit commit
floss$ cvs watch add README.txt
floss$ cvs watchers
README.txt jrandom edit unedit commit
hello.c jrandom edit commit
floss$
Notice that the last cvs watchers command doesn't specify any files and,
therefore, shows watchers for all files (all those that have watchers,
that is).
All of the watch and edit commands have this behavior in common with
other CVS commands. If you specify file names, they act on those files.
If you specify directory names, they act on everything in that directory
and its subdirectories. If you don't specify anything, they act on the
current directory and everything underneath it, to as many levels of
depth as are available. For example (continuing with the same session):
floss$ cvs watch add a-subdir/whatever.c
floss$ cvs watchers
README.txt jrandom edit unedit commit
hello.c jrandom edit commit
a-subdir/whatever.c jrandom edit unedit commit
floss$ cvs watch add
floss$ cvs watchers
README.txt jrandom edit unedit commit
foo.gif jrandom edit unedit commit
hello.c jrandom edit commit unedit
a-subdir/whatever.c jrandom edit unedit commit
a-subdir/subsubdir/fish.c jrandom edit unedit commit
b-subdir/random.c jrandom edit unedit commit
floss$
The last two commands made jrandom a watcher of every file in the
project and then showed the watch list for every file in the project,
respectively. The output of `cvs watchers' doesn't always line up
perfectly in columns because it mixes tab stops with information of
varying length, but the lines are consistently formatted:
[FILENAME] [whitespace] WATCHER [whitespace] ACTIONS-BEING-WATCHED...
Now watch what happens when qsmith starts to edit one of the files:
paste$ cvs edit hello.c
paste$ cvs watchers
README.txt jrandom edit unedit commit
foo.gif jrandom edit unedit commit
hello.c jrandom edit commit unedit
qsmith tedit tunedit tcommit
a-subdir/whatever.c jrandom edit unedit commit
a-subdir/subsubdir/fish.c jrandom edit unedit commit
b-subdir/random.c jrandom edit unedit commit
The file hello.c has acquired another watcher: qsmith himself (note that
the file name is not repeated but is left as white space at the
beginning of the line - this would be important if you ever wanted to
write a program that parses watchers output). Because he's editing
hello.c, qsmith has a "temporary watch" on the file; it goes away as
soon as he commits a new revision of hello.c. The prefix `t' in front
of each of the actions indicates that these are temporary watches. If
qsmith adds himself as a regular watcher of hello.c as well
paste$ cvs watch add hello.c
README.txt jrandom edit unedit commit
foo.gif jrandom edit unedit commit
hello.c jrandom edit commit unedit
qsmith tedit tunedit tcommit edit unedit commit
a-subdir/whatever.c jrandom edit unedit commit
a-subdir/subsubdir/fish.c jrandom edit unedit commit
b-subdir/random.c jrandom edit unedit commit
he is listed as both a temporary watcher and a permanent watcher. You
may think that the permanent watch status would simply override the
temporary, so that the line would look like this:
qsmith edit unedit commit
However, CVS can't just replace the temporary watches because it doesn't
know in what order things happen. Will qsmith remove himself from the
permanent watch list before ending his editing session, or will he
finish the edits while still remaining a watcher? If the former, the
edit/unedit/commit actions disappear while the tedit/tunedit/tcommit
ones remain; if the latter, the reverse would happen.
Anyway, that side of the watch list is usually not of great concern.
Most of the time, what you want to do is run
floss$ cvs watchers
or
floss$ cvs editors
from the top level of a project and see who's doing what. You don't
really need to know the details of who cares about what actions: the
important things are people and files.