subgit import and multiple branches directories
Asked Answered
W

1

2

I'm trying to do an import using subgit. Just a one-time migration. My SVN structure contains:

  • branches
    • branch1
    • features
      • branch2
  • hotfixes
    • branch3

I'd like to convert all three to branches in git. I've tried:

proj=myproject; subgit import --svn-url <correctPath>/$proj --authors-file
  ~/authors --branches branches --branches branches/features
  --branches hotfixes --tags tags  $i

This seems to just use "hotfixes" as the only place to import from. (I'm using SubGit version 2.0.2 ('Patrick') build #2731.) I also tried using:

--branches "branches;branches/features;hotfixes"

But that completely failed (it was probably looking for a directory with semi-colons in it).

Any suggestion for the one-time import?

(Note, I saw this related question.)

Wolframite answered 23/4, 2014 at 17:33 Comment(3)
Hmmm... my svn structure wasn't so clear branches - branch1 - features - branch2 - hotfixes - branch3Wolframite
'import' command is a short form of 'configure' + 'install' + 'uninstall' commands, so you can use these 3 commands instead of one 'import' command and immediately after 'configure' command modify SubGit config file to specify "branches=" several times.Casady
OK, I can't figure out how to make a multiline post of the branch structure. Let's say that I have a branches dir, with a subdir of features. Both branches and features have actual branches I need to migrate. Plus, there is a folder hotfixes at the same level as branches.Wolframite
C
3

You can use a combination of 'configure' + 'install' + 'uninstall' commands. I suppose, your repository has the following structure:

$ svn ls --depth infinity <SVN_URL>                                                                                                                                                     
branches/                                                                                                                                                                                                                         
branches/branch1/                                                                                                                                                                                                                 
branches/branch2/                                                                                                                                                                                                                 
branches/features/                                                                                                                                                                                                                
branches/features/feature1/                                                                                                                                                                                                       
branches/features/feature2/                                                                                                                                                                                                       
hotfixes/                                                                                                                                                                                                                         
hotfixes/hotfix1/
hotfixes/hotfix2/
tags/
tags/tag1/
tags/tag2/
trunk/

Then do the following. Run 'configure' command:

$ subgit configure --svn-url <SVN_URL> repo

Edit repo/subgit/config file to this repository structure (or you can invent your own refs/heads/ namespaces, the only requirement is: the shouldn't be the same for different kinds of branches; if you need one-time import and everything under refs/heads/*, you can rename them later with a script):

trunk = trunk:refs/heads/master
branches = branches/*:refs/heads/*
branches = branches/features/*:refs/heads/features/*
branches = hotfixes/*:refs/heads/hotfixes/*
tags = tags/*:refs/tags/*
shelves = shelves/*:refs/shelves/*

Run 'install' command:

$ subgit install repo

Then if you run "git branch -a" from "repo" directory, you'll see something like that:

$ git branch -a
  branch1
  branch2
  features/feature1
  features/feature2
  hotfixes/hotfix1
  hotfixes/hotfix2
* master

Optionally you can run 'uninstall' command to disable synchronization temporary or forever (--purge option)

$ subgit uninstall [--purge] repo
Casady answered 23/4, 2014 at 18:1 Comment(3)
Why don't implement for the subgit import a git-svn approach: You can specify more than one --tags and/or --branches options, in case your Subversion repository places tags or branches under multiple paths.?Inroad
I get the following error when I try to use multiple entries for branches: error: Please specify non-conflicting options and try again. I tried not to use wildcards and put everything hardcoded but it just got the first branch.Wilk
It depends on trunk/branches/tags/shelves options you have. Drop a line to [email protected] as it's probably another topic than the question.Casady

© 2022 - 2024 — McMap. All rights reserved.