Login | Register
My pages Projects Community openCollabNet

Discussions > users [DISABLED] > Re: svn diff shows entire file as modified after add 1 character

subversion
Discussion topic

Hide all messages in topic

All messages in topic

Re: svn diff shows entire file as modified after add 1 character

Author Andrey Repin <anrdaemon at freemail dot ru>
Full name Andrey Repin <anrdaemon at freemail dot ru>
Date 2009-04-07 04:50:03 PDT
Message Greetings, Andy Levy!

>>> The "svn diff" command seems to be inconsistent across various files in my Java repository.
>>> I imported several java files from ClearCase into a Subversion repository. The "eol-style" property is set to "native".
>>
>> Don't use "native" ever :) it's a way to confusion, and you just ran into it.

> Native works perfectly fine, provided you don't have an editor which
> tries to "help" by messing with EOL characters itself and instead just
> makes things worse.

True, which I have explained further down in message.


--
WBR,
 Andrey Repin (anrdaemon at freemail dot ru) 07.04.2009, <15:46>

Sorry for my terrible english...

Re: svn diff shows entire file as modified after add 1 character

Author ryandesign
Full name Ryan Schmidt
Date 2009-04-06 18:12:16 PDT
Message On Apr 6, 2009, at 16:38, Thornock, Brian (Brian) wrote:

> The "svn diff" command seems to be inconsistent across various
> files in my Java repository.
> I imported several java files from ClearCase into a Subversion
> repository. The "eol-style" property is set to "native".
>
> For me to reproduce, I test with 2 files in the same package and
> directory:
> *I checkout the repository: svn co http://svn/repos/trunk ./code-
> devel
> *svn diff TestClient.java = reports no change
> *Open TestClient.java in VI, add a single line in the header
> comment section
> *svn diff TestClient.java = shows the diff with the 1 extra line
>
> *svn diff TestConnector.java = reports no change
> *Open TestConnector.java in VI, add a single line in the header
> comment section
> *svn diff TestConnector.java = reports every line changed
>
> There are about 20 files scattered throughout our base in various
> packages that have this weird problem where once you change
> something in the file, every line says it's modified. Even if I
> delete the line, it still reports every line as modified; I have to
> svn revert these 20 files. All the other files behave as expected.

This could be due to an import tool that didn't normalize your files'
line endings.

I assume you used some automated script to import your repository
from ClearCase into Subversion? And during the import, it added
svn:eol-style properties to your files? At that time, it was also the
import script's responsibility to convert the line endings actually
present in those files to LF (yes, LF, irrespective of what value you
set the svn:eol-style property to). If the import script did not do
this, then you have files in your repository that Subversion *thinks*
have LF line endings, but which actually have some other line
endings. When it comes time for it to compute a diff, it sees every
line as changed due to the differing line endings.

If you can afford to dump and load your repository and change its
UUID, and thereby invalidate everyone's working copy and require them
to check out new ones, then you may want to do so and give
svndumptool a go. It has a feature for fixing line endings. You would
"svnadmin dump" your repository, run "svndumptool.py eolfix" to fix
the line endings in the dumpfile, then "svnadmin load --ignore-uuid"
the fixed dumpfile into a new repository you've "svnadmin create"d.
Be sure to use the "--ignore-uuid" switch to "svnadmin load" so that
a new UUID is generated; since this new repository's contents is not
identical to the old one's, you must use a new UUID.

http://svn.borg.ch/svndumptool/

Note: of course you can test this conversion without impacting the
users of your repository, so if I'm wrong about the cause it doesn't
mean any downtime for anyone.

Re: svn diff shows entire file as modified after add 1 character

Author levyam
Full name Andy Levy
Date 2009-04-06 17:13:33 PDT
Message On Mon, Apr 6, 2009 at 19:20, Andrey Repin <anrdaemon at freemail dot ru> wrote:
> Greetings, Thornock, Brian (Brian)!
>
>> The "svn diff" command seems to be inconsistent across various files in my Java repository.
>> I imported several java files from ClearCase into a Subversion repository. The "eol-style" property is set to "native".
>
> Don't use "native" ever :) it's a way to confusion, and you just ran into it.

Native works perfectly fine, provided you don't have an editor which
tries to "help" by messing with EOL characters itself and instead just
makes things worse.

>> For me to reproduce, I test with 2 files in the same package and directory:
>> *I checkout the repository: svn co http://svn/repos/trunk  ./code-devel
>> *svn diff TestClient.java = reports no change
>> *Open TestClient.java in VI, add a single line in the header comment section
>> *svn diff TestClient.java = shows the diff with the 1 extra line
>
>> *svn diff TestConnector.java = reports no change
>> *Open TestConnector.java in VI, add a single line in the header comment section
>> *svn diff TestConnector.java = reports every line changed
>
>> There are about 20 files scattered throughout our base in various packages that have this weird problem where once you change something in the file, every line says it's modified. Even if I delete
>> the line, it still reports every line as modified; I have to svn revert these 20 files. All the other files behave as expected.
>
> Your diff showing changes in EOL style as (actual) changes in file.
> (Addition/Removal of <CR> character most likely.)
> It is indication that your editor do not agree with your SVN client on
> nativity of given EOL marks.
> Try
>
> svn diff -x -b .../file
>
> This should give results equal to the --ignore-eol-style, just in more clear
> way. (Assuming you know the meaning of -b switch) ;)
>
> For myself, I always use LF only, except when I sure know it would harm the
> results. (I.e. windows batch files)
>
>
> --
> WBR,
>  Andrey Repin (anrdaemon at freemail dot ru) 07.04.2009, <3:07>
>
> Sorry for my terrible english...
>
> --------------------​--------------------​--------------
> http://subversion.ti​gris.org/ds/viewMess​age.do?dsForumId=106​5&dsMessageId=15​67353
>
> To unsubscribe from this discussion, e-mail: [users-unsubscribe@s​ubversion.tigris.org​].
>

Re: svn diff shows entire file as modified after add 1 character

Author Andrey Repin <anrdaemon at freemail dot ru>
Full name Andrey Repin <anrdaemon at freemail dot ru>
Date 2009-04-06 16:25:05 PDT
Message Greetings, Thornock, Brian (Brian)!

> The "svn diff" command seems to be inconsistent across various files in my Java repository.
> I imported several java files from ClearCase into a Subversion repository. The "eol-style" property is set to "native".

Don't use "native" ever :) it's a way to confusion, and you just ran into it.

> For me to reproduce, I test with 2 files in the same package and directory:
> *I checkout the repository: svn co http://svn/repos/trunk ./code-devel
> *svn diff TestClient.java = reports no change
> *Open TestClient.java in VI, add a single line in the header comment section
> *svn diff TestClient.java = shows the diff with the 1 extra line

> *svn diff TestConnector.java = reports no change
> *Open TestConnector.java in VI, add a single line in the header comment section
> *svn diff TestConnector.java = reports every line changed

> There are about 20 files scattered throughout our base in various packages that have this weird problem where once you change something in the file, every line says it's modified. Even if I delete
> the line, it still reports every line as modified; I have to svn revert these 20 files. All the other files behave as expected.

Your diff showing changes in EOL style as (actual) changes in file.
(Addition/Removal of <CR> character most likely.)
It is indication that your editor do not agree with your SVN client on
nativity of given EOL marks.
Try

svn diff -x -b .../file

This should give results equal to the --ignore-eol-style, just in more clear
way. (Assuming you know the meaning of -b switch) ;)

For myself, I always use LF only, except when I sure know it would harm the
results. (I.e. windows batch files)


--
WBR,
 Andrey Repin (anrdaemon at freemail dot ru) 07.04.2009, <3:07>

Sorry for my terrible english...

svn diff shows entire file as modified after add 1 character

Author "Thornock, Brian (Brian)" <bthornock at avaya dot com>
Full name "Thornock, Brian (Brian)" <bthornock at avaya dot com>
Date 2009-04-06 14:38:45 PDT
Message The "svn diff" command seems to be inconsistent across various files in my Java repository.
I imported several java files from ClearCase into a Subversion repository. The "eol-style" property is set to "native".

For me to reproduce, I test with 2 files in the same package and directory:
*I checkout the repository: svn co http://svn/repos/trunk ./code-devel
*svn diff TestClient.java = reports no change
*Open TestClient.java in VI, add a single line in the header comment section
*svn diff TestClient.java = shows the diff with the 1 extra line

*svn diff TestConnector.java = reports no change
*Open TestConnector.java in VI, add a single line in the header comment section
*svn diff TestConnector.java = reports every line changed

There are about 20 files scattered throughout our base in various packages that have this weird problem where once you change something in the file, every line says it's modified. Even if I delete the line, it still reports every line as modified; I have to svn revert these 20 files. All the other files behave as expected.


After searching the archives, I found some comments on other topics about EOL.

I then tried:
svn diff -x --ignore-eol-style TestConnector.java = correctly shows the diff with the 1 extra line

svn diff --diff-cmd /usr/bin/diff -x -b = correctly shows the diff with the extra line




$ svn diff --diff-cmd /usr/bin/diff -x -b TestConnector.java
Index: TestConnector.java
====================​====================​====================​=======
1a2
> * Test Comment

$ svn diff -x --ignore-eol-style TestConnector.java
Index: TestConnector.java
====================​====================​====================​=======
--- TestConnector.java (revision 176006)
+++ TestConnector.java (working copy)
@@ -1,4 +1,5 @@
 /*
+ * Test Comment
  * TestConnector.java
  *
  *


$ svn diff TestConnector.java
Index: TestConnector.java
====================​====================​====================​=======
--- TestConnector.java (revision 176006)
+++ TestConnector.java (working copy)
@@ -1,727 +1,728 @@
-/*
- * TestConnector.java
- *
... Blah Blah Blah etc. etc.

+/*
+ * Test comment
+ * TestConnector.java
+ *
... Blah Blah etc. etc.


$ svn pl -v TestConnector.java
Properties on 'TestConnector.java':
  ClearcaseRevision : /main/21
  ClearcaseLabels : R4_2_2_341, R4_2_2_342
  svn:eol-style : native


An example of the properties for a file that does not manifest this problem and behaves correctly:
$ svn pl -v TestClient.java
Properties on 'TestClient.java':
  ClearcaseRevision : /main/1
  ClearcaseLabels : R4_2_2_342, R4_2_2_343
  svn:eol-style : native


I see this problem with both:
svn, version 1.5.4 (r33841) compiled Nov 10 2008, 17:14:16 Copyright (C) 2000-2008 CollabNet.
(from binary rpm subversion-1.1.4-2.ent)
and
svn, version 1.5.0 (r31699) compiled Jun 20 2008, 08:12:56 Copyright (C) 2000-2008 CollabNet.
(from binary rpm subversion-1.5.0-1)


Has anyone else seen this, and know how to fix it? I can't figure if there is another property that ought to be set? These are just ASCII text .java files. This is really frustrating that the files were both imported the same way, should be identical as far as file-type. But svn just freaks out with these 20 or so, and every other java file behaves correctly.

That's not really helpful to know that there is an option that "works-around" this 'oddity', when that ought to be the default behavior anyway, and is the case with 80% of the base.

When I also use the Subclipse plug-in in Eclipse and Compare with Base, it shows no change. But if I select to Commit, it incorrectly shows the files as Modified.

Thanks,
--Brian
Attachments
Messages per page: