Reputation: 1850
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.
Upvotes: 5
Views: 22492
Reputation: 109
If you're in the UI you can use File->Export To... which will copy the selected file to any folder you want.
Upvotes: 1
Reputation: 71454
Shelve file1.cs so you can safely revert your local change:
p4 shelve file1.cs
p4 revert file1.cs
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:
p4 unshelve -s CHANGE
Upvotes: 0
Reputation: 7037
I found an easy way of doing this with git:
$ git p4 clone //depot/your/folder
Upvotes: 0
Reputation: 11662
So I want to get latest files except 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.
Upvotes: 0
Reputation: 1850
I found the workaround but not the solution.
I get another local copy of project then build the project and submit the change.
Upvotes: -2
Reputation: 2343
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:
>p4 print -o fileName.cs //depot/path/to/fileName.cs
Upvotes: 13
Reputation: 51
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.
Upvotes: 2