Have you ever been frustrated with the p4 protect table? I know I have.
So, I decided to do something about it. I have written a perl script
which processes a higher-level protection table and generates a
perforce-compatible one. An example of the higher-level table is in the
file "sample" located in the same directory as this readme.
The main thing I realized is that I wanted to control access primarily by
directory, and I also wanted to be able to comment the file. You'll notice
that the file has lines that start with perforce file specifications,
followed by the access lines for the specification. Multiple
specifications can be placed together, and multiple access lines can come
after them, which will generate one protection line for each file
specification and access line pair. Lines that begin with // or -// are
considered file specifications, and lines that begin with the pound sign
(#) are comments. Leading and trailing whitespace is ignored. All other
lines are treated as access lines. The script will generate output in the
order of the input access lines.
You should run the script like this:
perl protect.pl sample > protect.txt
(examine protect.txt here to make sure it's correct)
p4 protect -i < protect.txt
You can, of course, pipe the output directly into p4 protect like so:
perl protect.pl sample | p4 protect -i
jeff grills