tags:

views:

811

answers:

3

Hi

I am new to Perforce and I am only used to CVS.

Question :

How can I figure out the state of the files in my client, I want to know if the file needs an updated, or patched, or modified etc. In CVS, I used to simply run "cvs -n -q update . > file". Later look for M,U,P,C attributes to get the current status of the file.

In perforce, "p4 sync -n" doesn't give output like "cvs -n -q update". How can I see the current status of files, in case of Perforce.

Thanks in advance.

+1  A: 

Not quite sure what you mean. If you are talking about seeing what files need "resolving" (in perforce language) then you can use:

p4 resolve -n

See the p4 command line manual website here: http://www.perforce.com/perforce/doc.current/manuals/cmdref/resolve.html#1040665

Also P4V has a nice feature to highlight unsubmitted and dirty files, if you use that client. Right-click on a fodler in the workspace view, and select "reconcile offline work." After a bit of processing you'll get a list of files that are out of sync with the depot.

Hope this helps.

tenpn
Thanks Tenpn. I am looking for a way to find if the file, needs an updated, has it been modified, or it needs to patched. So you have fair idea of what your sandbox is upto. I will check out the manual for resolve and "reconcile offline work". And yes, your answer helped. Thanks.
Karthi
+3  A: 

Not sure if this is what you're looking for, but the p4 diff command has a few useful options. From the usage:

    -sa     Opened files that are different from the revision
            in the depot, or missing.  
    -sb     Opened for integrate files that have been resolved
            but have been modified after being resolved.  
    -sd     Unopened files that are missing on the client.  
    -se     Unopened files that are different from the revision
            in the depot.  
    -sl     Every unopened file, along with the status of
            'same, 'diff', or 'missing' as compared to its
            revision in the depot.  
    -sr     Opened files that are the same as the revision in the
            depot.
Graeme Perrow
+3  A: 

To my knowledge, there isn't a command that will give you exactly what you want. In looking what the update command does, there is no single alternative in Perforce. I think that the closest that you will come will be to use the 'p4 fstat' command and parse the output from there to get the information that you need.

You might find this page helpful.

I also found this link to a p4wrapper that claims to wrap in come CVS commands (including update) into a script. There might be others like this one around as well.

I also wanted to comment that the answer to this question is like many with Perforce when asking "how do I do...". The answer usually comes down to writing a script to take the output from perforce commands to get the results that you need. Their philosophy is to provide bare bones commands and have developers build off of the basic functionality. Love it or hate it, that's the basic model. Many good scripts can be found in the Perforce Public Depot here.

Mark
Thanks for pointing to the scripts. I agree on the philosophy. I know what I want and it is me who can make it (via script). For reason unknown, I find Perforce documentation to be cryptic, I need to get into the documentation.
Karthi