Symfony World blog is not maintained anymore. Check new sys.exit() programming blog.

svn dump subrepo

Subversion tools enable you to dump only chosen parts of the original repository. This may be especially useful, when you want to separate a smaller project out from a bigger thing. svnadmin dump will be used along with svndumpfilter command. svndumpfilter must be run using one of the following subcommands: include or exclude. Depending on what is easier, you may specify which path prefixes (or directories) will be included into new subrepo dump - or which will be excluded.

For example, let's assume our original repository structure looks like the following:

/abc
  some content
/def
  some content
/ghi
  some content
/jkl
  some content
If we run:
$ svndumpfilter include /abc /def # pseudo command
our subrepo will consist of:
/abc
  some content
/def
  some content
but if we run:
$ svndumpfilter exclude /abc # pseudo command
our subrepo will consist of:
/def
  some content
/ghi
  some content
/jkl
  some content
I wrote pseudo command, since you have to stream the original repository first, so that svndumpfilter can filter its content. Real commands would look like:
$ svnadmin dump /home/tomasz/svn/original_repo | svndumpfilter include /abc /def --drop-empty-revs --renumber-revs > subrepo.svndump

$ svnadmin dump /home/tomasz/svn/original_repo | svndumpfilter exclude /abc --drop-empty-revs --renumber-revs > subrepo.svndump

Now let's take a look at some svndumpfilter options:

--drop-empty-revs

If filtering causes any revision to be empty (i.e., causes no change to the repository), removes these revisions from the final dump file.

--renumber-revs

Renumbers revisions that remain after filtering.

Thanks to above options, the result repository dump will look as if it always consisted of the chosen parts (no empty commits).

No comments:

Post a Comment

Post a Comment