I\'m trying to figure out a way to detect files that are not opened for editing but have nevertheless been modified locally. p4 fstat
returns a value headModT
This SO question gives a way to do this in the P4V GUI:
In the Jan 2009 version of P4V, you can right-click on any folder in your workspace tree and click "reconcile offline work..."
This will do a little processing then bring up a split-tree view of files that are not checked out but have differences from the depot version, or not checked in at all. There may even be a few other categories it brings up.
You can right-click on files in this view and check them out, add them, or even revert them.
Later EDIT:
In the "Reconcile..." window, you can click 'Advanced Reconcile' and be presented with a two-pane, folder hierarchy diff window which is especially useful for finding files you need to add.
PROS: This whole P4V feature is more user-friendly than the command-line version (because it allows utmost granularity in selecting what to reconcile)
CONS: It is in dire need of a subversion/git/hg .ignore
-like list, to spare you the pain of manually skipping all the dll's and other cruft in your projects.
As of Perforce version 2012.1, use the command line commands p4 status
and p4 reconcile
http://www.perforce.com/perforce/r12.2/manuals/cmdref/status.html
The
p4 status
command finds unopened files in a client's workspace and detects the following three types of inconsistencies between your workspace and the depot:
- Files present in the depot, present in your have list, but missing from your workspace. By default, these files are then opened for delete.
- Files present in your workspace, but missing on the depot. By default, these files are opened for add.
- Files modified in your workspace that are not open for edit. By default, these files are opened for edit.
http://www.perforce.com/perforce/r12.1/manuals/cmdref/reconcile.html
Here's a unix solution that has worked very well for me.
How to find untracked files in a Perforce tree? (analogue of svn status)
From: http://answers.perforce.com/articles/KB/3481/?q=disconnected&l=en_US&fs=Search&pn=1
See step 2 specifically:
2 . Next, open for "edit" any files that have changed:
p4 diff -se //myclient/... | p4 -x - edit
p4 diff -se returns the names of depot files whose corresponding client file differs in any way from the clients #have revision.
From the working disconnected article, using p4win you can also select the folder/files in question and select 'file menu->more->check consistency' which basically does the 'p4 diff -se' and 'p4 diff -sd', and prompts the user to resolve the inconsistencies.