Git Product home page Git Product logo

svn-migration's Introduction

Easy SVN 2 GIT wrapper

I wrote this script since I found myself always taking the same actions when performing SVN 2 GIT migrations for customers. It is a very simple wrapper around other tools so no real innovation to be found here, just automation.

BIG FAT DISCLAIMER

Do not expect this script to automagically convert a SVN repository for you. Performing a conversion, especially on SVN repositories with complex histories, can be quite a lengthy process, usually involving a lot of trial-and-error and sometimes even fixing stuff in svn-all-fast-export.

Feel free to contact me if you need support in converting your own SVN repositories. I offer commercial support to companies. For open source projects I am willing to help out freely provided I have the time for it.

License

No license, do whatever you want with it.

Dependencies

All dependencies should be installed in $PATH!

Usage

Clone this repository

git clone https://github.com/MathyV/svn-migration.git

Create a sync project

python3 svnmigrate.py create --authormap AUTHORMAP name source target
  • Note that this will create a working directory called name in $CWD
  • If you have no idea yet about the users to map just use an empty file, the process will inform you about unmapped users after upstream synchronization or you can look in the $CWD/name/users.txt
  • There is a sample-authors.txt in the repository to view the file format

Arguments

usage: svnmigrate.py create [-h] --authormap AUTHORMAP [--nofetch]
                            name source 

positional arguments:
  name                  Name of the project
  source                Source repository (URL)

optional arguments:
  -h, --help            show this help message and exit
  --authormap AUTHORMAP
                        Username mapping file
  --nofetch             Do not perform the initial data fetch

Configure the ruleset

A default rules file is installed in $CWD/name/ruleset.txt, it is pretty barren so you should add some rules to it. For more information see the svn2git documentation or https://techbase.kde.org/Projects/MoveToGit/UsingSvn2Git

Perform a sync

python3 svnmigrate.py sync name

Arguments

usage: svnmigrate.py sync [-h] [--nofetch] [--push] [--force] name

positional arguments:
  name        Migration project to operate on

optional arguments:
  -h, --help  show this help message and exit
  --nofetch   Do not fetch data from the remote SVN repository

Check results

The new git repositories are in $CWD/name/repos/. Check the contents and if happy push downstream. If you need to change some rules just remove the offending repository from the repos directory and start the sync again.

Inner workings

  • create
    • Create a working directory
    • Save the configuration in a pickle
    • Mirror the source repository locally
    • Synchronize the local mirror with upstream (optional)
    • Install a default ruleset
  • sync
    • Synchronize the local mirror with upstream (optional)
    • Execute svn2git with options --identity-map, --rules and --add-metadata
    • Repack the git repositories

Note that the configuration is saved very crudely in a pickle file, which means that it will probably won't withstand an update of this wrapper script.

svn-migration's People

Contributors

mathyv avatar

Stargazers

 avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.