Can I move an existing Subversion repository into a new parent repository (and retain the history)?

前端 未结 4 1480
夕颜
夕颜 2020-12-29 04:02

Currently I have a root-level repository set up for each project, like so:

Project1
Project2
Project3
Project5
Project5

I\'d like to reorga

4条回答
  •  臣服心动
    2020-12-29 04:51

    Since the accepted answer is incomplete and hasn't been corrected, here's how you actually do it.

    (1) Your source repo is a single-project repo, with top-level dir foo. Go to your old server and create a dump file:

    [old-server]$ svnadmin dump /path/to/old-repo > foo.dump
    

    (2) Your target repo already contains two projects, with top-level dirs bar and baz, and is at http://new-server/svn. Now create an additonal foo top level:

    [client]$ svn ls http://new-server/svn/
    bar/
    baz/
    [client]$ svn mkdir -m "Adding new foo project" http://new-server/svn/foo
    [client]$ svn ls http://new-server/svn/
    bar/
    baz/
    foo/
    

    (3) On your new server, the repo is at /path/to/new-repo (which is what http://new-server/svn/ maps to). Note that the svn mkdir above didn't actually create a new directory in /path/to/new-repo; it just changed the database. Go to the new server and

    [new-server]$ svnadmin load /path/to/new-repo --parent-dir foo < foo.dump
    

    Done, with complete history. You can now check out foo as:

    [client]$ svn co http://new-server/svn/foo foo
    

    If this is the first time you've done an svnadmin, you may find that you get file permission errors (txn-current-lock/etc) if, for example, the repo is owned by apache, and you're not in the apache group. The easiest fix is to add yourself to the apache group.

提交回复
热议问题