[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: CVS and ^M
Re: CVS and ^M
Fri, 26 Jul 2002 09:47:18 -0700
Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.0.0) Gecko/20020530
Carsten Friedrich wrote:
> I looked at the FAQ, but it wasn't there. Maybe somebody can help:
> I'm working on a Windows 2000 machine with cygwin installed.
Okay, off to a bad start...
> I set up cvs to use :ext:... to keep my repository on a unix server.
No problem here.
> When I update files now (which I have previously edited on windows),
> they suddenly have a ^M at the end of every line which is a little bit
> annoying. Is there a way to stop cvs from adding ^M?
CVS is not adding the LFs (^M is the graphic representation of LF, the
linefeed character). You are using a native windows editor (or some other
form of processing) on your files, and it will (correctly) use CR/LF line
terminators, as these are the proper line terminators for Windows systems.
However, the CVS client you are using was compiled for Cygwin, a Unix
emulation environment for Windows, and therefore expects Unix style text file,
i.e. CR only. There are two ways to handle this, pick the one which suits
your needs better:
1) Don't use the Cygwin CVS client, download WinCVS from cvsgui.org
it, as it will correctly handle CR-LF files. This is a good answer if you are
using only Windows tools.
2) Write a commit script that runs dos2unix on the file before cvs
This is a good answer if you are using a mixed bag of tools and are willing to
do command line CVS operations.
Now, what to do about all those files in the repository that have extra
them? Again, pick your poison:
1) Check out the entire tree from Cygwin, run dos2unix on each text
commit any files that changed.
2) Write a diff script to do `cvs diff -b`, which will ignore
line terminators when diffing.
3) Open each text file in emacs. Look for "(Unix)" in the status bar.
there, add ^M to the end of any lines that don't already have one (type ^Q^M);
if it's not there, remove any ^Ms (I use replace-string/^Q^M//). Commit any
files that change.
Hope this helps,
- Re: CVS and ^M,
Mike Ayers <=