[p4] 2006.1 client checker?

G. Matthew Rice matt at starnix.com
Tue Jul 11 07:31:50 PDT 2006


Karl Elvis MacRae <kmac at apple.com> writes:
> What I'm getting from this is that a client mapping like this won't work anymore:
> 
>      //depot/foo/....../bar/...    //my_client/foo/....../bar/...
> 
> (I know this is a dumb mapping, but it works in 2005.2, albeit with a performance cost)
> 
> My question is this - has anyone written a checker that will find (or
> better yet, fix) non-compliant clients? I have LOTS of clients that use
> mappings like the above (we had some sloppy code in an automated client
> generator), and I'll need to fix all these before I upgrade, I assume.

Here's a quick one for detecting:

    #!/bin/sh

    p4 clients | while read undef client undef; do
        p4 client -o $client | sed -e '1,/^View:/d' -e 's/\.\.\./REGEX/g' \
	    		       -e 's/*/REGEX/g' -e 's/%%[0-9]\+/REGEX/g' \
	    | grep 'REGEXREGEX' >/dev/null && echo "bad client: $client"
    done

I only tested it quickly.  It will detect _any_ two wildcards beside each
other (...*, *..., **, ......, %%9*).

Basically, it replaces any wildcard with the string REGEX and if grep sees
two REGEX strings beside each other, you have a bad client view.

I'd wait and see how many you have to fix before writing the cleaner.

HTH,
-- 
g. matthew rice <matt at starnix.com>           starnix, toronto, ontario, ca
phone: 647.722.5301 x242                                  gpg id: EF9AAD20
http://www.starnix.com              professional linux services & products



More information about the perforce-user mailing list