2

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

lc.
  • 113,939
  • 20
  • 158
  • 187
Shweta Chandrakar
  • 353
  • 2
  • 3
  • 12
  • Check out this solution here: http://stackoverflow.com/questions/4047941/renaming-svn-repository-project-name – blamonet Mar 15 '13 at 16:32
  • If you are using [VisualSVN Server](https://www.visualsvn.com/server/), you can simply right-click a repository in the VisualSVN Server Manager MMC and select "Rename" – Uwe Keim Aug 01 '16 at 13:00

1 Answers1

1

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
David W.
  • 105,218
  • 39
  • 216
  • 337
  • Thanks David, thanks for the detailed description. I am a bit confused now. Please let me know if I have done something wrong here - I just need to execute the following steps 1. $ ssh somename.dev.loc.con.dept 2. $ pkill svnserve 3. $ mv /export/svnrepo/oldname /export/svnrepo/newname 4. $ svnserve -r / -d 5. $ svn co svn://somename.dev.loc.con.dept/newname/CL_abc/trunk – Shweta Chandrakar Mar 25 '13 at 15:48
  • 1
    That it. To rename a repository using `svnserve`, you just rename the directory of that repository. I normally specify `-r` to be either the directories where the repositories reside or the repository directory itself. I don't know the behavior if you start svnserve with `/` as the repository root. Besides, you now have to specify the whole directory structure from /export in the svn URL. – David W. Mar 25 '13 at 17:28
  • Thanks, I will try. What about the working copy dir, do i need to make any changes to reflect the new URL? – Shweta Chandrakar Mar 25 '13 at 18:50
  • You need to use `svn relocate` or in older svn clients `svn switch --relocate`. Do `svn help relocate`. – David W. Mar 28 '13 at 14:34
  • Thanks a ton David. This is perfect. – Shweta Chandrakar Mar 28 '13 at 18:33