monotone-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Monotone-devel] mtn diff and patch doesn't work


From: Ulf Ochsenfahrt
Subject: [Monotone-devel] mtn diff and patch doesn't work
Date: Thu, 29 Mar 2007 12:31:02 +0200
User-agent: Icedove 1.5.0.10 (X11/20070307)

Hi,

Max Nickel sent a patch to the mtteam mailing list that he got from mtn diff. I tried to apply this patch with the unix 'patch' command, but that did not work, although the patch looks very much like a 'diff' patch. Upon further investigation, this seems to be due to the line endings in the file. The situation looks like this:

I've got a file in an mtn workspace and performed a simple change. The mtn diff looks like this:

--- .project    0cd65f6dfb65ec47d5163015345d92a15fc8e31b
+++ .project    5feea50df0e752857916b212ed26287f9f464390
@@ -1,6 +1,6 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <projectDescription>
-       <name>mtn</name>
+       <name>net.ensued.mtn</name>
        <comment></comment>
        <projects>
        </projects>


The 'diff' diff of the same file with a copy of the previous version looks like this:

--- .project.old        2007-03-29 12:13:37.000000000 +0200
+++ .project    2007-03-29 12:13:53.000000000 +0200
@@ -1,6 +1,6 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <projectDescription>
-       <name>mtn</name>
+       <name>net.ensued.mtn</name>
        <comment></comment>
        <projects>
        </projects>


However, the second patch can be successfully applied with patch -p0, but the first cannot. The reason for this are the line endings. mtn diff outputs the platforms default line endings for all lines of the patch, while diff outputs unix line endings for the metadata and the files line endings for the content. I.e. the line endings in the second patch are mixed unix/dos endings, because the original file uses dos endings.
It works for files that use unix endings.

patch only works with the 'diff' diff (the second one) shown above. It doesn't work with all unix endings, and it doesn't work with all dos endings. It furthermore doesn't work if I specify -l (ignore white-space changes).

I doubt this can be fixed without breaking the user interface on windows machines. However, it would be nice if we got mtn patch that accepts mtn diff patches. Wasn't someone working on that?

Cheers,

-- Ulf




reply via email to

[Prev in Thread] Current Thread [Next in Thread]