Jon Cage
Jon Cage

Reputation: 37516

How do I move a portion of a subversion repository to a new one without losing the history?

I have a subversion repository which currently has code, documentation and deliverables. This is becoming messy and unmanageable so I'd like to split the repositories into three.

How can I move subsections of the original repository (which will contain purely code) into new Documentation and Deliverables repositories without losing the history? For example:

<old_repos>\Docs
<old_repos>\Deliverables
<old_repos>\Src

...becomes:

<docs_repos>
<deliverables_repos>
<src_repos>

I've seen a lot of posts about moving folders around within a repository and others showing how to move one whole repository to another, but nothing that suggests how to just move a subset. Is this possible?

Upvotes: 1

Views: 337

Answers (2)

Lazy Badger
Lazy Badger

Reputation: 97395

Not tried and not tested personally

You'll use svnadmin dump, svnadmin load and svndumpfilter (commands are slightly Unixish-style)

1 Create full dump of original repo: svnadmin dump . > full.dump

2-4 Filter dump and leave only revisions, related to needed subdir respectivey: cat full.dump | svndumpfilter include DIR-PATH --drop-empty-revs --renumber-revs --skip-missing-merge-sources --preserve-revprops > DIR-PATH.dump

5-7 For every new empty repo: svnadmin load . --parent-dir trunk --ignore-uuid < DIR-PATH.dmp

In worst case new repos will get not /trunk/*.* data-trees, but /trunk/DIR-PATH/*.*, which are easy eliminated by one big move and delete empty DIR-PATH after all

PS - I just discovered after writing my text: How to move a single folder from one Subversion repository to another repository?

Upvotes: 1

Rup
Rup

Reputation: 34418

You can use svndumpfilter. There's instructions in the docs there, although

  • you can't (last time I tried) use a --deltas dump - it doesn't support that. I think --incremental was OK though
  • editing the paths on all files usually means carefully editing the dump file, which is a pain because it's a mix of binary and text. I normally have to delete the first few revisions that create directories and amend one of them to make the correct new directories too.

It takes a bit of effort but I've done this successfully a few times.

Upvotes: 1

Related Questions