2

I'm trying to execute an "Integrate" perforce command (see: http://www.perforce.com/perforce/doc.current/manuals/cmdref/integrate.html) on a list of files and not on a single file or a specific folder.

Is such a thing possible ?

In other words, is it possible to specify multiple files (and their respective integration paths) in one command ? This would save me the trouble of having to call this command for each file that I'd like to integrate and in the process reduces the number of round-trips on the P4 server.

If not, do you have another command to recommend?

Thanks

Hussein Khalil
  • 1,585
  • 2
  • 25
  • 47

3 Answers3

5

You could create a branch, and then integrate through the branch. I know that sounds weird, but in Perforce all a branch is is a set of integration mappings stored in the server. You then use -b on p4 integrate to specify the branch.

Laurence Gonsalves
  • 137,896
  • 35
  • 246
  • 299
  • So you recommand that I use this command ? : http://www.perforce.com/perforce/doc.current/manuals/cmdref/branch.html . Am I not forced to specify a directory when creating a branch .. ? (Sorry, Perforce "newbie" here :)) – Hussein Khalil Dec 07 '10 at 21:16
  • 1
    A branch view usually maps directory trees, but it doesn't have to. Your branch spec can have file to file mappings. eg: `//depot/foo/bar.txt //depot/baz/quux.txt'. One possibly confusing thing is that when you run `p4 integrate` you tell it the names of the destination files, not the names of the source files (it gets those from the branch spec). – Laurence Gonsalves Dec 08 '10 at 01:31
0

In p4v you can Ctrl+click multiple files, then right-click and choose to Integrate them. I don't think you can do anything fancy as far as integration paths; that is if you are integrating two files in the same source directory it will assume the same target directory. Or, if you are integrating two files dev/dir1/file1 and dev/dir2/file2 you can choose dev2/... as your target directory and you will have dev2/dir1/file1 and dev2/dir2/file2.

Edit to add: If you are looking for a command line solution, you can use Laurence's and edit the branch specification to your heart's content.

Chance
  • 2,653
  • 2
  • 26
  • 33
0

You can operate on a filelist using:

p4 -x filelist.txt

See

p4 help usage

The -x flag instructs p4 to read arguments, one per line, from the specified file. If you specify '-', standard input is read.

You could pass the arguments to p4 integrate directly this way or you could use the same method to create a label

p4 -x filelist.txt tag -l mylabel

And then reference the label on source side of an integration

p4 integrate //depot/src_stream/...@mylabel //depot/target_stream/...
Jamie
  • 7,635
  • 4
  • 23
  • 16