1

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
Mot
  • 28,248
  • 23
  • 84
  • 121
  • Can you show the result of `hg status`. At least a part of the output – César Dec 30 '11 at 23:43
  • Could you copy paste your findings exactly (clone command, hg status command, and the result of it ...)? – Rook Dec 31 '11 at 01:20
  • There is really nothing fancy. Just all files are showing up with a leading `M` directly after the clone (`hg clone ssh://user@server:/repository.hg E:\myproject`) when invoking `hg status`. – Mot Dec 31 '11 at 12:34

2 Answers2

1

Try hg diff --git that will shows you what Mercurial thinks is modified about the files. My guess is the execute bit permission.

Ry4an Brase
  • 78,112
  • 7
  • 148
  • 169
  • When the whole repo is modified without reason my suspicion usually falls on EOLs. However, hard to say in this case ... so few known things. – Rook Dec 31 '11 at 03:00
  • yeah, mercurial mostly doesn't muck w/ line endings, but there are extensions that will and editors that will too. If it really is _everything_ my money is on file permissions. – Ry4an Brase Dec 31 '11 at 04:07
  • then @idigas is probably right and something (likely not Mercurial) messed up you line endings. Can you put the out out of `hg summary` up into the question? – Ry4an Brase Jan 01 '12 at 02:00
  • OK, I've added the output of `hg summary`. Is there something like a `git reset --hard` for Hg? – Mot Jan 02 '12 at 20:07
  • `git reset --hard` is `hg revert --all --no-backup` (found at http://mercurial.selenic.com/wiki/GitConcepts ). What does the output of `hg diff --git` look like? At least a few short files worth. – Ry4an Brase Jan 03 '12 at 00:55
  • OK, added output of `hg diff --git`. – Mot Jan 03 '12 at 18:29
  • That sure really looks like line endings. Thanks for being a sport about this. Can you provide the output of both `hg showconfig | grep extensions` and `hg showconfig | grep hook` please? – Ry4an Brase Jan 04 '12 at 18:45
  • `grep` is not available on Windows. The output shows, among others, following lines `extensions.eol=` and `hooks.preupdate.eol=`. – Mot Jan 05 '12 at 17:43
  • Yes, those are your problem. Someone has configured those for your system and you want to make them stop. `hg showconfig --debug` will show you what file those are enabled in (possibly system wide by your admin). Disable them and use an editor that respects line endings of either sort (Windows has many of those, but notepad.exe isn't one of them). – Ry4an Brase Jan 06 '12 at 14:28
1

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 :)

mstrap
  • 16,808
  • 10
  • 56
  • 86