Question

My SVN repository contains several folders for different projects. 'Desktop program', 'iOS app', 'Web app' etc. All revision entries are shared between these (as it's under one repository. Revision #100 might be on the 'iOS app' folder, revision #101 on the 'Web app' folder etc).

What I want is to roll back to an earlier version on just one of these folders. Usually this is done with a 'reverse' SVN Merge as it's SVNs job to keep track of all history, even the bad times. I don't want that however. Lets say I have twenty commits on 'iOS app' since revision #5. I want to rid these from history and I want that specific folder to return to revision #5. No one should ever again be able to check those twenty commits as they 'never happened'. Is this even possible?

I have two different machines I am interacting to SVN with. A Windows PC with VisualSVN and a Mac with Subversion on Terminal level. I would be thankful for a solution on either.

Was it helpful?

Solution

From client side, there is simply no way to do this. No matter if commandline, Tortoise, or any other client.

If you have access to the server account that owns the repository, then there is some chance - but it is quite complicated and may involve a nontrivial manual work.

Roughly, these are the steps:

  • get the repository UUID - svn info http://svnserver/svn/repo - see the UUID line
  • dump the svn repository: svnadmin dump /path/to/repo > repo.dump
  • edit the dumpfile to exclude the commits

    a) either open it in vi and delete your undesired commits

    b) or use svndumpfilter command to filter them by path

  • create new repository and import your modified repository into it:

    svnadmin create /path/to/repo2

    svnadmin load < repo.dump

    svnadmin setuuid /path/to/repo2 THE_ORIGINAL_UUID

Now, check that repo2 is working fine and has the content that you expect. If so, you can remove repo and rename repo2 -> repo.

Keep in mind that manual changes to the dumpfile are extremely prone to errors, and often these errors can be quite difficult to discover. It is usually bad idea to do things like this.

OTHER TIPS

What I want is to roll back to an earlier version on just one of these folders. Usually this is done with a 'reverse' SVN Merge

Terrible... In order to return back part of WC-tree into some previous revision you have to cd SUBTREE-ROOT & svn up -r REVNO (commit from WC-root for this modified WC will create new revision in repo with partially rollbacked tree)

No one should ever again be able to check those twenty commits as they 'never happened'

Cheated and rewritten history in SCM is BAD IDEA. And Subversion history is immutable, you have to change history using svnadmin tools and access-level, as @petr-kozelka wrote

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top