This script (p4replicate.rb) is written by Robert Cowham of Vaccaperna Systems Ltd.
License - see license.txt (BSD).
This script has not been actively maintained for years, and is now deprecated.
There is a publically available equivalent utility called P4Transfer.py. That utility has unit tests and takes account of more recent Perforce actions include move/add, move/delete and various other permutations. It works in a broadly similar way.
The script replicates changelists between a source and client p4 server (with caveats - see below).
It is written in Ruby and uses the official version of P4Ruby (2007.3 or 2008.1) - available from the Perforce ftp site, e.g. ftp://ftp.perforce.com/perforce/r08.1/bin.ntx86/.
All the potential fields are shown below. Comments start with "#".
Normal fields require "=" sign to specify, the View field is the only multi-line field.
# I am a configuration file for p4replicate.rb src_p4port=1777 src_p4client=repl-client-src src_p4clientroot=c:\work\p4replicate\root src_p4user=robert # Comment out if no password # src_p4password= # The following is used to record which changelist we have processed. # Was originally src_counter but users often have more control over dest than src dest_counter=p4replicate dest_p4port=1777 dest_p4client=repl-client-dest dest_p4user=bruno # Comment out if no password #dest_p4password=bruno # The next 2 fields are required if email is to be used for notification of success or failure mail_server=smtp.somewhere.uk firstname.lastname@example.org # Comment out either of the following two fields to not receive email notification # Multiple addresses should be comma seperated #email@example.com #firstname.lastname@example.org,email@example.com # Note that this is a standard Perforce view but LHS is source repository # and RHS is destination repository # All the normal Perforce wildcards can be used. # If there are spaces in paths then use quotes. view: //depot/repl/src/... //depot/repl/dest/... "//depot/repl/src two/*" "//newdepot/repl/dest 2/*"
Basic usage is either to specify the ini file on the command line or it
assumes "p4replicate.ini" exists in current directory.
Give "-v" option to output (lots of) debug info in case of error - otherwise just returns number of changelists transferred.
p4replicate.rb -v p4replicate.rb --verbose p4replicate.rb new.ini
c:\work> p4replicate.rb Number of changes replicated: 1 Last change processed: 2917
c:\work> p4replicate.rb Number of changes replicated: 0 Last change processed: 2917
For testing purposes you can use the same p4 server for source and dest. In between runs you will need to reset the p4replicate counter, e.g.
p4 counter p4replicate 0
(or some other value before first changelist to be replicated)
Obliterate the dest files so that area is nice and clean.
Note there is a partial test harness which needs to be considerably enhanced!
© Vaccaperna Systems Ltd 2005-8