[p4] Detecting if a client exists (cheaply)

Shawn Hladky p4shawn at gmail.com
Wed Feb 6 15:27:11 PST 2008


I do a p4 info and look for Client unknown (or clientName=*unknown* with
ztag/api)
C:\>p4 -c bogus info
User name: shawnh
Client name: bogus
Client host: shawnhpc
Client unknown.

C:\>p4 -ztag -c bogus info
... userName shawnh
... password enabled
... clientName *unknown*

On Feb 6, 2008 1:13 PM, Ivey, William <william_ivey at bmc.com> wrote:

> It's kind of hacky, but this will probably do it:
>
> p4 -d bogusroot client -o clientName | grep "Root:.*bogusroot"
>
> An existing client will ignore the current directory override
> and show a real root path.
>
> -Wm
>
> -----Original Message-----
> From: perforce-user-bounces at perforce.com
> [mailto:perforce-user-bounces at perforce.com] On Behalf Of Brad Holt
> Sent: Wednesday, February 06, 2008 1:51 PM
> To: perforce-user at perforce.com
> Subject: [p4] Detecting if a client exists (cheaply)
>
> Can't seem to find a quick way to do it.  I can dump the list and check,
> but this will be part of a tool that may want to check frequently, and
> for those folks on the other side of the world, this would gum up the
> works.
>
> Running "p4 client testclient" will create a new "testclient" if it does
> not exist.  Trying to delete a client that's not your will throw a
> useful error either way (whether it exists or not), but if that client
> is actually yours or ownerless, then you can accidentally delete it.  I
> tried using "p4 client -t testclient" which was useful if the client to
> use as a template did not exist, but was actually very strange if it
> did.  The usual array of passed in flags (-s, -ztag, etc) yielded
> nothing useful.
>
> One of you has surely sorted this out already surely.  Gimme.
>
> _______________________________________________
> perforce-user mailing list  -  perforce-user at perforce.com
> http://maillist.perforce.com/mailman/listinfo/perforce-user
>
> _______________________________________________
> perforce-user mailing list  -  perforce-user at perforce.com
> http://maillist.perforce.com/mailman/listinfo/perforce-user
>



More information about the perforce-user mailing list