如何将文件从 perforce 下载到工作区以外的位置?
我想从 Perforce 获取文件而不将它们放入工作区。
例如 我已经更改了 2 个文件。
file1.cs
file2.cs
现在我想使用更新的 file1.cs 构建项目,因此我想获取除 file1.cs 之外的最新文件。
我想我会得到另一个项目的本地副本并构建它。
I want to get files from Perforce without putting them into a workspace.
E.g.
I have made changes in 2 files.
file1.cs
file2.cs
Now I want to build the project using updated file1.cs, so I want to get latest files except for file1.cs.
I thought I will get another local copy of project and build it.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(7)
我不确定您真正想要做什么,但是您可以通过使用“p4 print"。例子:
I'm not sure what you really want to do, but you can get the contents of a file from the depot without using a workspace definition by using "p4 print". Example:
据我所知,如果不使用工作区,则无法从 Perforce 仓库同步文件,因为这是它跟踪工作区中文件版本以及将它们放在本地计算机上的位置的方式(以及一些其他事情)。
我不确定我完全理解你的问题,但如果你需要做的是获取仓库中 file1.cs 的另一个副本,而不删除你对其所做的更改,你可以简单地将更改复制到另一个位置或搁置他们并重新同步文件。更完整且危险性较小的解决方案是创建另一个工作区,指向计算机上的不同物理位置但相同的仓库位置。
这解释了如何在需要时创建工作区:
http://www.perforce.com/perforce/doc.062 /manuals/boilerplates/quickstart.html
确保“根”路径与当前工作区的路径不同,您可以通过转到 P4V 中的工作区选项卡并查看来检查当前工作区根目录。
创建新工作区后,创建一个新连接并选择它,然后同步您需要的文件。
As far as I am aware you cannot sync files from a Perforce depot without using a workspace since this is the way it tracks what version of files you have in your workspace and also where to put them on your local machine (as well as a few other things).
I'm not sure I entirely understand your problem but if what you need to do is get another copy of the file1.cs you have in the depot without removing the changes you have to it you can simply copy the changes to another location or shelve them and re-sync the file. The more complete and less dangerous solution is to create another workspace pointing to a different physical location on your machine but the same depot location.
This explains how to create a workspace if you need it:
http://www.perforce.com/perforce/doc.062/manuals/boilerplates/quickstart.html
Make sure the 'Root' path is different to that of your current workspace, you can check what your current workspaces root is by going to the workspace tab in P4V and viewing it.
Once you have created the new workspace create a new connection and select it then sync the file(s) you need.
如果您在用户界面中,则可以使用“文件”->“导出到...”,这会将所选文件复制到您想要的任何文件夹。
If you're in the UI you can use File->Export To... which will copy the selected file to any folder you want.
你不应该这样做;您应该更新所有文件并解决与 file1.cs 的任何冲突
考虑以下情况:其他人对 file56.cs 进行了更改,而该更改又依赖于对 file1.cs 所做的更改。如果您采用他们的更改列表但覆盖(或不采用)他们的 file1.cs,那么您的构建将会中断。
You shouldn't do that; you should update all files and resolve any conflicts with file1.cs
Consider the situation where someone else has made changes to file56.cs that relies on changes also made to file1.cs. If you take their changelist but overwrite (or do not take) their file1.cs, then your build will break.
我找到了一种使用 git 实现此操作的简单方法:
I found an easy way of doing this with git:
搁置 file1.cs,以便您可以安全地恢复本地更改:
现在您可以使用您想要的任何版本的 file1.cs 进行构建(您可以同步回旧版本或其他版本)。
当您准备好返回找零时:
Shelve file1.cs so you can safely revert your local change:
Now you can do your build with whatever version of file1.cs you want (you can sync back to an older version or whatever).
When you're ready to return to your change:
我找到了解决方法,但没有找到解决方案。
我获取项目的另一个本地副本,然后构建项目并提交更改。
I found the workaround but not the solution.
I get another local copy of project then build the project and submit the change.