[svn.haxx.se] · SVN Dev · SVN Users · SVN Org · TSVN Dev · TSVN Users · Subclipse Dev · Subclipse Users · this month's index

AW: Revert only whitespace changes

From: Markus Schaber <m.schaber_at_3s-software.com>
Date: Tue, 14 Jun 2011 16:32:50 +0200

Hi, Konstantin,

> Von: Konstantin Kolinko [mailto:knst.kolinko_at_gmail.com]
> > While Subversion and TortoiseSVN offer the possibility to ignore
those
> > white space changes when diffing the files, a commit still includes
> > those changes, and thus the diff in the SVN history is cluttered,
> > which causes problems for reviewers.
> >
>
> Maybe you can fine-tune the tools that are being used for the review?

Most people usually use TortoiseDiff for the review - but they get
suspicious when one tells them to check one of the "ignore"-Flags. :-)

> > Is there any tool which reverts all those whitespace-only changes,
> > keeping only the "real" changes in the file?
>
> I think that you can generate two diffs, one with all the changes and
> second one with non-whitespace ones.
>
> Then, use the first diff to undo the changes and the second one to
reapply
> them.

I think that idea could work, I'll see whether I can come up with a
script doing that.

However, I wonder why - seemingly - no one else ever needed such a
script and provided it to the community.

> > (I know that a project-wide style guide and rejecting commits which
do
> > not conform to that style guide are the long term solution to that
> > problem, and we're aiming towards that.)
>
> A good policy is to educate the developers to commit whitespace-only
> changes in a separate commit.

I know that. And I'm searching for a tool allowing me to do just that.

Especially when you make a self-contained change (e. G. pure addition of
new methods or a new class, not touching any existing code pathes) to a
large "legacy" code file, and accidentally hit "Reformat code" in
ignorance of the fact that this file does not yet conform to the style
guide, you're busted.

Best Regards,

Markus Schaber
Received on 2011-06-14 16:33:26 CEST

This is an archived mail posted to the Subversion Users mailing list.