rapt
rapt

Reputation: 12230

Perforce: submit files with "Version in workspace is not latest version"?

(I work with perforce from eclipse by the perforce plugin).

After associating my workspace with a perforce depot, all the files got status "Version in workspace is not latest version" (yellow triangle)....

When a file has this status, submit is disabled for this file.

When I do "Sync with depot" on a project, all those files show the conflict icon (even when there's no conflict...).

Conflict? does it mean I need to resolve?

Here is how to do resolve: http://www.perforce.com/perforce/doc.current/manuals/p4guide/05_resolve.html

The problem is... by "resolving" perforce overrides all the files in my workspace with the files in the depot. So every change I made to the workspace before associating it to perforce is gone.

What I actually want to achieve is the other way around: submit all the files in my workspace to the depot. i.e. override the depot.

How can I do that?

Upvotes: 2

Views: 3199

Answers (3)

Commodore Jaeger
Commodore Jaeger

Reputation: 33390

As other answers say, most of the time your best bet is to work with Perforce's workflow and check out the workspace in advance and make your changes there, rather than make changes first and create the workspace later. Sometimes, though, you really do need to break Perforce's workflow and override the changes in the depot. If you're going to do that, you need to be extra careful that you're not reverting something important. (Even on a one-person project you might have forgotten you checked something in, so look carefully at the diffs before submitting.)

The easiest thing to do is, when Perforce tells you that you have a conflict, resolve but keep your changes. In the Perforce documentation link, that's 'resolve, accept yours' rather than accepting what Perforce thinks is the sensible merge. From the command line, that's p4 resolve -ay. It's worded a little differently in the p4v GUI, and may be worded differently still in the Eclipse plugin (which I haven't actually worked with).

The other option, which you might use if you have files checked out from an earlier revision, and you want to update to the tip revision without making any changes, is to tell Perforce to update the metadata, so that it thinks you have a newer version of the file, without actually altering any of your files. From the command line, that's p4 sync -k (whatever you want to sync). This, too, can be dangerous if used inappropriately.

Upvotes: 1

ninesided
ninesided

Reputation: 23263

I don't think you can achieve what you want in Perforce. You will need to copy the files you've changed to a safe place and then resolve/revert all of the files to remove the conflict/out of date flag. Once done, copy your changes back and submit. It's a pain, but you should have connected with Perforce before making your changes.

Upvotes: 0

pitseeker
pitseeker

Reputation: 2543

If perforce says that you cannot submit because "Version in workspace is not latest version", then this means that you have a file open for edit that was already changed and submitted by someone else, i.e. you're working on an old version of the file. You definitely should not try to force your (old) version on top of the newer one in the depot. You really need to resolve. Perforce will not "override" all the files your workspace and discard your changes.

For merging (resolving) you can use the eclipse built-in merge tool or the p4merge (from Perforce).

Upvotes: 1

Related Questions