Only import particular subdirectories from svn using subgit?

I have a standard svn layout, but I don't want everything mapped to git. I want something like this:

trunk/a:refs/heads/master/a;trunk/b:refs/heads/master/b

(this assumes there is a 'trunk/c' that is not mapped)

Is this possible? Perhaps by abusing the 'branches' field?

1 answer

1 accepted

Hi Joseph,

As far as I understand, trunk/a, trunk/b and trunk/c are regular directories within trunk branch, is that correct?

It makes sense to map Subversion branches and tags (but not subdirectories) into Git refs as only branches and tags carry proper copy and merge information. So, I'd recommend you to use standard repository layout instead:

trunk = trunk:refs/heads/master

branches = branches/*:refs/heads/*

tags = tags/*:refs/tags/*

As to c directory, it's still possible to ignore it with experimental skip feature. Unfortunately, there are no UI settings to enable this feature, but you can try to do the following:

1. Create new Git repository in Stash;

2. Go to Subversion Mirror page;

3. Fill in all the required fields there and click continue;

4. When the page with authors mapping is displayed (see screenshot below), adjust SubGit config file <STASH_HOME>/data/repositories/<ID>/subgit/config, so it has the following option:

[svn]

skip = ^c(\\/|$)

You can use any Java regular expression here; SubGit ignores any path within any branch and tag if it matches that regex.

Hint: you can find repository ID on Settings | Repository Details page.

Authors mapping

5. Finally, adjust authors mapping as needed and start initial import by clicking continue.

Please feel free to ask any questions on that.

Regards,

Semyon

That's great. Thanks!

Suggest an answer

Log in or Sign up to answer
Atlassian Community Anniversary

Happy Anniversary, Atlassian Community!

This community is celebrating its one-year anniversary and Atlassian co-founder Mike Cannon-Brookes has all the feels.

Read more
Community showcase
Bridget Sauer
Published Thursday in Marketplace Apps

Calling all developers––You're invited to Atlas Camp 2018

 Atlas Camp   is our developer event which will take place in Barcelona, Spain  from the 6th -7th of   September . This is a great opportunity to meet other developers and get n...

128 views 0 5
Read article

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you