Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

Importing complex SVN into stash

Jeff Warnica August 7, 2013

I'm trying to evaluate Stash, specifically with an end goal of migrating from a very legacy SVN setup as well. I'm new to this team, and was not involved in the inital SVN layout. Anyway, long story short, its a mess. I've used svn2git, and the rather generic Atlassian docs, but, well, GIGO, I suppose. I see that pull requests can go across repositories (and assume, automatic triggers could, too). Maybe I just need to build things out by hand.

I guess, I'm wondering if there is a more full "worst case" import scenario?

6 answers

1 vote
Andrew Morin August 7, 2013

In Stash once you create a repository there is a "Import from SVN" link on the new repository page. This will import directly from Subversion. I have used this with much greater success then any of the svn2git or other conversion options to import non tradional type SVN repositories into Git. (Repo's exceeding 1.5 GB per branch in SVN) As far as process goes if moving to Git you should be starting to look at your processes in a whole new way as well....

cofarrell
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
August 7, 2013

Good suggestion Andrew. FYI that's not in Stash by default - you need to install the following plugin:

http://subgit.com/stash/

0 votes
Semyon Vadishev
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
August 9, 2013

Sorry, I thought you're already using our plugin for Stash.

Just install SVN Mirror Add-on, create new Git repository and click "SVN Mirror" button on repository page. Then, on SVN settings page, specify the options I've listed in my previous comment:

trunk = plugins:refs/heads/master

branches = somethingelse:refs/heads/somethingelse; differentthing:refs/heads/differentthing; branches/*:refs/heads/*; branches/client_ABC/*:refs/heads/client_ABC/*; branches/client_FOO/*:refs/heads/client_FOO/*

tags = tags/plugins/*:refs/tags/plugins/*; tags/client_ABC/*:refs/tags/client_ABC/*; tags/client_FOO:refs/tags/client_FOO

Alternatively, you can use SubGit 2.0:

$ subgit configure --svn-url $SVN_URL $GIT_REPO

Then adjust $GIT_REPO/subgit/config file:

[svn]

trunk = plugins:refs/heads/master

branches = somethingelse:refs/heads/somethingelse

branches = differentthing:refs/heads/differentthing

branches = branches/*:refs/heads/*

branches = branches/client_ABC/*:refs/heads/client_ABC/*

branches = branches/client_FOO/*:refs/heads/client_FOO/*

tags = tags/plugins/*:refs/tags/plugins/*

tags = tags/client_ABC/*:refs/tags/client_ABC/*

tags = tags/client_FOO:refs/tags/client_FOO

And finally run import command:

$ subgit import $GIT_REPO

This time import should go much faster as the previous time you've specified invalid configuration that converted certain branches as regular directories which is very time consuming.

Feel free to use a trial license for SVN Mirror Add-on; as to SubGit, one should pay for mirroring functionality only, converting any repository is always free.

Hope that helps,

Semyon

0 votes
Jeff Warnica August 8, 2013

Where/how could I do such configuration?

0 votes
Semyon Vadishev
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
August 8, 2013

Jeff,

Here're the proper options for your repository layout:

trunk = plugins:refs/heads/master

branches = somethingelse:refs/heads/somethingelse; differentthing:refs/heads/differentthing; branches/*:refs/heads/*; branches/client_ABC/*:refs/heads/client_ABC/*; branches/client_FOO/*:refs/heads/client_FOO/*

tags = tags/plugins/*:refs/tags/plugins/*; tags/client_ABC/*:refs/tags/client_ABC/*; tags/client_FOO:refs/tags/client_FOO

Once you've specified your branches and tags like this, import should work well. In case you have any other questions please contact us at support at subgit.com or via our issue tracker

Regards, Semyon

0 votes
Jeff Warnica August 8, 2013

I haven't seen git filter-branch; I should have explicitly mentioned I'm not familier with Git (or DVCS) generally. Maybe that is what I need.

Yesterday was spent redoing the import with SubGit (very slow SVN server). Granting that was fewer steps than svn2git, past testing/eval, it might be a one time thing so no sale).

As for "complex", for example, the layout is (trimmed)

/

/somethingelse

/differetntthing

/plugins (actually "trunk")

/tags/plugins/3.1.0

/tags/plugins/3.1.2

/tags/client_ABC/3.1.0

/tags/client_ABC/3.1.2

/tags/client_ABC/3.2.0

/tags/client_FOO/3.1.0

/tags/client_FOO/3.1.2

/tags/client_FOO/3.2.0

/branches/plugins

/branches/client_ABC/3.2-maint
(etc, etc)

With the defaults, (save renaming trunk), the subgit created repos looka something like:

(branches)

heads/client_ABC

heads/client_FOO

master

client

(tags)

tags/client_ABC

tags/client_FOO

tags/plugins

and then, under (tags) tags/client_ABC is a directory: /3.1.2

I would have expected to see, in the drop down under tags something like

tags/client_ABC/3.1.2

or even

tags/client_ABC_3.1.2

Presumably, git-filter-branch could deal with this type of chicancery. I guess that is my question then, is are their some examples around of end-to-end SVN->git/stash migration where the SVN layout isn't exactly sane, starting out.

FWIW, I'm not personally sure the current workflow flow ("thats the real WTF"). I'm presuming something like:

/branches/client_ABC/3.2-maint --> /tags/client_ABC/3.2.1
--> /branches/plugins/
--> /plugins

0 votes
cofarrell
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
August 7, 2013

Hi Jeff,

I'm not quite sure what you're asking?

Just a few things:

1. Have you seen git filter-branch? It's pretty much the swiss army knife of repository manipulation, don't leave home without it. You could, for example, extract sub repos from your single SVN repo. Or even move folders (and history) from one place to another. And much more. Not sure if that's helpful?

2. I haven't used svn2git, generally git-svn is awesome except for speed. If you're history is missing something that's where I would start.

3. Not sure what you mean by PRs across repositories? We only allow users to create PRs across one repository and any child forks. By automatic triggers do you mean hooks? Hooks are generally enabled and configured per repository.

4. What do you mean full 'worst case' import scenario?

Apologies that I've not quite understood your question.

Charles

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events