2

(我通过 perforce 插件从 eclipse 中使用 perforce)。

将我的工作区与 perforce 库关联后,所有文件的状态为“工作区中的版本不是最新版本”(黄色三角形)....

当文件具有此状态时,该文件的提交被禁用。

当我对项目执行“与仓库同步”时,所有这些文件都会显示冲突图标(即使没有冲突......)。

冲突?这是否意味着我需要解决?

以下是如何解决: http ://www.perforce.com/perforce/doc.current/manuals/p4guide/05_resolve.html

问题是......通过“解决” perforce 用仓库中的文件覆盖我工作区中的所有文件。因此,在将工作区与 perforce 关联之前,我对工作区所做的所有更改都消失了。

我真正想要实现的是相反的方式:将我工作区中的所有文件提交到仓库。即覆盖仓库。

我怎样才能做到这一点?

4

3 回答 3

1

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.

于 2013-03-18T16:03:09.320 回答
1

如果 perforce 说您无法提交,因为“工作区中的版本不是最新版本”,那么这意味着您打开了一个文件以进行编辑,该文件已被其他人更改并提交,即您正在处理旧版本的文件。您绝对不应该尝试将您的(旧)版本强加在仓库中的新版本之上。你真的需要解决。Perforce 不会“覆盖”您工作区的所有文件并放弃您的更改。

对于合并(解析),您可以使用 eclipse 内置的合并工具或 p4merge(来自 Perforce)。

于 2013-03-18T12:57:35.403 回答
0

我不认为你可以在 Perforce 中实现你想要的。您需要将已更改的文件复制到安全的地方,然后解决/还原所有文件以删除冲突/过期标志。完成后,将您的更改复制回来并提交。这很痛苦,但您应该在进行更改之前与 Perforce 建立联系。

于 2013-03-18T13:05:07.583 回答