David Crossley wrote:
> Gavin wrote:
> > > Author: gmcdonald
> > > Date: Thu Jan 15 04:04:35 2009
> > > New Revision: 734679
> > > 
> > > URL: http://svn.apache.org/viewvc?rev=734679&view=rev
> > > Log:
> > > Whitespace changes only. Used xmlformat
> > 
> > So, after 3+ years of seeing Davids whitespace commits mention xmlformat, I
> > decided to download and try it.
> 
> That was probably only from a once-off job.
> But sure, there is heaps of past discussion about it.
> 
> > I used it in Cygwin shell, though I guess if perl is in the windows path ok
> > it should work on DOS prompt too.
> > 
> > I configured a new config file just over-riding the indent to 2 space. I
> > left everything else at defaults.
> > 
> > Running it on this one file for testing I was initially disspointed.
> > 
> > $ xmlformat.pl --config-file=/path/to/forrest.conf -I -b .bak
> > locationmap.xml
> > 
> > It correctly removed whitespace and indented as intended on the affected
> > lines. However, being on windows there is usually a snag, all of the lines
> > that were not involved in the whitespace cleanup ended up with the infamous
> > ^M windows line endings on them, that's not good.
> > 
> > So, a quick reminder of what perl can do for me solved it nicely.
> > 
> > after running the above, immediately follow it up with :-
> > 
> > $ perl -p -i -e 's/\r//g' locationmap.xml
> > 
> > That gets rid of all windows line endings. A quick 'svn diff' shows now that
> > only the whitespace affected lines have changed, now I can commit.
> > 
> > Obviously this comes into its own when performed on multiple files so in
> > both commands above 'locationmap.xml can be replaced with *.xml or whatever
> > your cleaning up.
> > 
> > HTH
> > 
> > David, if you have time, I'm sure you've tweaked your xmlformat file nicely
> > for use within forrest, is there more I need to do to my config file other
> > than alter the indenting? (so I don't come unstuck in larger more
> > complicated files)
> 
> Please search, there is documentation and Jira issues about this.
> 
> After massive effort, i got something working nicely using xmlformat
> and committed our configuration file for it. See below.
> 
> There is also discussion about a batch job which is run just
> before a release. That is probably noted in the "How to Release"
> instructions.
> No, just checked, there is only a brief mention about line-endings.
> We need to look at what i did just before the 0.8 release. I tried
> to talk on dev@ about what i was doing during the release process,
> so as to document it for next time.

Or the commit messages around that time.

> Doing a batch job at any other time is dangerous. See mail
> discussions, but we need to be careful to co-ordinate
> with all developers beforehand, otherwise potential for many
> svn conflicts for them. That is why it is only done just
> before release - people should have then contributed any
> outstanding changes.
> 
> There is also an Ant task to do xmlformat on a single file.

See $FORREST_HOME/main/build.xml and search for "xmlformat":

There are internal comment notes at the "xmlformat"
and "xmlformat-single" tasks.

-David

> It all uses our our config file and stuff at $FORREST_HOME/etc/
> 
> I only developed it for UNIX-like systems, so you might have
> other issues on Windows. I would be wary about using Windows
> for such tasks, but maybe that is just me.
> 
> There is also documentation somewhere about the general tasks
> of keeping "line endings" and "svn properties" consistent.
> I will try to find time to do those jobs one more time and
> commit my changes to the "exclude" configuration files.
> They should be done before using xmlformat.
> 
> -David