[p4] Detecting if a client exists (cheaply)

Brian Moyers bsmoyers at gmail.com
Wed Feb 6 14:02:15 PST 2008


What I do is this:

p4 client -o clientname | egrep "^Access"

If the client has an access time, it is an existing client, if not, it
is new.  Beware this is not fool proof, but I decided to use this
method because it has very low overhead.

-Brian

On Feb 6, 2008 2:07 PM, Roy Smith <smith_roy at emc.com> wrote:
> How about:
>
> % p4 files //spec/client/smithr3-xxx.p4s
> //spec/client/smithr3-xxx.p4s - no such file(s).
>
> The only problem is is looks like you need to pattern match stdout
> for "no such file"; the exit code is 0 whether the client exists or not.
>
>
> On Feb 6, 2008, at 2:50 PM, Brad Holt wrote:
>
> > 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
> >
>
> -------------------
> Roy Smith <smith_roy at emc.com>
> Software Guy, EMC Common Management Group
> 44 South Broadway, 7th floor
> White Plains, NY 10601
> (914) 580-3427
> AIM: roysmith649
>
> _______________________________________________
> 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