Search code examples
mercurialclone

Freshly cloned hg repository shows files as modified (Windows)


I've freshly cloned a Hg repository on Windows XP and hg status reports a lot of (all?) files as Modified. What could be the reason?

E:\myprojects\myproject>hg summary
parent: 206:03856faec803 tip
 latest commit message
branch: default
commit: 78 modified
update: (current)

Even after having performed hg revert --all --no-backup, hg diff --git reports:

diff --git a/path/to/file1 b/path/to/file1
--- a/path/to/file1
+++ b/path/to/file1
@@ -1,332 +1,332 @@
-line1
-line2
...
-line332
+line1
+line2
...
+line332
diff --git a/path/to/file2 b/path/to/file2
--- a/path/to/file2
+++ b/path/to/file2
@@ -1,231 +1,231 @@
...
 line231
\ No newline at end of file

Solution

  • If hg revert isn't able to restore a clean working directory, this most likely means that the repository doesn't contain the files in canonical form, but hg status gets them into canonical form before comparing against the repository contents. Usually this happens when eol-extension is turned on, but the repository contains files with CRLF. To be sure, turn eol-extension temporarily off and check whether the files are still modified. If so:

    (1) turn it on again and commit the changes, so they will be in canonical form in the repository, too.

    (2) make sure that other users accessing your repository have eol-extension turned on, otherwise this will be a never ending game :)