include multiple folders using svndumpfilter

2020-03-05 04:02发布

问题:

I have created a repository named as allProjects in server. Below is the allProjects structure:

allProjects

  • Projects
    • projectA
    • projectB
    • projectC
    • projectD
    • projectE

Now I am trying to create another repository named as requiredProjects which includes specific projects from allProjects.

Expected requiredProjects structure is:

requiredProjects

  • projectB
  • projectD
  • projectE

I also want to create requiredProjects repository with all access controls and history exactly similar to allProjects.

I have been searching a lot on this topic however I'm unable to find any solution.

Any help would be greatly appreciated.

回答1:

Read about SVN externals, if you want to have single point of history for shared objects or svnadmin dump + svndumpfilter + svnadmin load in case of physical replication of subtree

As result of fastest search I found:

  • svndumpfilter include in SVN Book
  • Some Gotchas with using svndumpfilter blog record

and, if you'll have hard times with errors "Missing node" in ordinary svndumpfilter command

svndumpfilter include Projects/projectB Projects/projectD Projects/projectE > filtereddump.dmp

you have to have, understand and use "Ultima ratio regum": Svndumpsanitizer



回答2:

Please bear in mind that I haven't used Subversion since Jun 2010 (back when I wrote that answer) but from memory, something like the following will get you a cloned copy of allProj called reqProj.

The following steps have to be executed on the server hosting the Subversion repository.

It assumes that on the machine that hosts your Subversion repositories, the repositories exist on X:\Repositories and the URL to the Subversion server is http://localhost:8080 and the one is in the working folder.

Step 1

  • svnadmin create X:\Repositories\reqProj
  • svnadmin dump X:\Repositories\allProj > allProj.dmp
  • svnadmin load X:\Repositories\reqProj < allproj.dmp
  • svn checkout http://localhost:8080/svn/reqProj reqProj

I would use the Repository Browser available through TortoiseSVN to perform the following steps.

Step 2

Next, delete the project folders you don't need, such as projectA and projectC. Finally, you can move projectB, projectD, and projectE to the top level and get rid of the Projects folder as well.

You will end up with some extraneous history (describing the deletions and folder moves), but that's okay, I guess? :)

I hope this helps you out.