[p4] Working out if a file is checked-out

Shawn Hladky p4shawn at gmail.com
Wed Apr 18 13:13:47 PDT 2007


During a sync if a file is opened, Perforce will warn you.  In the C++ API,
you can intercept those warnings by overriding ClientUser::Message.  For
each file that's opened, you'll get something similar to the following.
Parse the messages to get the file paths.

//depot/path/file#3 - is opened and not being changed
//depot/path/file - must resolve #3 before submitting

To get a full list of opened files (regardless of changelist), use the
opened command.


On 4/18/07, Philip Lutas <plutas at reflectionsinteractive.com> wrote:
>
> I'm working with the C++ Perforce API and am trying to find out if a given
> file is checked-out when performing a sync operation.
>
> Currently the idea is to call pending changes for the user, iterate
> through
> them via changelist and then find any matches with any writable files that
> are to be sync'ed.
>
> My first problem is that 'change' command doesn't appear to work with the
> default changelist in the P4V client. Is the default changelist specific
> to
> the P4V tool and if so can I workaround it?
>
> In addition is my method for finding a checked-out file the correct/most
> efficient way to do so? Is this even the right way of thinking? For
> instance
> if I call sync on a checked-out file, should I be instead providing a way
> to
> manage the merge? This is not ideal for the tool as it should be automated
> but is something I could look into.
>
> The files to be merged are both binary (locked to one user check-out) and
> text (multiple check-outs).
>
> Any help/opinions would be appreciated.
>
> -Phil
> _______________________________________________
> 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