Is there a way when creating new SVN repositories for the client (tortoisesvn) to create the branches, tags and trunk folders automaticlly?

I’m using tortoisesvn to create the repositories and wondered if there was a way it could automatically create a skeleton directory structure within the repository?

I need this as I’m going to allow other people in the team to set-up new repositories and I need to make it as simple as possible and minimise mistakes. I would like the tags, branches and trunk directories to be created automatically.

  • Externalising SCM credentials with Maven
  • SVN 1.7+ in Netbeans 7.0
  • Is it possible to have a Subversion repository as a Git submodule?
  • SVN switch vs relocate in a multiple project repository case
  • How to delete .svn folders in my Source tree?
  • Difference between SCM and SVN
  • Steps needed to allow hgsubversion SVN clone to push back
  • “git svn fetch” fails, ls-tree dying because of missing tree object
  • GIT - Compile and Test Staging Area
  • Multiple Subversion clients and TortoiseSVN
  • svn command line equivalent of 'git log -p'?
  • Conflict while trying a revert in Git
  • 6 Solutions collect form web for “Is there a way when creating new SVN repositories for the client (tortoisesvn) to create the branches, tags and trunk folders automaticlly?”

    You can write a script (in the language of your choice) that creates the repository and commits the predefined directory structure, using the svn command line client.

    Make a script. If you are on Windows, a bat. On Linux etc, an bash.

    I would suggest the following approach:

    1. create an empty repository
    2. check out a working copy of that empty repository
    3. add trunk/branches/tags folders
    4. set properties on those folders (e.g., if you’re using TSVN you might want to set the tsvn:minlogsize and/or the tsvn:autoprops properties)
    5. commit those folders
    6. run svnadmin dump path/to/Repo > templaterepo.dmp

    Now you have a template repository with some settings and folders pre-set.

    All you need now is a script which does:

    1. svnadmin create path/to/new/Repo
    2. svnadmin load –ignore-uuid path/to/new/repo < templaterepo.dmp

    and you’re done.
    But don’t forget to pass the --ignore-uuid param to svnadmin load! Otherwise you’ll end up with all your repositories having the same uuid – and that will cause problems!

    As this is just a convention for organizing a Subversion repository and you don’t actually want them at the top level all the time I doubt there is a way to do that automatically on repository creation. Usually you don’t create multiple repositories per hour or so anyway.

    This is how I automatically create a branches folder (assuming trunk already exists) so I can automatically branch. This is written in C# and uses the SharpSVN dll to do the work. Then it calls TortoiseSVN (not shown) to do the branch.

    using SharpSvn;
    
    SvnClient client = new SvnClient();
    Uri trunkUri = client.GetUriFromWorkingCopy(trunkPath);
    if (trunkUri.Segments.Last() != "trunk/")
    {
       MessageBox.Show(String.Format("Will skip {0}, because first trunk path does not end in \"trunk\\\"",trunkPath));
        return;
    } else {
        System.UriBuilder builder = new UriBuilder(trunkUri);
        builder.Path += "../branches/";
        Uri    parent = builder.Uri;
    
        System.Collections.ObjectModel.Collection<SvnInfoEventArgs> info;
        bool result = client.GetInfo(SvnTarget.FromUri(parent), new SvnInfoArgs { ThrowOnError = false }, out info);
        if (result == false)
        {
    
           SvnCreateDirectoryArgs args = new SvnCreateDirectoryArgs();
           args.CreateParents = true;
           args.ThrowOnError = true;
           args.LogMessage = String.Format("Creating new branch \"{0}\"", branchName);
           client.RemoteCreateDirectory(parent, args);
        }
        builder.Path += branchName;
        Uri newUrl = builder.Uri;
        TortoiseSVN.Copy(trunkPath, newUrl.ToString(), comment);
    }
    

    Update for TortoiseSVN 1.7

    When you create repository now, after creating you have window with two post-create choices

    • Create folder structure
    • Run repo-browser

    First point is answer on question

    Repo-creation dialogue

    Git Baby is a git and github fan, let's start git clone.