Detecting Perforce unopened modified files

perforce

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 headModTime for any given file, but this is the change time in the depot, which should not be equal to the filesystem's stat last modified time.

I'm hoping that there exists a more lightweight operation than backing up the original file, forcing a sync of the file, and then running a diff. Ideas?

Best Answer

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.