[GRASS-dev] Re: Code re-indentation: done.

Glynn Clements glynn at gclements.plus.com
Tue Aug 5 15:11:37 EDT 2008


Markus Neteler wrote:

> I have discovered that we overlooked
> lib/external/*
> to be taken out from reformatting.
> 
> Is there an easy way to revert a set of files to their respective
> previous versions?
> svn revert only works with unsubmitted changes.
> Didn't find any other useful reference...

	find lib/external -type f -name '*.[ch]' | \
	while read file ; do
		svn merge -c -32526 $file
	done

Here, 32526 is the revision corresponding to the indenting of the
trunk. Passing a negative revision to "svn merge -c" will "unmerge"
that change.

That's how I reverted the Togl changes. There is quite a lot of
preprocessor use in Togl, and some of it confuses indent. Also,
retaining the original formatting may make it easier to update to a
future version.

Another thing which seemed to confuse indent is initialising an array
of structures, like the following from raster/r.series/main.c:

	struct menu
	{
	....
	} menu[] = {
	    {c_ave,    0, "average",    "average value"},
	    {c_count,  1, "count",      "count of non-NULL cells"},
	...
	};

For some reason, it reformatted it like:

	    {
	    c_ave,    0, "average",    "average value"}, {
	    c_count,  1, "count",      "count of non-NULL cells"}, {
	...

I'm sure that we'll encounter a few more idiosyncrasies over time. It
wouldn't have been realistic to verify ~3500 C source files manually
before committing.

-- 
Glynn Clements <glynn at gclements.plus.com>


More information about the grass-dev mailing list