Manish Basantani
Manish Basantani

Reputation: 17499

Perforce Integrate command to remove local files/directories which are not present in repository

I am looking for a perforce integrate/get-latest command which would fetch the latest/updated-code and remove the files/folders that have been moved/deleted from the perforce(server) repository.

Is there any way by which I can get a clean copy of the perforce repository, without creating a new workspace/local directory?

Thanks for your interest.

Upvotes: 0

Views: 1849

Answers (2)

Samwise
Samwise

Reputation: 71454

As of release 2014.1, you can get a clean copy of the repository by using "p4 sync" and "p4 clean". The "p4 sync" command will fetch the latest versions of files from the repository; the "p4 clean" command will remove/refresh anything in your workspace that was not put there by a sync:

http://www.perforce.com/blog/140501/p4-clean-make-workspace-shine

Setting the "rmdir" option in your client spec will tell "sync" and "clean" to remove empty directories as they are emptied by those commands:

http://www.perforce.com/perforce/doc.current/manuals/cmdref/p4_client.html#d0e7978

Upvotes: 3

Mike O'Connor
Mike O'Connor

Reputation: 3813

What you're looking for is the sync command. It will grab the latest files, and it will remove any files that were deleted. I'm pretty sure it won't remove the directories, though, at least not on Windows.

To get a clean copy, you can delete the local files, and sync using the '-f' flag.

Upvotes: 4

Related Questions