views:

59

answers:

4

I have a directory outside the repository. I put generated sources in there. These generated sources take FOREVER to create. Rather than have everyone on the team generate these sources, I would like to use our build machine to generate the sources, and check them in to perforce. How do I do this and ensure that the source controlled directory only has only the most recent files and not any that were generated previously but not in the most recent build?

I was thinking of doing a p4 edit on all the files in the generated directory (for existing files), then doing a p4 add using wildcards to get any files that are new, but I do not know how to handle files that were previously generated, but not generated in the most recent build (should be deleted).

A: 

Start as you suggested - p4 edit and p4 add to capture all changes, then call

p4 revert -a

Which will revert any file in the depot that is open for edit but is actually unchanged or missing.

tenpn
Yes, I will have to do that as well. This does not fix the problem though. In the situation where the generator creates a file and submits it in changelist 1, but in changelist 2 it does not generates it again because it is not needed or wrong. In that case, I need to delete it from the source control as well.
Matthew Sowders
Whoops, sorry. Mis-read the question.
tenpn
A: 

I found this on the perforce blog and it is exactly what I was looking for. Automating folder replacement using P4Java and Apache Ant

Matthew Sowders
A: 

One idea is to, before the build, removing everything in this area manually (not through Perforce, but through the OS). After doing the build, do a "Reconcile Offline Work". This will reconcile in Perforce what you have in this area by adding new files, deleting ones that are not there anymore, and editing those that have changed.

You can reconcile offline work through P4V, as seen here. In your workspace browser, right-click the folder and choose "Reconcile Offline Work".

Or, you can do it through the command line if you prefer a more automated solution, as seen here. (Note: this link also talks about reconciling through p4v, but this is superseded by the previous link)

p4 diff -se //myclient/... | p4 -x - edit

to checkout changed files.

p4 diff -sd //myclient/... | p4 -x - delete

to delete files.

find . -type f -print | p4 -x - add
find . -type l -print | p4 -x - add

to add files and symlinks in Unix, or

dir /s /b /a-d | p4 -x - add

to add files in Windows.

Chance
A: 

For Binary files in Perforce you can set a FileType flag that only stores 1 (or a set number ) of revisions for the file in the repository. This way you will have history of the file but your other users will only have access to the binary for the latest version of the file and also your server will only store one copy which is much more storage efficient if you dont need to store multiple copies.

To make the change.

  1. Add the files you are interested in to the repository.
  2. Check out the file.
  3. Right click in P4V and select Change Filetype
  4. On the dialog pops up select +S "Server limits the number of revisions stored" at the bottom of the screen, which will restrict the number of files stored.

Hope this helps.

Toby Allen