Pokrovskii-Fridrich2007 - Diablo 3 Ragdoll

download Pokrovskii-Fridrich2007 - Diablo 3 Ragdoll

of 21

Transcript of Pokrovskii-Fridrich2007 - Diablo 3 Ragdoll

  • 7/28/2019 Pokrovskii-Fridrich2007 - Diablo 3 Ragdoll

    1/21

    Migrating from Subversion to

    Perforce:The methodology and the

    migration tool

    Vitalii Pokrovskii and Mark Fridrich

    Blue Coat Systems, Inc.http://www.bluecoat.com

  • 7/28/2019 Pokrovskii-Fridrich2007 - Diablo 3 Ragdoll

    2/21

    Outline

    Why is migration necessary?

    Subversion (SVN) to Perforce (P4) migrationobjectives

    The method

    Implementation details The migration tool: svn2p4

    Practical recommendationsQ & A

  • 7/28/2019 Pokrovskii-Fridrich2007 - Diablo 3 Ragdoll

    3/21

    The Need for Migration

    Three dozen of revision control tools available

    One can choose from both open-source and proprietarysystems

    Solutions are available to fit any taste and budget

    So, why is migration required?

    Not all systems are created equal, engineering organizationsare always looking to improve their code managementpractices

    Requirements change, the organization outgrows the originalsystem

    Need to unify two or more different systems as a result ofcorporate restructuring, merger, or an acquisition

  • 7/28/2019 Pokrovskii-Fridrich2007 - Diablo 3 Ragdoll

    4/21

    Migration Requirements

    Options: Import a head snapshot of SVN repository (not a solution).

    Migrate the entire repository with the full history of how it evolved,from day 1 to present.

    Requirements: General-purpose (hopefully easy to follow) migration process

    capable of handling SVN repositories of arbitrary size and

    complexity. Preserve natural change order, branches, tags and integration

    history; no need to preserve original dates.

    Good performance, yet

    Eliminate the need to do everything in one take (cutover weekend)

    by supporting incremental (re-startable) migration. Optimize and clean up the repository as it is being migrated by

    supporting redundant node analysis and exclude lists to filter outunwanted contents.

    Extensibility, provide for handling of unique and unforeseen cases.

  • 7/28/2019 Pokrovskii-Fridrich2007 - Diablo 3 Ragdoll

    5/21

    Migration Flow

  • 7/28/2019 Pokrovskii-Fridrich2007 - Diablo 3 Ragdoll

    6/21

    Solution Outline

    SVN and P4 side-by-side comparison: Terminology

    Functionality

    What can and cannot be migratedSVN to P4 conversion:

    Use data presented in SVN revision log as basis for individual SVNchangeset migration.

    Sync-and-Replay mechanism i.e. Check out single SVN revision into a local working copy

    Translate SVN change into corresponding P4 change

    Submit the change to Perforce

    Mappings that are required to support this solution: SVN to P4 functional mapping

    SVN to P4 repository mapping

    SVN to P4 revision mapping

    Redundant node analysis and the exclude lists.

  • 7/28/2019 Pokrovskii-Fridrich2007 - Diablo 3 Ragdoll

    7/21

    Comparing SVN and P4

  • 7/28/2019 Pokrovskii-Fridrich2007 - Diablo 3 Ragdoll

    8/21

    Comparing SVN and P4 (cont.)

  • 7/28/2019 Pokrovskii-Fridrich2007 - Diablo 3 Ragdoll

    9/21

    Comparing SVN and P4 (cont.)

    Bottom line: Some of the properties can be automaticallymigrated or set after the migration. However, as a generalcase the list of SVN properties is site-specific and certain

    properties may have no direct analogs in P4.

  • 7/28/2019 Pokrovskii-Fridrich2007 - Diablo 3 Ragdoll

    10/21

    SVN repositories used as case studies

    *The* Subversion repository:

    Complete migration, node dependency analysis, performance,exclude lists

    Apache Software Foundation (ASF) repository:

    Node dependency analysis

    Processing the complete revision log (~450 MB of data)

  • 7/28/2019 Pokrovskii-Fridrich2007 - Diablo 3 Ragdoll

    11/21

    Example of SVN revision log

    Changes in this revision:

    - Edit file /README.

    - Add directory /developer-resources.

    - Branch difftools and guis folders to /developer-resources from/trunk/notes @ revision 20617.

    - Replace some files in the folders with newer source @ revision 20619.

    - Delete folders difftools and guis at original location.

  • 7/28/2019 Pokrovskii-Fridrich2007 - Diablo 3 Ragdoll

    12/21

    SVN P4 functional mapping

    SVN P4

    A (add file)

    A (add directory)

    p4 add

    p4 add (recursive)M (edit file)

    M (edit directory)

    p4 edit

    No action required, the change only affects svnproperties.

    D (delete file)

    D (delete directory)

    p4 delete

    p4 delete (recursive)

    R (replace file)

    R (replace directory)

    [ p4 delete ; p4 add ; ]

    p4 edit

    A (branch/tag from)A (copy from)

    R (replace from)

    p4 integrate [d f] @ ;p4 resolve at; p4 edit

    * Derived from svn/p4 revision map

  • 7/28/2019 Pokrovskii-Fridrich2007 - Diablo 3 Ragdoll

    13/21

    SVN P4 functional mapping (cont.)

    SVN P4A (tag from) p4 sync @

    p4 label p4 labelsync l

    * Derived from svn/p4 revision map

    A (add file to tag)

    M (edit file in tag)

    A (add file to tag from)

    R (replace file in tag from)D (delete file from tag)

    No solution (cannot add to label without adding to sourcetree first); same with edit.

    p4 labelsync a l @

    p4 labelsync l @p4 labelsync d @

    ** Potential problem: may be outside of intendedlabel view.

    E l f SVN/P4 i i

  • 7/28/2019 Pokrovskii-Fridrich2007 - Diablo 3 Ragdoll

    14/21

    Example of SVN/P4 repository mapping:

    http://svn.collab.net/repos/svn

    SVN P4

    /trunk/branches

    /tags

    /.svnignore/COMMITTERS

    /README

    /modules/developer-resources

    /svn-logos

    //depot/svn/main//depot/svn/branches

    //depot/svn/tags

    //depot/svn/misc/.svnignore//depot/svn/COMMITTERS

    //depot/svn/README

    //depot/svn/modules//depot/svn/misc/dev-resources

    //depot/svn/misc/svn-logos

  • 7/28/2019 Pokrovskii-Fridrich2007 - Diablo 3 Ragdoll

    15/21

    SVN to P4 revision mapping

    Practical rule:

    Every SVN revision converts to a single P4 revision (1:1 mapping)

    How to handle special cases where migrating a SVN revision does notrequire P4 change?

    Examples:

    SVN revision is empty or it only modifies node properties.

    Migrating SVN tag to P4 label does not require P4 check-in

    Practical solution:Check into Perforce and modify a dummy file called .svn2p4File location is defined as part of migration setup.

    S f SVN h th t lt d i

  • 7/28/2019 Pokrovskii-Fridrich2007 - Diablo 3 Ragdoll

    16/21

    Summary of SVN changes that resulted in

    dummy P4 check-ins

  • 7/28/2019 Pokrovskii-Fridrich2007 - Diablo 3 Ragdoll

    17/21

    Redundant Node Analysis

    Migration is a good opportunity to review existing repositorycontents and get rid of old junk such as dead branches,abandoned sandboxes, release tags with past expiration dates, etc.

    NOTE: Consult with your Legal Department beforepermanently deleting anything.

    To make sure skipping certain contents during the migration doesnot adversely affect file integration history (and thus breaks themigration), the tool helps you identify redundant nodes. An entire

    revision log is processed to identify childless nodes, using thefollowing criteria:

    Node is not a source of changes for other nodes

    Node is only a source to itself

    Node is a source to a deleted node that is not a source

    Skip the nodes that you think are redundant by adding them to theexclude lists:

    Exclude nodes (files, directories, branches and tags)

    Exclude revisions

  • 7/28/2019 Pokrovskii-Fridrich2007 - Diablo 3 Ragdoll

    18/21

    svn2p4

    The migration tool is a single Perl script (svn2p4.pl) that containsboth configuration data and actual code.

    Two execution modes: Redundant node analysis (read and analyze the revision log, generate a

    list of redundant nodes)

    Migration proper (migrate SVN repository to P4 starting with revision 1)

    Runtime behavior: The script writes its log to svn2p4.pl.log (old logs are moved to the logs

    directory)

    Maintains SVN/P4 revision map in svn2p4_rev_map.csv.

    Incremental migration: The script can be stopped and re-started anytime.

    Availability: Download the script from public.perforce.com:1666

    //guest/vitalii_pokrovskii/svn2p4

  • 7/28/2019 Pokrovskii-Fridrich2007 - Diablo 3 Ragdoll

    19/21

  • 7/28/2019 Pokrovskii-Fridrich2007 - Diablo 3 Ragdoll

    20/21

    Q & A

  • 7/28/2019 Pokrovskii-Fridrich2007 - Diablo 3 Ragdoll

    21/21