Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Faster clean Perforce sync over VPN

Tags:

sync

perforce

I have to regularly do a clean Perforce sync to new hardware/virtual machines over the VPN. This can take hours as the project is quite large. Is there a way that I can simply copy an up-to-date tree from an existing client and tell Perforce to use this tree?

like image 556
Sohail Avatar asked Nov 16 '09 15:11

Sohail


3 Answers

The Perforce Proxy is the right way to go, but if you really want to, there is a way to do what you asked via the sync command, with the -k switch:

The -k flag bypasses the client file update. It can be used to make the server believe that a client workspace already has the file. Typically this flag is used to correct the Perforce server when it is wrong about what files are on the client, use of this option can confuse the server if you are wrong about the client's contents.

p4 sync -k //depot/someProject/...

You can also use flush, which is a synonym for sync -k:

p4 flush //depot/someProject/...

Just be careful. Remember those last words, "...use of this option can confuse the server if you are wrong about the client's contents."

like image 158
raven Avatar answered Sep 29 '22 02:09

raven


Perforce Proxy is almost definitely the way to go, assuming you can dedicate a local machine for this purpose.

A useful tip for a Proxy is to get it to refresh its contents overnight, just by creating a dummy client (perhaps on the proxy machine), and kicking off a nightly task to do a sync - a normal sync will do, does not need to be a clean one. This will ensure any big changes people have checked in won't necessarily cause a massive lag the first time you need to do a local sync.

Note that you need a live VPN connection between the proxy and the server - the proxy still has to talk to the server to determine if it has the right versions cached. So the proxy needs a reasonably low latency link to the server, but at least you don't have to wait for actual file transfer.

Another alternative you may want to try is to use the compress option in your client specs (workspaces). This tells the server to compress each file before it gets sent, and your p4 client will decompress automatically. The trade-off here is CPU time on both the server and the client. However, given you want to sync several local clients, I think proxy will ultimately be the better solution.

like image 44
Greg Whitfield Avatar answered Sep 29 '22 01:09

Greg Whitfield


No, but you shouldn't need to: Why do you need to do a clean perforce sync? What's wrong with a normal sync? If you need to clean the tree, then why not work on a copy of the tree?

One alternative might be to run a p4proxy on your end of the VPN connection, then unchanged files won't have to be transferred over the VPN.

If you only require an export - that is you don't need to keep it up-to-date or submit changes from it, then you could simply copy an existing checkout, and never use perforce against that tree. But I don't know anyway of convincing perforce server that you have a checkout without p4 actually checking out the files.

like image 32
Douglas Leeder Avatar answered Sep 29 '22 01:09

Douglas Leeder