Git Product home page Git Product logo

svn2git.php's Introduction

svn2git

Subversion to Git migration tool.

Uses git-svn to clone a Subversion repository including all its tags to Git. Optionally pushes everything to a remote repository.

Table of Contents

Getting Started

Important: since version 2.1.0 svn2git migrate does not asume standard layout for subversion repositories anymore. To migrate a subversion repository with standard layout you can use the same options as available on git svn clone:

$ bin/svn2git migrate [-A|--authors-file="..."] [--remote="..."] [-s|--stdlayout] [-T|--trunk="..."] [-b|--branches="..."] [-t|--tags="..."] [--preserve-empty-dirs] [--placeholder-filename="..."] source

Check the migrate command help or the git svn man pages for more information.

Install Dependencies

git
git-svn
composer install

Get help

$ bin/svn2git
svn2git - the Subversion to Git migration tool. version 1.0.1

Usage:
  [options] command [arguments]

Options:
  --help           -h Display this help message.
  --quiet          -q Do not output any message.
  --verbose        -v|vv|vvv Increase the verbosity of messages: 1 for normal output, 2 for more verbose output and 3 for debug.
  --version        -V Display this application version.
  --ansi              Force ANSI output.
  --no-ansi           Disable ANSI output.
  --no-interaction -n Do not ask any interactive question.

Available commands:
  fetch-svn-authors   Command line tool to fetch author names from an SVN repository.
  help                Displays help for a command
  list                Lists commands
  migrate             Command line tool to migrate a Subversion repository to Git.
  update              Command line tool to update an existing git-svn bridge repository.

Get subversion authors mapping

Usage

$ bin/svn2git fetch-svn-authors [--output="..."] source

Arguments

  source                Subversion repository to fetch author names from.

Options

  --output              Output file. (default: "./authors.txt")
  --help (-h)           Display this help message.
  --quiet (-q)          Do not output any message.
  --verbose (-v|vv|vvv) Increase the verbosity of messages: 1 for normal output, 2 for more verbose output and 3 for debug.
  --version (-V)        Display this application version.
  --ansi                Force ANSI output.
  --no-ansi             Disable ANSI output.
  --no-interaction (-n) Do not ask any interactive question.

Example

$ bin/svn2git fetch-svn-authors svn://example.com/svnrepo --output authors-transform.txt

Edit the output file if you want to make adjustments to the layout. Default layout is:

username = username <username>

Capability to inject the layout might be added in the future.

Migrate the repository

Usage

$ bin/svn2git migrate [-A|--authors-file="..."] [--remote="..."] source

Arguments

  source                Subversion repository to migrate.

Options

  --authors-file (-A)     Path to Subversion authors mapping.
  --remote                URL of Git remote repository to push to.
  --stdlayout (-s)        The option --stdlayout is a shorthand way of setting trunk,tags,branches as the relative paths, which is the Subversion default.
                          If any of the other options are given as well, they take precedence.
  --trunk (-T)           Relative repository path or full url pointing to the trunk of the repository.
                          Takes precedence over the --stdlayout option.
  --branches (-b)        Relative repository path or full url pointing to the branches of the repository.
                          Takes precedence over the --stdlayout option.
  --tags (-t)            Relative repository path or full url pointing to the tags of the repository.
                          Takes precedence over the --stdlayout option.
  --preserve-empty-dirs   Create a placeholder file in the local Git repository for each empty directory fetched from Subversion.
  --placeholder-filename  Set the name of placeholder files created by --preserve-empty-dirs. (default: ".gitkeep")
  --help (-h)             Display this help message.
  --quiet (-q)            Do not output any message.
  --verbose (-v|vv|vvv)   Increase the verbosity of messages: 1 for normal output, 2 for more verbose output and 3 for debug.
  --version (-V)          Display this application version.
  --ansi                  Force ANSI output.
  --no-ansi               Disable ANSI output.
  --no-interaction (-n)   Do not ask any interactive question.

Example

$ bin/svn2git migrate svn://example.com/svnrepo -A authors-transform.txt [email protected]:user/remoterepo.git --stdlayout

To update the master or any added branch / tag just execute the migrate command again. This might show some warnings and errors because of already existing branches and tags. You can ignore those.

A dedicated update command might be added in the future.

Update an existing repository

Usage

$ bin/svn2git update [--branches="..."] gitsvn

Arguments

  gitsvn                Git-svn repository to be updated.

Options

  --branches            Branches to be updated. (multiple values allowed)
  --help (-h)           Display this help message.
  --quiet (-q)          Do not output any message.
  --verbose (-v|vv|vvv) Increase the verbosity of messages: 1 for normal output, 2 for more verbose output and 3 for debug.
  --version (-V)        Display this application version.
  --ansi                Force ANSI output.
  --no-ansi             Disable ANSI output.
  --no-interaction (-n) Do not ask any interactive question.

Example

$ bin/svn2git update --branches=master,latest-testing,latest-production /path/to/git-svn/repository

svn2git.php's People

Contributors

andygrunwald avatar dsiebel avatar mre avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

Forkers

maxbosse

svn2git.php's Issues

new Update Command

UpdateCommand to continously integrate and update the git remote from the git-svn checkout:

  • check already migrated branches for updates
  • check for new branches & tags
  • requires storing branches somewhere (serialize to tmp dir?)
  • integration into MigrateCommand (if repository already exists)

note: do not commit to git-svn repository, otherwise you will run into issues when running git svn rebase && git push origin

MigrateCommand enhancements

git svn clone

  • configurable --prefix
  • configurable --stdlayout
  • configurable repository (local) name
  • integrate --authors-progfor fallback
  • keep empty subversion directories (sometimes they might be necessary) 497e64e

branch & tag migration

  • try updating if branch exists (trust cli return codes?)
  • move "trunk" to master if applicable
    • git branch -M trunk master;
  • cleanup bogus branches of the form "name@REV"
    git for-each-ref --format='%(refname)' refs/heads | grep '@[0-9][0-9]*' | cut -d / -f 3-
  • git for-each-ref --format='%(refname)' refs/remotes
    might be a better fit to migrate branches and tags (if we can dispence the tag's messages)?

continue where I left of

  • fetch changes from svn if first command did not run successfully (timeout, etc.)

final bare repository after migration (local)

git init --bare $gitinit_params;
git symbolic-ref HEAD refs/heads/trunk;
git remote add bare <final bare repo>;
git config remote.bare.push 'refs/remotes/*:refs/heads/*';
git push bare;

automatically transfer svn-ignore

git svn show-ignore --id trunk >> .gitignore;
git add .gitignore;
git commit --author="svn2git <[email protected]>" -m 'Convert svn:ignore properties to .gitignore.';

git

  • abstract git commands to separate layer

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.