views:

107

answers:

4

Can I take multiple revisions in Subversion and combine them into one?

I'd like to be able to take a few commits that include some interim blind alleys that I no longer care about and produce a single revision. For no reason other than to tidy up the svn history of a bug fix a litle bit.

+5  A: 

No

If you could do this you could change the history of your subversion server. How can you trust your code if you can modify old revisions?

Really I mean, you shouldn't want to do this. If you have old commits that you don't like, even if you could 'delete' them, you shouldn't want to. They are part of this history of the HEAD. Only the tip needs to be great. You'll make many more mistakes in this code... just fix them and move on.

Nathan Feger
Thanks for the response. The argument for such a thing is to clean up a dev branch before merging back into trunk. See git's rebase command.
serg10
A: 

No. You cannot.

You can edit the commit notes if you install a pre-revprop hook on your repository, that's as close as you will be able to get.

sylvanaar
+4  A: 

You can do this using svnadmin dump, then manually editing the dump file, and svnadmin load it again, but it’s not recommended to do this because it’s error-prone and somewhat defeats the purpose of version control.

Don’t do it.

Michael Hackner
emphasis on *don't do it*
Yoopergeek
+1 for the *don't do it*
Josh W.
Good point in that it could be done, but see this reason not to: http://stackoverflow.com/questions/1614727/can-you-combine-revisions-with-subversion/1614780#1614780 :)
Nathan Feger
A: 

It is not something standard or desirable in version control systems. You could of course, with a huge amount of work, proceed to incremental checkouts, copy the file to another new local database with commits where you want to have them (and even like that, moves or deletes would be hard to manage).

What you can easily do is drop files and paths from a repository with a svnadmin dump coupled with a svndumpfilter. That could help you get rid of files that have no place in a repository, which is an easy mistake (deleting them with SVN still leaves them in the repository, which sometimes leads to huge ones). To use with caution.

RedGlyph