Ankit Kumar Singhal
Ankit Kumar Singhal

Reputation: 167

how to merge changelist into another branch using perforce java api

how to merge changelist into another branch using perforce java api. I have submitted some changes into a Perforce branch and a changelist created. Now I want to merge that changelist into another branches, using Perforce JAVA API.

I want to know if there is any method to merge single changelist into branch instead of merging files one by one using Perforce JAVA API.

Upvotes: 0

Views: 2370

Answers (2)

Ankit Kumar Singhal
Ankit Kumar Singhal

Reputation: 167

To integrate change-list using Perforce JAVA API, use following code:

List<IFileSpec> fromFiles = FileSpecBuilder.makeFileSpecList("source/...@<changelist>,<changelist>");
List<IFileSpec> toFiles = FileSpecBuilder.makeFileSpecList("destination/...");
for (IFileSpec file : fromFiles) {
    client.integrateFiles(file, toFiles, opts);
    client.resolveFilesAuto(toFiles, resolvOptions);
}

Upvotes: 1

Samwise
Samwise

Reputation: 71464

Add the changelist to the IFileSpec that you use as the "from" for the integrateFiles() call.

https://www.perforce.com/perforce/r15.1/manuals/p4java-javadoc/com/perforce/p4java/core/file/IFileSpec.html

The equivalent from the p4 command line is doing:

p4 integrate source/...@change,change target/...

rather than:

p4 integrate source/... target/...

Upvotes: 2

Related Questions