I would like to clean up an existing subversion repository containing badly formatted Perl code. Since I am not sure if some comparisons with fairly old code will be necessary, ideally I would like to have the same formatting for all revisions.
On the other hand creating a new repo by checking out all old revisions, reformatting with perltidy and checking in will have to keep the original log messages.
Are there any tools/recipes to do it?
What exactly do you want to do? Clean up all the old revisions?
Don't do it. You'll destroy your history, and even though you should be generating the same Perl script (just now tidied up), you could end up funking up some previously released revision. Besides it isn't worth the effort.
I would recommend that you checkout your current revisions, run Perl Tidy, and then check in your changes. You won't change your old code, but it will give you clean stuff to work with from now on.
Of course, if your Perl code is so poorly formatted that you want to run the whole thing with Perl tidy, you have more issues. What prevents someone from making a mess of the code again?
I would also recommend you look at Jenkins as part of a continuous build process. You don't compile Perl code, but you could use Jenkins to run tests to make sure any new Perl scripts and any modifications to your Perl scripts have been tidied up. If a Perl script has bad formatting, you'll Fail the build and email yourself and the developer.
Developers will quickly learn to use Perl Tidy before checking in new Perl code of face the public embarrassment of having a failed build.
By the way, does the rest of your development team support your effort? If not, the first thing you have to do is convince them that good Perl formatting can help reduce bugs, and give them tools that will help automate their formatting efforts.