How to split an SVN folder into its own repository

2019-01-29 23:38发布

I want to split a directory from a large Subversion repository to a repository of its own, and keep the history of the files in that directory.

I tried the regular way of doing it first

svnadmin dump /path/to/repo > largerepo.dump
cat largerepo.dump | svndumpfilter include my/directory >mydir.dump

but that does not work, since the directory has been moved and copied over the years and files have been moved into and out of it to other parts of the repository. The result is a lot of these:

svndumpfilter: Invalid copy source path '/some/old/path'

Next thing I tried is to include those /some/old/path as they appear and after a long, long list of files and directories included, the svndumpfilter completes, BUT importing the resulting dump isn't producing the same files as the current directory has.

So, how do I properly split the directory from that repository while keeping the history?

EDIT: I specifically want trunk/myproj to be the trunk in a new repository PLUS have the new repository include none of the other old stuff, ie. there should not be possibility for anyone to update to old revision before the split and get/see the files.

The svndumpfilter solution I tried would achieve exactly that, sadly its not doable since the path/files have been moved around. The solution by ng isn't accetable since its basically a clone+removal of extras which keeps ALL the history, not just relevant myproj history.

18条回答
ら.Afraid
2楼-- · 2019-01-29 23:51

I've tried at least 4 different applications to do that, the only that really worked was using svndumpfilterIN :

cd /usr/local/bin/
sudo wget --no-check-certificate https://raw.github.com/jasperlee108/svndumpfilterIN/master/svndumpfilter.py
sudo chmod +x svndumpfilter.py
# To be sure nothing will happened on the original repo :
cp -au /path/to/repo /tmp/largerepo.repo/
svnadmin dump /path/to/repo > /tmp/largerepo.dump
svndumpfilter.py /tmp/largerepo.dump --repo=/tmp/largerepo.repo --output-dump=/tmp/mydir.dump include my/directory

Here is what I tried and didn't worked :

查看更多
爷的心禁止访问
3楼-- · 2019-01-29 23:52

I had a similar problem splitting a repository ..

svndumpfilter: Invalid copy source path /dir/old_dir

What I did to get around the problem was to include the additional old directories that is was requesting, or that you know you moved. In my case I had moved 3 directories into another directory.

eg. Moved Folders A,B,C in to Folder D

cat project.dump | svndumpfilter include A B C D > new.dump

This seemed to solve my problem. I was able to separate Folder D from the rest of the Repo. On the flip-side, when excluding D I did not get the error, I would guess because removing D didn't require the links/history to A,B,C

查看更多
我欲成王,谁敢阻挡
4楼-- · 2019-01-29 23:53

I see this is quite old now, but does adding "--skip-missing-merge-sources" help any? It seems like it might...

查看更多
一纸荒年 Trace。
5楼-- · 2019-01-29 23:57

I've just successfully migrated a project from an existing combined repo (at Google Code) to its own repo. The posts here were very helpful.

This is what finally worked for me...

  1. Used svnsync to make a local mirror of my Google Code repo following the directions here.
  2. svnadmin dump to foo-dumpfile
  3. cat dumpfile | ./svndumpfilter3 --untangle mymirrorrepo trunk/foo > foo-dumpfile
  4. svnadmin create foorepo
  5. svnadmin load foorepo --ignore-uuid < foo-dumpfile

The --untangle option in step 3 managed to resolve all of the path problems that stumped svndumpfilter and svndumpfilter2.

Initially, at step 5 I was stuck on the error:

<<< Started new transaction, based on original revision 2
svnadmin: File not found: transaction '1-1', path 'trunk/foo'

But this post in Charles Calvert's blog explained that all that was required was to create the trunk dir in foorepo before doing the load.

查看更多
看我几分像从前
6楼-- · 2019-01-29 23:58

Some more info about svndumpfilter and how to fix - http://blog.rlucas.net/uncategorized/some-gotchas-with-using-svndumpfilter/

Or you can try svndumpfilter replacement script, now called as svndumpfilter2 - http://cogo.wordpress.com/2009/03/10/problems-with-svndumpfilter/

I didn't tried that script, coz i need some time to make a repo backup, to test in on that (i have a backup dump to play with but on Windows, and it is a linux script).

查看更多
手持菜刀,她持情操
7楼-- · 2019-01-29 23:59

auriarte's link to svndumpfilter3 404's. Here's a working link (as of 2011-01-31), for anyone looking for it: http://furius.ca/pubcode/pub/conf/bin/svndumpfilter3.html

查看更多
登录 后发表回答