How to rename a repository in SVN?

14,587

You need to do this on the Subversion server that's running the svnserve command. The svnserve command can either take the name of a repository created with the svnadmin create command, or a directory that contains multiple repositories created with the svnadmin command.

One Repository

$ hostname
$ mysvn
$ cd /opt/repos
$ svnadmin create foo
$ svnserve -r foo -d

Accessing that Repository

$ svn ls svn://mysvn
$ svn mkdir svn://mysvn/trunk svn://mysvn/tags svn://mysvn/branches
$ svn co svn://mysvn/trunk

In the above example, I created a Subversion repository called foo, and I ran svnserve with that repository as the root of the server.

When I access that repository, the URL does not have the repository name in it. The root of my URL is simply the machine name. There is nothing to rename.

Multiple Repositories

$ hostname
$ mysvn
$ cd /opt/repos
$ svnadmin create foo
$ svnadmin create bar
$ svnserve -r . -d

Accessing those repositories

$ svn ls svn://mysvn
svn: E210005: Unable to connect to a repository at URL 'svn://localhost'
svn: E210005: No repository found in 'svn://localhost'
$ svn ls svn://mysvn/foo
$ svn ls svn://mysvn/bar
$ svn mkdir svn://mysvn/bar/trunk svn://mysvn/bar/tags svn://mysvn/bar/branches
$ svn co svn://mysvn/bar/trunk

In this example, I created two Subversion repository directories called foo and bar under the /opt/repos directory. When I start up svnserve, I give it the name of the directory that contains my Subversion repositories. My repository names are the names of my directories. I have directories foo and bar and that's there names. If I want to change the names of the repositories, I need to change them on the server:

$ hostname
mysvn
$ pkill svnserve   #Stop the SVN server
$ cd /opt/repos
$ mv bar to fubar  #Change the repo name
$ svnserve -r /opt/repos -d

Accessing the repository

$ svn ls svn://mysvn/fubar/trunk

When I restart the SVN server, my repository has a new name.

It looks like you need to do the following:

$ ssh somename.dev.loc.con.dept  #Get on the Subversion server
$ pkill svnserve                 #Shutdown the server
$ mv /export/svnrepo/oldname /export/svnrepo/newname
$ svnserve -r / -d

Now, you'll be able to access your repository from the new name. However, I would recommend that you simplify your Subversion URL by starting the svnserve process with /export/svnserve as root:

$ svnserve -r /export/svnrepo -d

Now, users can access their projects with a slightly shorter name:

$ svn co svn://somename.dev.loc.con.dept/newname/CL_abc/trunk
Share:
14,587
Shweta Chandrakar
Author by

Shweta Chandrakar

Updated on June 04, 2022

Comments

  • Shweta Chandrakar
    Shweta Chandrakar almost 2 years

    I need to rename my existing repository root name to a new name.

    I am using svnserve server.

    URL: svn://somename.dev.loc.con.dept/export/svnrepo/**old_name/CL_abc/trunk
    Repository Root: svn://somename.dev.loc.con.dept/export/svnrepo/**old_name
    
    1. Rename svn://somename.dev.loc.con.dept/export/svnrepo/old_name
      to
      svn://somename.dev.loc.con.dept/export/svnrepo/new_name

    2. In the command line it should be:

      /export/svnrepo/**old_name**  to /export/svnrepo/**new_name** 
      
    3. Need to rename the repo name too

      CL_abc
      to
      CL_newname