tags:

views:

689

answers:

3

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?

+6  A: 

From: http://kb.perforce.com/UserTasks/WorkingDisconnected

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.

grieve
+1  A: 

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.

Epu
+4  A: 

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.

Cristi Diaconescu
having used p4v now for a year, I like this answer a lot. benefit is that this method also finds files for add (files not under source control in your workspace). if you have lots of garbage intermediate object clutter in your workspace, it can be a bit of a pain though.
Epu