<commit_before># Migrating from SVN to GitLab

Subversion (SVN) is a central version control system (VCS) while
Git is a distributed version control system. There are some major differences
between the two, for more information consult your favorite search engine.

## Overview

There are two approaches to SVN to Git migration:

#### [Git/SVN Mirror](#mirror)

 Make GitLab repository mirror SVN project.
 
 Git and SVN project are kept in sync; use either one or another.
 
 Smoothens migration process and allows to manage migration risks.

#### [Cut over migration](#cutover)

  Translate existing data and history from SVN to Git.
  
  Fire and forget approach, good for smaller teams.

## Smooth migration with a Git/SVN mirror using SubGit <a name="mirror"></a>

#### Prerequisites

Install Oracle JRE 1.8 or newer. On Debian-based Linux distributions follow this 
[instruction](http://www.webupd8.org/2012/09/install-oracle-java-8-in-ubuntu-via-ppa.html).

Download SubGit tool from [https://subgit.com/download/](https://subgit.com/download/)

Unpack downloaded SubGit zip archive to `/opt` directory, subgit will be available
at `/opt/subgit-VERSION/bin/subgit`

#### Configuration

In GitLab create new empty repository. In filesystem it will be located at 
`/var/opt/gitlab/git-data/repositories/USER/REPOS.git` path.

Run SubGit to set up a Git/SVN mirror. Make sure `subgit` command is ran
on behalf of the same user that runs GitLab.

```
subgit configure --layout auto SVN_PROJECT_URL GIT_REPOS_PATH
```

Adjust authors and branches mappings, if necessary:

```
edit GIT_REPOS_PATH/subgit/authors.txt
edit GIT_REPOS_PATH/subgit/config
```

For more information regarding SubGit configuration options, refer to 
[documentation](https://subgit.com/documentation.html) at SubGit web site.

#### Initial translation

Run `subgit` to perform initial translation of existing SVN revisions into
Git repository:

```
subgit install GIT_REPOS_PATH
```

After initial translation is completed, GitLab Git repository and SVN project
will be kept in sync by `subgit` - new Git commits will be translated to SVN
revisions and new SVN revisions will be translated to Git commits. Mirror works
transparently and does not require any special commands.

Would you prefer to perform one-time cut over migration with `subgit` use 
`import` command in place of `install`:

```
subgit import GIT_REPOS_PATH
```

#### Licensing

Running SubGit in a mirror mode requires [registration](https://subgit.com/pricing.html). Registration is free for Open Source,
Academic and Startup projects.

We're currently working on deeper GitLab/SubGit intergation. You may track our
progress at [this issue](https://gitlab.com/gitlab-org/gitlab-ee/issues/990).

#### Support

For any questions related to SVN to GitLab migration with SubGit contact us at [<EMAIL>](mailto:<EMAIL>). We support
all our users.

## Cut over migration with svn2git <a name="cutover"></a>

If you are currently using an SVN repository, you can migrate the repository
to Git and GitLab. We recommend a hard cut over - run the migration command once
and then have all developers start using the new GitLab repository immediately.
Otherwise, it's hard to keep changing in sync in both directions. The conversion<commit_msg>Update migrating_from_svn.md document on migration from SVN to GitLab as suggested by @axil in MR 6549.<commit_after># Migrating from SVN to GitLab

Subversion (SVN) is a central version control system (VCS) while
Git is a distributed version control system. There are some major differences
between the two, for more information consult your favorite search engine.

## Overview

There are two approaches to SVN to Git migration:

1. [Git/SVN Mirror](#smooth-migration-with-a-gitsvn-mirror-using-subgit) which:
    - Makes the GitLab repository to mirror the SVN project.
    - Git and SVN repositories are kept in sync; you can use either one.  
    - Smoothens the migration process and allows to manage migration risks.

1. [Cut over migration](#cut-over-migration-with-svn2git) which:
     - Translates and imports the existing data and history from SVN to Git.
     - Is a fire and forget approach, good for smaller teams.

## Smooth migration with a Git/SVN mirror using SubGit

#### Prerequisites

Install Oracle JRE 1.8 or newer. On Debian-based Linux distributions follow this 
[instruction](http://www.webupd8.org/2012/09/install-oracle-java-8-in-ubuntu-via-ppa.html).

Download SubGit tool from [https://subgit.com/download/](https://subgit.com/download/)

Unpack downloaded SubGit zip archive to `/opt` directory, subgit will be available
at `/opt/subgit-VERSION/bin/subgit`

#### Configuration

In GitLab create new empty repository. In filesystem it will be located at 
`/var/opt/gitlab/git-data/repositories/USER/REPOS.git` path by default. 
For convenice, assign this path to a variable:

```
GIT_REPOS_PATH=/var/opt/gitlab/git-data/repositories/USER/REPOS.git
```

SubGit will keep this repository will be kept in sync with a remote SVN project.
For convenience, assign remote SVN project URL to a variable:

```
SVN_PROJECT_URL=http://svn.company.com/repos/project
```

Run SubGit to set up a Git/SVN mirror. Make sure `subgit` command is ran
on behalf of the same user that keeps ownership of GitLab Git repositories (`git` by default):

```
subgit configure --layout auto $SVN_PROJECT_URL $GIT_REPOS_PATH
```

Adjust authors and branches mappings, if necessary:

```
edit $GIT_REPOS_PATH/subgit/authors.txt
edit $GIT_REPOS_PATH/subgit/config
```

For more information regarding SubGit configuration options, refer to 
[documentation](https://subgit.com/documentation.html) at SubGit web site.

#### Initial translation

Run `subgit` to perform initial translation of existing SVN revisions into
Git repository:

```
subgit install $GIT_REPOS_PATH
```

After initial translation is completed, GitLab Git repository and SVN project
will be kept in sync by `subgit` - new Git commits will be translated to SVN
revisions and new SVN revisions will be translated to Git commits. Mirror works
transparently and does not require any special commands.

Would you prefer to perform one-time cut over migration with `subgit` use 
`import` command in place of `install`:

```
subgit import $GIT_REPOS_PATH
```

#### Licensing

Running SubGit in a mirror mode requires [registration](https://subgit.com/pricing.html). Registration is free for Open Source,
Academic and Startup projects.

We're currently working on deeper GitLab/SubGit intergation. You may track our
progress at [this issue](https://gitlab.com/gitlab-org/gitlab-ee/issues/990).

#### Support

For any questions related to SVN to GitLab migration with SubGit you can contact SubGit team at [<EMAIL>](mailto:<EMAIL>).

## Cut over migration with svn2git

If you are currently using an SVN repository, you can migrate the repository
to Git and GitLab. We recommend a hard cut over - run the migration command once
and then have all developers start using the new GitLab repository immediately.
Otherwise, it's hard to keep changing in sync in both directions. The conversion
{'fraction_non_alphanumeric': 0.07930937675463223, 'fraction_numerical': 0.004912970241437394, 'mean_word_length': 4.540435458786936, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 11, 'https://': 10, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 8, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6071784', 'n_tokens_mistral': 2149, 'n_tokens_neox': 1973, 'n_words': 891}