Skip to content

gabrys/svn2github

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 

Repository files navigation

svn2github

Mirror your SVN repositories to GitHub

Motivation

This is a standalone script created as a response to a few people asking for an alternative to using svn2github.com that I recently closed.

Requirements

This is a Python3 script (tested with Python 3.5). It shells out to the following commands:

  • svn
  • git
  • git svn (usually packaged separately from git!)
  • tar

Warning

Don't use the script on untrusted repositories. The script issues commands using input from the GitHub repository and possibly this can be exploited to run arbitrary commands on your server.

Usage

There are a few ways to use the script.

The first use case is mirroring an SVN repository to a completely fresh GitHub:

  1. Create a new repository using https://github.com/new
  2. Make sure you can clone that repository using SSH (git clone [email protected]:...), you need your SSH keys set up for this
  3. Invoke the script with the import subcommand: ./svn2github.py import github_user/repo http://svn-url/trunk
  4. To later synchronize the repo use update: ./svn2github.py update github_user/repo

The second use case is mirroring a repository that used to be kept in sync by svn2github.com:

  1. Fork repo from https://github.com/svn2github/repo to your new user and repo name
  2. Make sure you can clone that repository using SSH (git clone [email protected]:...), you need your SSH keys set up for this
  3. Bring the repo up to date with the update command: python3 svn2github.py github_user/repo update

All those commands (both import and update) will re-download the whole Git and SVN history every time, unless you specify a cache directory using the --cache-dir option. Use an empty directory and keep the contents between the runs to significantly speed up the updates!

Help page

usage: svn2github.py [-h] [--cache-dir CACHE_DIR] {import,update} ...

Mirror SVN repositories to GitHub

positional arguments:
  {import,update}
    import              Import SVN repository to the GitHub repo
    update              Update the GitHub repository from SVN

optional arguments:
  -h, --help            show this help message and exit
  --cache-dir CACHE_DIR
                        Directory to keep the cached data to avoid re-
                        downloading all SVN and Git history each time. This is
                        optional, but highly recommended

====

usage: svn2github.py import [-h] GITHUB_REPO SVN_URL

positional arguments:
  GITHUB_REPO  GitHub repo in format: user/name
  SVN_URL      SVN repository to import

optional arguments:
  -h, --help   show this help message and exit

====

usage: svn2github.py update [-h] GITHUB_REPO

positional arguments:
  GITHUB_REPO  GitHub repo in format: user/name

optional arguments:
  -h, --help   show this help message and exit

About

Mirror your SVN repositories to GitHub

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages