Perforce Customization To Revert Changelist

Perforce Customization To Revert Changelist

Attachech Python File: Download here Perforce Python script to revert Changelist

Purpose

In Perforce if we check in any change list and in case if we want to revert the change list. Perforce does not have feature to Revert Change List.

We have to do it manually by using following steps.

1) Take a change list version which is predecessor of the current one which we want to revert
2) Do head sync to that change list revision.
3) Check out the files which we want to revert. Resolve them and check in

But we can very well eliminate the above three manual steps and automate the process of Reverting Change list by Customizing Perforce to have Revert Change List Feature.
This feature will be very useful if the Changelist which we want to revert have large number of files

Risk
There is no Risk with this feature because the changelist which we revert are not directly submitted. When we do a Revert Change List a new Change List will be created and we have the capability to resolve the conflict if there are more than one Revision for that file.

Required Software Version
Download Recent version of Python from http://www.python.org/download/ and   Install Python and set the path for library files of python in the environment variables just like java.

Software Program Required for Customization

I have downloaded Python Program from the following URL which will help in Reverting Change List. (http://www.tilander.org/aurora/2007/06/reverting-a-perforce-changelis.html).

Perforce Client Side Changes for Customization

Following Customization needs to be done to add Revert ChangeList option in  perforce.

1.    Open Perforce
2.    Go to Tools >> Customize
3.    Click Add Button
4.    Enter Name as RevertChangeList, Give the location of the Python Program
5.    Give the argument as -c $c -p $p -u $u %c
C – Client
P –  Port Number
U –User

image

Note : Make sure “Close window upon exit” is not checked initially for the first time. So that we can see the success message in console.
In case if it is checked. If the Python Program fails. Then we may not be able to see the message.

6.    Once this is done then Click View Submitted Change List. Right click the change list which you want to revert and click RevertChangeList.

 

image

7.    Once this is done all the files that were reverted will be available under Default Changelist.
8.    Create New Changelist and move all from Default Changelist.
9.    Check the whether they are reverted properly. If there are some version conflict then resolve them and checkin.
10.    Using this feature I had reverted changelist Number : 163806
11.    Outside Perforce also this utility can be run. We can also run the utility from windows prompt by giving following command

Command :
p4revert.py -c <Client> -p <Port> -u <User> <ChangeList>

Example:
p4revert.py -c Mramchandran -p 10.10.50.201:1666 -u jayesh 163806

This is not tested. It is also convenient to use through perforce.

Troubleshooting

1.If my Revert ChangeList contains file say A.java and that file is also part of another change list in the client machine. Then the file A.java will not be reverted.
2. Always check the number of files that are present in the changelist is same as same number of files that are present in the new change list once RevertChangeList is done.

Limitations
1. The only limitation this tool has is the Revert ChangeList customization is written in Python. It will be good if we can understand the logic and convert to Java.

References

1. http://www.tilander.org/aurora/2007/06/reverting-a-perforce-changelis.html
2. http://kb.perforce.com/?article=014
3. http://www.python.org/download/

Contributed Made by: Ramchandran M

Tagged : / / / /

How Perforce changelist number works? | Perforce Guide

perforce-changelist-number

How Perforce change list number works?

Perforce assigns numbers to changelists and also maintains a default changelist, which is numbered when you submit it. You can create multiple changelists to organize your work. For example, one changelist might contain files that are changed to implement a new feature, and another changelist might contain a bug fix. Changelists are renumbered so that submitted changelist numbers always ascend in chronological order.

Pending numbered changelists might be renumbered when they are submitted to ensure that submitted changelist numbers are always ascending in chronological order. For example, if changelist A is submitted before changelist B, then changelist B’s number will be higher when it is submitted.

Perforce change list numbers are serial. Once a CL number has been assigned via a submit, only the next number in series will be used.

One way this could happen is that you had pending work in CL 326042 and something in your default and the latest submitted CL is 326041.

Reference

http://www.perforce.com/perforce/doc.current/manuals/p4guide/04_files.html
http://kb.perforce.com/article/781/changelist-renumbered-on-submit

Tagged : / / / / / / / / / / / /

Depot Migration between perforce servers with history and change list

depot-migration-between-perforce-servers

There are many questions asked for the depot migration between server without losing any of the history  such as…

  • Moving depots across servers
  • Moving depots between servers
  • Move a product depot from one Perforce server to another
  • Depot Migration between perforce servers with history and change list

There are one solution which i find worth to try it out?
1.  Take A full backup of Source perforce server including jounals and file systems using checkpoint featres
2.  Then obliterate everything in the Source server that you didn’t want to copy – and remove redundant changelists with p4 change -f -d (refer p4 manuals)
3.  Go back to the Source server and obliterate the bit you’ve moved and remove redunant changelists again.
4. Now using p4merge tool, you can merger source and destination servers. this tools will help you for how to merge two separate servers into a single combined server using the Perfmerge++ utility.

What is Perfmerge++?
Perfmerge++ is a tool for merging two Perforce repositories to produce a third repository; it replaces the venerable perfmerge2.pl script. Unlike its predecessor, perfmerge++ does not work with checkpoints, rather it accesses the database files directly and creates new database files in the target directory. These new database files contain the merged content.

Reference:
http://kb.perforce.com/article/911
ftp://ftp.perforce.com/perforce/tools/perfmerge/perfmerge.html

Tagged : / / / / / / / / / / / / / / / / / / / / / / /

Command Line to find a Change list properties in perforce server

command-line-to-find-a-change-list-properties-in-perforce-server

Command Line to find a Change list properties and associated path of the file in perforce server view:

Examples of the command you want:
p4 describe 1231928
p4 describe -s 1231928
p4 files @=1231928

Where 1231928 is the change list number.

Tagged : / / / / / / / / / / / / /