I need to sync the P4 files on linux machine with changelist number and also save the file locally along with changelist number, say
file - abc#2003 should be copied to local machine as abc#2003
Thanks in advance
Related
I have never used P4 version control system before, and just come across with following problem:
I was submitted a project to server with lots of redundant files and have been working on the project actively. Now I have my project working and clean, and want to synchronize with depot. The problem is that I have deleted lots of files manually in windows file explorer(from my workspace),ignoring the rules of p4(mark for deletion, submit etc.).
How can I synchronize my project with depot? With another word, how can I delete files from depot that I have manually deleted from local folder, which are not shown in "workspace" tab.
Run the command:
p4 reconcile
This will automatically scan your entire workspace for added/deleted/modified/renamed files and open them for the appropriate actions. Once you've run reconcile you can just p4 submit as normal, and everything you did in your workspace should get submitted to the depot.
If you're using P4V, I think there's a "Reconcile..." menu command that will do something similar.
I want to get the list of files that has been changed on server since last sync down on a particular branch.
I want only the files that has been changed/added on the server. I am not at all concerned with the locally changed files.
p4 sync -n shows you the files that will be synced.
p4 sync -N gives you a summary.
What will happen if I cancel p4 sync during operation and then call again? Will it do all the work it has already done again?
And another one question: how and where does p4 store information about workspace file revisions? How does it know that I have n-th revision in workspace?
Does it store such a local workspace-specific information on the server's side or locally?
If you interrupt a "p4 sync", it will pick up where it left off (at the file level of granularity -- if you're syncing a single large file it'll start over, but if you're syncing a lot of files it'll start with the next file after the last one that was synced successfully).
Information about which file revisions you have in your workspace is stored on the server. Run the "p4 have" command to see this information for your workspace. You can also run commands like "p4 files #otherclient" to see which revisions another workspace ("otherclient") has synced (e.g. if you're trying to reproduce a build from another workspace).
I have 2 p4v set up on Windows and Linux. I was wondering if I can edit the code on Windows, create a pending changelist (this changelist belongs to a p4_windows_client). Then switch to Linux, which opens another p4_linux_client, to merge Windows pending changelist in order to build the project on Linux. The reason to have 2 different client {p4_windows_client, p4_linux_client} is because the root folder path issue as one is like C:\p4clientRoot, another is /home/p4client-root. I was wondering if this is possible?
I tested it, it seems like upon creating a pending changelist, the server will get that new changelist with only basic info, like change number, description, files being checked out. But it doesn't include the changes in the code being made on Windows box. So I feel it's unlikely to send over the change to Linux through this way.
You cannot change the owner of the pending changelist changelist, however you can shelve the changelist in from first workspace and then unshelve it in the second workspace.
For more information check the Perforce Manual for the p4 shelve command and p4 unshelve command.
The best way I have done dual development on windows and linux is to make 1 workspace, and use the "alt roots" line in your workspace. I make both my windows machine, and linux machine access the same share/drive. If it's dual boot, make a fat32 partition so both OS's can access the same drive, if they are 2 separate machines, create a network share on the machine you use most often, or on some network machine somewhere. Then make root and alt roots point to the same folder/share.
You also need to make sure that you blank out the Host line of the workspace so it can be used in both locations.
Now you can check out, edit, switch machines, and submit on the other machine.
I'm using Perforce P4V, the graphical tool, to interface with my Perforce server here at work. I have a project I added to the depot and I accidentally deleted it from my workspace on my local computer, problem is when I use the Get Revision Action (the GUI equivalent of sync), the files don't get updated, i.e. I can see the files on the server that I want, but they won't sync correctly with my local PC. It's frustrating me that the files aren't getting pulled from the server. What I'm assuming should be happening is if files are altered in anyway on my local PC, I should be able to grab the revision from the server, which then pulls the data to my local PC and overwrites the changes locally on my PC, but that isn't happening. Is there something I'm missing?
Perforce keeps track of the files that it thinks that you have on your local workstation. If you delete those files locally (and don't "tell" perforce about it), then Perforce will still think that you have those files. If you want to get them back, you need to "force sync" the files. In p4v, you can use the "Get Revision..." item and in the subsequent dialog, you can check the "force operation" checkbox to tell Perforce to give you all the files again regardless of whether Perforce thinks that you need them.
Just to complete the information, if you ever do want to remove the files locally, you can do so through p4v by choosing the "Remove from Workspace" item. Doing so will remove the files locally as well as tell perforce that you no longer have those files so that next time you sync, those files will be retrieved from the server.
Like other people have mentioned, one solution is to do a "force sync" the entire depot which is basically overwriting everything from server into your local. The downside to this is that it could take a LONG time to finish if you are working on a big depot.
Another alternative is to compare your local workspace with the server, then only force sync the files that are missing from your workspace.
p4 diff -sd //Depot/path/… | p4 -x – sync -f
-sd option: Show only the names of unopened files that are missing from the client workspace, but present in the depot.
There are more options (sa/se/etc.) available if -sd is not what you need. see here.
credits for the command goes to this blog.
They won't update because according to Perforce you still have the files on your local machine.
You need to use the "Get Revison..." option and enable the "Force Operation" option.
This will tell Perforce to refresh all the files even those it thinks you have the latest version of.
"Get Revision" will update only files that are not opened (checked out) even when "Force Operation" is enabled. You should revert all files marked as checked out in that workspace, and then use "Get Revision" with "Force Operation"
I did as you suggested, but I kept getting the message that the files were still open for edit and cannot be deleted, when trying Remove from Workspace.
Also, Get Revision returned with a message that no files were updated.
What I ended up having to do was Revert the files, then do the Get Revision action, that solved the problem.
For people coming into this question, this worked for me on the mac command line ...
cd into your local perforce workspace - the base directory of the checked out files that you are working on.
p4 sync -f
-f is to force the sync.
This can also come in handy when you restore a mac from a time machine backup.
https://www.perforce.com/perforce/r12.1/manuals/cmdref/sync.html
Check out the file, change it a little bit and then revert. Perforce will replace the local file with the latest revision.