Perforce is by default renames the change list to latest change list number while submitting.
We are doing reviews based on the pending change list number.
Issue comes when we try to generate the report using submitted change list number as those will not match to one in the reviews as pending change lists are renamed to new ones.
Issue is resolved by generating the new and old change list number map and doing little bit of scripting around it.
Following command is used to fetch the New and Old change list for given depot path in pipe separated file.
p4 -ztag changes //depot/some/path/... |grep -i "change " |awk '{if($0~/oldChange/) {print a"|"$0"|"} a=$0}'|sed -e 's/\.\.\. change //g' -e 's/|\.\.\. oldChange /|/g' > changelist_map.csv
Let me explain how it works
p4 -ztag changes //depot/some/path/...
Above command give output like
... change 198325
... time 1360723311
... user test
... client test_test-W7
... status submitted
... changeType public
... path //depot/some/path/...
... oldChange 198289
... desc test desc
... change 198270
... time 1360673907
... user test1
... client test1_1780
... status submitted
... changeType public
... path //depot/some/other/path/...
... oldChange 198256
... desc some other test
grep -i "change "
Above command make the output as below
... change 198325
... oldChange 198289
... change 198270
... oldChange 198256
awk '{if($0~/oldChange/) {print a"|"$0"|"} a=$0}'
Above command make the output as below
... change 198325|... oldChange 198289|
... change 198270|... oldChange 198256|
sed -e 's/\.\.\. change //g' -e 's/|\.\.\. oldChange /|/g'
Above command makes the output as below
198325|198289|
198270|198256|
> output redirection creates the new file named changelist_map.csv and store the above output.
By using the above mapping we are able to generate the report even if the change list numbers are changed.