Question

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?

Was it helpful?

Solution

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.

OTHER TIPS

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:

  1. Files present in the depot, present in your have list, but missing from your workspace. By default, these files are then opened for delete.
  2. Files present in your workspace, but missing on the depot. By default, these files are opened for add.
  3. 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

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.

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)

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top