SVN load new repository

2019-08-17 05:36发布

I am currently migrating a repo from Linux to windows. The problem I am having is that when load the new repository the hierarchy is [reponame]\[reponame]. Is there a way to move all the folders up one level?

UPDATE

used the following command to get the repo load svnadmin load [repo] > [repofile].dump

标签: svn visualsvn
1条回答
霸刀☆藐视天下
2楼-- · 2019-08-17 06:15

What was the repository hierarchy under Unix? Were you using http there?

I'm not 100% sure what you you mean. Are you saying that the repository contains a directory that contains the name of the repository? Or, are you saying that when you do a checkout, you now do something like this:

C> svn co http://server/foo/foo/trunk

What does a checkout command now look like?

When you say repository are you talking about a single repository directory you created with the svnadmin create command, or are you talking about multiple projects in a single repository?

Let's say I'm using svnserve to serve my repository. We'll call my repository myproj and I want to serve my repository on my machine softserve. When I want to do a checkout, I do this:

$ svn co svn://softserve/trunk myproj-trunk

Notice I only have the name of my server. The URL doesn't even include the name of my repository . That's because svnserve can only serve a single repository. If I have multiple repositories, I'll either have to have separate machines, merge all the repositories into a single repository, or use different ports.

Apache can service multiple repositories, but each repository needs a virtual web directory for access, so Apache know when it sees the URL it's a Subversion repository and not a directory out of the httpdocs directory. Thus, there's at least one more directory in the Apache URL.

There are two separate ways of specifying an Apache Subversion repository. You can specify a single repository like this:

<Location /myproj>
   DAV svn
   SVNPath C:/path/to/repository/myproj
</Location>

<Location /project_two>
   DAV svn
   SVNPath C:/path/to/repository/project_two
</Location>

In this case, each Apache virtual directory has a single repository. Thus, when I do a checkout, my command looks like this:

$ svn co http://softserve/myproj/trunk myproj-trunk

Notice that there's an extra directory in this URL over the svn URL. That's because I now not only have to specify the server, but also the Apache virtual directory. In this case, I made my virtual directory names agree with my repository name. There's no reason I need to do that, but it would be silly otherwise.

As far as the user is concerned, they're just adding the repository name into the URL. It still makes sense. If I want to checkout from myproj, I use http://softserve/myproj and if I want to checkout from project_two, I use http://softserve/project_two.

However, sometimes a company may have hundreds of Subversion repositories they're serving off their Subversion server. Specifying each and every repository in the Apache configuration is tough, especially if they keep adding in new projects and eliminating old ones.

To get around this issue, you can use the SVNParentPath specification instead of SVNPath. This allows you to specify not the Subversion repository directory, but the parent directory where it should reside:

<Location /source>
   DAV svn
   SVNParentPath C:/path/to/repository
</Location>

Now, I can put all of my repositories under a single directory on my server, and Apache will automatically serve them all. When a new repository is created, I only have to put it under my SVNParentPath. I don't have to modify my Apache configuration.

The problem is now I have to specify not only the Apache virtual directory, but also the repository name. Thus, my URL has another directory in it. (In this case, I called my Apache Parent virtual directory source).

$ svn co http://softserve/source/myproj/trunk myproj-trunk

I just downloaded VisualSVN Server and looked at it. VisualSVN Server runs Apache in the back end. It just automatically configures it for you and creates a nice simple front end. Looking at the created Apache configuration under C:\Program Files\VisualSVN Source\conf\httpd.conf, I see this:

I can imagine when you setup VisualSVN, it does the latter automatically. After all, that's why people will pay for VisualSVN -- it takes care of all the Apache repository handling for you. And, in your case, you did something that resulted in something like this:

<Location /foo>
   DAV svn
   SVNPath C:/path/to/repository
</Location>

And, the only repository under C:/path/to/repository is your foo repository. Thus, your URL looks like this:

<Location /svn/>
   [...]
   SVNParentPath C:/Repositories/
   [...]
</Location>

So, if you put your foo repository under C:\Repositories, your checkout looks like this:

 svn co http://softserve/svn/foo/trunk foo-trunk

I didn't play around with VisualSVN Server to see if I can change the svn Apache virtual directory name from the front end, but I can imagine that you bought the full version that allows for more configuration, and you named your directory the same name as your repository name. Thus, you have

<Location /foo/>
   [...]
   SVNParentPath C:/Repositories/
   [...]
</Location>

And, when you check out from foo, you get this:

 svn co http://softserve/foo/foo/trunk foo-trunk

The double repository name you mentioned.

I can imagine you can hack the raw http.conf file to use SVNPath instead of SVNParentPath, and thus your URL would be something like this:

 svn co http://softserve/foo/trunk foo-trunk

But, I don't know how Visual SVN would handle that. I suspect your best bet would be to just change your Apache virtual directory name back to the default svn or change it to source or src.

查看更多
登录 后发表回答