Skip to content. | Skip to navigation

Personal tools
Log in
Sections
You are here: Home How To OS X Admin Fix svn: Revision file lacks trailing newline

Fix svn: Revision file lacks trailing newline

How to fix the dreaded "svn: Revision file lacks trailing newline".

DISCLAIMER: I know this is filed under OS X admin, but it is applicable to svn on any platform. Also, I can not guarantee this will not hose your svn repository, but I couldn't see what was wrong with it. SVN seems to have a pretty robust repository structure.

Search terms: svn | subversion | fix | restore | correct | revert | repair | svn: revision file lacks trailing newline

Today I got the dreaded "svn: Revision file lacks trailing newline" error. This error arises when committing 4 GB or more to certain FSFS subversion type repositories. Although the problem is documented here, nothing on the web says how to get your subversion repository corrected after this apparent disaster. Below are the steps I used to get my repository rolled back to something that would work. As mentioned in the disclaimer above, I can not guarantee this won't hose your repository in some way, but I could find no other way to repair it described on the web. I have performed the following steps with my repository and it seems to be working fine.

The Fix

  1. If you can, make a backup of your repository before you begin, just in case this procedure doesn't get your repository working.
  2. Go to the repository database (".../repo/db/").
  3. Make a copy of the file "current" outside of your repository (above the "repo" directory, for instance).
  4. Change the number in the file "current" to one less than that number. For example, if the file current has the number "2259" as the first number, change it to "2258". There will be two other strings with letters and/or numbers. Just change the first number.
  5. In the "revs" directory of "repo/db", move the file corresponding to the old number in the file "current" to a location outside of the repository. In the above example you would move the file "2259" out of the repository.
  6. Repeat Step 5 for the directory revprops. In the example above, you would change to the "revprops" directory and move the file "2259" out of the repository.
  7. Depending on how your svn repository is set up, you may want to restart your svn server, etc.
  8. You will want to make sure your repository is working fine before you delete any files you moved or created in Steps 3, 5, and 6.
  9. To get your big commits to work, you will want to just commit in smaller chunks. On unix, you can use the command "du", etc. For OS X, you can go to the terminal and use "du -srkc" with the appropriate files to see how big the commit will be. Check the size of your commit before you add or import files. Also, this 4 GB limit might be corrected with a new build of svn using all of the latest libraries.