Tapan Majhi
Tapan Majhi

Reputation: 11

How to get previous revision CL in perforce

I am writing a program, where i have the CL ,from which I need to access the previoius revision CL of each file.

How can I get it ?

Code I have written till now is:

IChangelist cl = server.getChangelist(clId);   
List<IFileSpec> files = cl.getFiles(true);  
for(int i = 0; i < files.size() ; i++) {  
    IFileSpec fileSpec=files.get(i);
}

Upvotes: 1

Views: 811

Answers (1)

Bryan Pendleton
Bryan Pendleton

Reputation: 16359

Revision specifiers can help you here (see 'p4 help revisions').

In particular, the previous revision of each of those files is the file as of the previous changelist.

So, since clId is the changelist you care about, compute change clPrev = (clId - 1), and then look for 'file@clPrev'.

Upvotes: 1

Related Questions