Sean Thorburn
Sean Thorburn

Reputation: 1778

VisualSVN Corrupt representation after deleting bad commit

After following https://groups.google.com/forum/#!topic/visualsvn/2LpBN8qtEfM


The below procedure describes how to “undo” the last commit to an svn repository (fsfs backend) in an extreme case: (Please test it thoroughly on a “test” repo in your environment before actually applying it) Assuming the bad revision number is $BAD_REV

  1. Stop the visual svn server.
  2. Backup all your repos (to save from an unfortunate scenario, if it happens)
  3. Go to the “Repositories” folder.
  4. Select the particular repo in which you need to “undo” the last commit.
  5. Edit db/current and decrement the first number. That’s the HEAD rev.
  6. Delete db/rev/$BAD_REV
  7. Delete db/revprops/$BAD_REV
  8. Start the visual svn server.

Caution: Ask all the users to delete the checkouts which used $BAD_REV and check out afresh using ($BAD_REV minus 1).


After the second commit after this procedure, I got the following error:

Error Commit failed (details follow):
Error Corrupt representation '199 10142 111 1475 (null)
Error d18718662872fab9aa981c20a47921768f567189 (null)

Not sure how to solve this and I do not want to create a new repository.

Upvotes: 2

Views: 3877

Answers (3)

Aleksandar Pavić
Aleksandar Pavić

Reputation: 3420

I had exactly the same problem while moving svn repository from one server to another via svnadmin tool.

What I did is deleting the new repo that I have created, and imported it again without forcing the UUID.

You can set UUID later via svnadmin setuuid [some id]

Upvotes: 0

Sean Thorburn
Sean Thorburn

Reputation: 1778

It seems deleting the rep-cache.db file in the repository folder did the trick.
"Representation" led me to believe it was cached somewhere.

Hope this fix lasts, and I hope I was able to help someone else in a similar situation.

Upvotes: 0

bahrep
bahrep

Reputation: 30662

You broke the repository by manually editing it's internals. Ali's procedure is harmful, in fact. You must not touch repository internals unless you really know what you are doing. I hope that you have a backup of this repo.

Did you read the thread you refer in the question? Simon explicitly discourages from using the procedure specified by Ali.

We do not recommend to use that procedure to remove last revision. Subversion repository structure is a more complex than it seems to be.

Usually you can just revert unnecessary changes in a working copy and commit correct revision. If you really need to delete last revision from the repository follow these steps:

  1. Make a backup of the repository.

  2. Dump all revisions except last. Suppose last revision is 10:

    svnadmin.exe dump -r1:9 <repository path> > repo.dump.

  3. Create new repository.

  4. Load dump to the new repository:

    svnadmin.exe load <new repository path> < repo.dump.

If you don't have a backup, then the only possible solution to repair the repository would be to follow these steps:

  1. Make a backup of the repository,
  2. Check the repository using svnadmin verify tool,
  3. Start Windows Explorer and navigate to <path-to-repository>\db\ directory,
  4. Remove the rep-cache.db file from the directory and try to access it via Subversion client again (e.g. try to commit any change to the repo). It may help unless the repository is completely broken.

    Nevertheless, I strongly recommend restoring the backup of the repository and following the correct procedure which involves using svnadmin dump and svnadmin load tools.

Upvotes: 1

Related Questions