Reputation: 167
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
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
Reputation: 71464
Add the changelist to the IFileSpec that you use as the "from" for the integrateFiles() call.
The equivalent from the p4 command line is doing:
p4 integrate source/...@change,change target/...
rather than:
p4 integrate source/... target/...
Upvotes: 2