Discussion:
[p4] Working out if a file is checked-out
Philip Lutas
2007-04-18 10:31:33 UTC
Permalink
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
David Weintraub
2007-04-18 12:30:40 UTC
Permalink
I think I found what you need:
http://www.perforce.com/perforce/doc.062/manuals/p4api/03_methods.html#1063862
Post by Philip Lutas
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
_______________________________________________
http://maillist.perforce.com/mailman/listinfo/perforce-user
--
--
David Weintraub
***@gmail.com
Shawn Hladky
2007-04-18 20:13:47 UTC
Permalink
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.
Post by Philip Lutas
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
_______________________________________________
http://maillist.perforce.com/mailman/listinfo/perforce-user
Continue reading on narkive:
Loading...