subgit import and multiple branches directories

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.)


    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
    
    链接地址: http://www.djcxy.com/p/41702.html

    上一篇: RPC失败结果22 http代码404

    下一篇: 子文件导入和多个分支目录