You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@ant.apache.org by Ernst Plüss <er...@yahoo.com> on 2003/03/26 10:17:56 UTC

FixCrLf extension

Hi All

I'm currently cleaning up a huge repository of source
files which have all kinds of line endings. So I had a
look at the FixCrLf task. Although FixCrLf basically
does what I'm looking for I need some more features:
a) checkout all the files with a wrong line ending
b) fix them
c) check them in
d) some kind of preview without touching a file

In order to do this I'm thinking of an aditional
parameter telling FixCrLf to produce a FileSet
containing all files not containing the requried line
endings.

What I do not like about this aproach, is the fact,
that I would have to manually copy the produced
FileSet into an other ant script to get a)-c) done.
May be there's a clever way to do this fully
automated.

WDYT?
Ernst

__________________________________________________________________

Gesendet von Yahoo! Mail - http://mail.yahoo.de
Bis zu 100 MB Speicher bei http://premiummail.yahoo.de

Re: FixCrLf extension

Posted by Ernst Plüss <er...@yahoo.com>.
 --- Stefan Bodewig <bo...@apache.org> schrieb: > On
Thu, 27 Mar 2003, Ernst Plüss
> <er...@yahoo.com> wrote:
> 
> You can't override the read-only flag from within
> Java.
> 
> You'll probably want to <chmod> the files upfront
> (or <attrib>, part
> of CVS HEAD, if you are using Windows).
> 
> Stefan
> 

Yes your right, it's possible to do the job like that.
It will be far away from beeing fully automated, but I
can life with that.

Since the a preview option seams not to be of general
interest, I will just live with my own preview task.

Ernst


__________________________________________________________________

Gesendet von Yahoo! Mail - http://mail.yahoo.de
Bis zu 100 MB Speicher bei http://premiummail.yahoo.de

Re: FixCrLf extension

Posted by Stefan Bodewig <bo...@apache.org>.
On Thu, 27 Mar 2003, Ernst Plüss <er...@yahoo.com> wrote:

> May be <fixcrlf> should get a force option to override
> a read-only flag?

You can't override the read-only flag from within Java.

You'll probably want to <chmod> the files upfront (or <attrib>, part
of CVS HEAD, if you are using Windows).

Stefan

Re: FixCrLf extension

Posted by Ernst Plüss <er...@yahoo.com>.
> --- Stefan Bodewig <bo...@apache.org> schrieb: >
On Thu, 27 Mar 2003, Ernst Plüss
> <er...@yahoo.com> wrote:
> 
> No, checking out read-only is not the "normal
> operation mode" for CVS.
> It is an option, but it is discouraged by the "CVS
> way".
> 

Actually this would work for ClearCase as well,
ClearCase would mark the file as hijacked, which in
term gives the possibility to check them out and in
again.

The point is, that <fixcrlf> fails if the source file
is read only, even if I copy the files to a temp
directory, but without removing the read-only flag.

May be <fixcrlf> should get a force option to override
a read-only flag?

WDYT?
Ernst


__________________________________________________________________

Gesendet von Yahoo! Mail - http://mail.yahoo.de
Bis zu 100 MB Speicher bei http://premiummail.yahoo.de

Re: FixCrLf extension

Posted by Stefan Bodewig <bo...@apache.org>.
On Thu, 27 Mar 2003, Ernst Plüss <er...@yahoo.com> wrote:

> After all I do not understand, why this works for CVS,
> since the non checkout files are set to read only as
> well.

No, checking out read-only is not the "normal operation mode" for CVS.
It is an option, but it is discouraged by the "CVS way".

Stefan

Re: FixCrLf extension

Posted by Ernst Plüss <er...@yahoo.com>.
> --- Stefan Bodewig <bo...@apache.org> schrieb: >
On Wed, 26 Mar 2003
> <er...@yahoo.com> wrote:
> 
> > Although FixCrLf basically does what I'm looking
> for I need some
> > more features:
> > a) checkout all the files with a wrong line ending
> > b) fix them
> > c) check them in
> 
> in CVS speak, you could simply run cvs update after
> running
> <fixcrlf>.  The files with "correct" line ends will
> be the same as
> before, so they wouldn't get reported as changed.
> 
> Review all files marked with "M" and commit after
> that.
> 
> > d) some kind of preview without touching a file
> 
> You could add a justcheck attribute or similar.  I'm
> just not
> convinced that this would be useful in general. 
> <fixcrlf> simply
> doesn't do anything when things are fine.
> 
> Stefan
> 

For ClearCase this seams not to work. With the srcdir
attribute I pointed to the ClearCase view and let
the destdir point to a temporary directory. This did
not work, <fixcrlf> was not able to rename the
temporary file.
After copying all the files to another temp directroy
and removing the read only flag <fixcrlf> was able to
do the job.
After all I do not understand, why this works for CVS,
since the non checkout files are set to read only as
well.

Ernst

__________________________________________________________________

Gesendet von Yahoo! Mail - http://mail.yahoo.de
Bis zu 100 MB Speicher bei http://premiummail.yahoo.de

Re: FixCrLf extension

Posted by Stefan Bodewig <bo...@apache.org>.
On Wed, 26 Mar 2003, Ernst Plüss <er...@yahoo.com> wrote:

> Although FixCrLf basically does what I'm looking for I need some
> more features:
> a) checkout all the files with a wrong line ending
> b) fix them
> c) check them in

in CVS speak, you could simply run cvs update after running
<fixcrlf>.  The files with "correct" line ends will be the same as
before, so they wouldn't get reported as changed.

Review all files marked with "M" and commit after that.

> d) some kind of preview without touching a file

You could add a justcheck attribute or similar.  I'm just not
convinced that this would be useful in general.  <fixcrlf> simply
doesn't do anything when things are fine.

Stefan