svn2p4 release 0.20 ---------------- - INTRODUCTION - ---------------- svn2p4 is a Subversion (SVN) to Perforce (P4) migration tool. It is suitable for migrating SVN repositories of arbitrary size and complexity. svn2p4 is a single Perl script that contains both configuration data and actual code. In its basic mode, the tool unconditionally migrates an entire SVN repository to P4, begginning with revison 1. Several advanced features are also supported to optimize overall migration time and performance. These include - Pre-migration analysis of SVN revision log to identify redundant nodes (branches, tags) that can be skipped during the migration. - Skipping certain revisions that are added to the tool's exclude list. - Supporting different SVN tag migration modes (migrate tags as p4 branches or as p4 labels). - Limited support for re-mapping repository contents during the migration. ----------------- - PREREQUISITES - ----------------- The script can run on any system that supports - Perl - Perforce command-line client (p4) - Subversion command-line client (svn) - Network/Internet connection ----------------- - CONFIGURATION - ----------------- The script is pre-configured to migrate collab.net's Subversion code tree: http://svn.collab.net/repos/svn Configuration data is stored in the script in a global hash table called %g. Review and modify the following configurable parameters. ---------------------------------------------------------------------- # # Runtime properties: # die_on_warning => false, err_max_count => 1, wrn_max_count => 100, make_svn_repo_map_and_quit => false, debug => $ENV{SVN2P4_DEBUG} || false, silent => $ENV{SVN2P4_SILENT} || false, verbose => $ENV{SVN2P4_VERBOSE} || false, very_verbose => $ENV{SVN2P4_VERY_VERBOSE} || true, # # Perforce and Subversion properties: # p4_user => "perforce", p4_port => "proteus-new.bluecoat.com:1999", p4_client => "svn2p4", #p4_passwd => "perforce", svn_url => "http://svn.collab.net/repos/svn", svn_working_copy => cwd() . "/svn", # svn_url => "http://svn.apache.org/repos/asf", # svn_url => "file:///usr/local/svnroot", svn2p4_repo_map => { "/trunk" => "//depot/collab.net/main", "/branches" => "//depot/collab.net/branches", "/tags" => "//depot/collab.net/tags", "/.svnignore" => "//depot/collab.net/misc/.svnignore", "/COMMITTERS" => "//depot/collab.net/misc/COMMITTERS", "/README" => "//depot/collab.net/misc/README", "/modules" => "//depot/collab.net/misc/modules", }, p4_dummy_file => ".svn2p4", p4_dummy_file_default_path => "//depot/collab.net/.svn2p4", svn2p4_tag_migrate_target => "branch", #svn2p4_tag_migrate_target => "label", # # Data file definitions: # svn_all_rev_log => "svn_all_rev_log.txt", svn2p4_last_migrated_rev_file => "svn2p4_last_migrated_rev.txt", svn2p4_rev_map_file => "svn2p4_rev_map.csv", svn2p4_repo_map_to_skip_file => "svn2p4_repo_map_to_skip.csv", svn_exclude_rev_file => "svn_exclude_rev.txt", svn_exclude_node_file => "svn_exclude_node.txt", ---------------------------------------------------------------------- Pay special attention to following parameters (you don't have to change the rest): make_svn_repo_map_and_quit p4_user p4_port p4_client svn_url svn_working_copy svn2p4_repo_map p4_dummy_file_default_path svn2p4_tag_migrate_target Optional parameter: p4_passwd (commented out by default). It is recommended that you use ticket based Perforce authentication i.e. login to Perforce as and make sure your login does not expire. ------------- - PROCEDURE - ------------- To run the script, execute from the command prompt: ./svn2p4.pl or perl svn2p4.pl The script will write its log to svn2p4.pl.log. Old logs will be moved to the logs directory. During the migration, the script will create and write to the following files: svn2p4_last_migrated_rev.txt svn2p4_rev_map.csv svn2p4_branchspec.txt (temporary) svn2p4_labelspec.txt (temporary) svn2p4_spec.txt (temporary) It is recommended that you first run the script with its option make_svn_repo_map_and_quit set to true. This is a good way to test your setup and the connection to the Subversion server. Set "verbose" to true. The script should generate the following data: - List of SVN repository nodes as well as "redundant" nodes in the log file - List of "redundant" nodes in CSV format: svn2p4_repo_map_to_skip.csv - Complete SVN revision log: svn_all_rev_log.txt You can use the list of redundant nodes to decide which revisions and nodes (files, directories, branches and tags) you'd like to skip during the migration (if any). To skip SVN revisions, add them to svn_exclude_rev.txt (one entry per line). To skip nodes, add them to svn_exclude_node.txt (one entry per line). Use SVN repository notation, for example /trunk/product/old_sandboxes /tags/0.20.1 /branches/dead-branch To execute a migration, be sure to properly set the following properties: die_on_warning Zero tolerance for warnings wrn_max_count Your tolerance for warnings debug Extra info included in messages silent true to have no screen output verbose true to see output from p4 and svn commands very_verbose true to have even more output p4_user Perforce user who runs the migration p4_port Target Perforce server p4_client Perforce client for the migration svn_url SVN repository URL svn_working_copy SVN local workspace svn2p4_repo_map SVN -> P4 node mapping p4_dummy_file_default_path P4 files used for "dummy" check-ins svn2p4_tag_migrate_target Can be "branch" or "label" If the migration stopped for any reason (lost connection, Ctrl-C, etc), it can be resumed by simply restarting the script. Questions? Contact vitalii.pokrovskii@bluecoat.com EOT