[issue2691] Detection of changed .hgeol file is not stable

Martin Geisler bugs at mercurial.selenic.com
Sat Mar 12 06:05:01 CST 2011


New submission from Martin Geisler <mg at lazybytes.net>:

The eol extension needs to detect when the .hgeol file has been modified and
clear the dirstate in that case. This test is not stable, as shown when the
debug message is changed into a status message.

The following patch fails to produce stable output on a fast machine:

diff --git a/hgext/eol.py b/hgext/eol.py
--- a/hgext/eol.py
+++ b/hgext/eol.py
@@ -259,7 +259,7 @@
                 eolmtime = 0
 
             if eolmtime > cachemtime:
-                ui.debug("eol: detected change in .hgeol\n")
+                ui.status("eol: detected change in .hgeol\n")
                 wlock = None
                 try:
                     wlock = self.wlock()
diff --git a/tests/test-eol-add.t b/tests/test-eol-add.t
--- a/tests/test-eol-add.t
+++ b/tests/test-eol-add.t
@@ -63,6 +63,7 @@
   updating to branch default
   1 files updated, 0 files merged, 0 files removed, 0 files unresolved
   % hg add .hgeol
+  eol: detected change in .hgeol
   % hg status
   A .hgeol
   % hg commit
@@ -90,6 +91,7 @@
   updating to branch default
   1 files updated, 0 files merged, 0 files removed, 0 files unresolved
   % hg add .hgeol
+  eol: detected change in .hgeol
   % hg status
   M a.txt
   A .hgeol
diff --git a/tests/test-eol-clone.t b/tests/test-eol-clone.t
--- a/tests/test-eol-clone.t
+++ b/tests/test-eol-clone.t
@@ -21,6 +21,7 @@
   > EOF
   $ printf "first\r\nsecond\r\nthird\r\n" > a.txt
   $ hg commit --addremove -m 'checkin'
+  eol: detected change in .hgeol
   adding .hgeol
   adding a.txt
 
@@ -39,6 +40,7 @@
   first
   second
   third
+  eol: detected change in .hgeol
   $ hg remove .hgeol
   $ hg commit -m 'remove eol'
   $ hg push --quiet
diff --git a/tests/test-eol-patch.t b/tests/test-eol-patch.t
--- a/tests/test-eol-patch.t
+++ b/tests/test-eol-patch.t
@@ -105,6 +105,7 @@
   second\r (esc)
   third\r (esc)
   % hg diff
+  eol: detected change in .hgeol
   diff --git a/native.txt b/native.txt
   --- a/native.txt
   +++ b/native.txt
@@ -180,6 +181,7 @@
   second\r (esc)
   third\r (esc)
   % hg diff
+  eol: detected change in .hgeol
   diff --git a/native.txt b/native.txt
   --- a/native.txt
   +++ b/native.txt
@@ -264,6 +266,7 @@
   second\r (esc)
   third\r (esc)
   % hg diff
+  eol: detected change in .hgeol
   diff --git a/native.txt b/native.txt
   --- a/native.txt
   +++ b/native.txt
@@ -339,6 +342,7 @@
   second\r (esc)
   third\r (esc)
   % hg diff
+  eol: detected change in .hgeol
   diff --git a/native.txt b/native.txt
   --- a/native.txt
   +++ b/native.txt
diff --git a/tests/test-eol-tag.t b/tests/test-eol-tag.t
--- a/tests/test-eol-tag.t
+++ b/tests/test-eol-tag.t
@@ -23,6 +23,7 @@
   > EOF
   $ printf "first\r\nsecond\r\nthird\r\n" > a.txt
   $ hg commit --addremove -m 'checkin'
+  eol: detected change in .hgeol
   adding .hgeol
   adding a.txt
 
@@ -38,3 +39,4 @@
 Touch .hgtags file again:
 
   $ hg tag 2.0
+  eol: detected change in .hgeol
diff --git a/tests/test-eol-update.t b/tests/test-eol-update.t
--- a/tests/test-eol-update.t
+++ b/tests/test-eol-update.t
@@ -95,6 +95,7 @@
   first
   third
   % hg diff
+  eol: detected change in .hgeol
   diff --git a/a.txt b/a.txt
   --- a/a.txt
   +++ b/a.txt
@@ -109,6 +110,7 @@
   first
   third
   % hg diff
+  eol: detected change in .hgeol
   diff --git a/a.txt b/a.txt
   --- a/a.txt
   +++ b/a.txt
@@ -128,6 +130,7 @@
   first\r (esc)
   third\r (esc)
   % hg diff
+  eol: detected change in .hgeol
   diff --git a/a.txt b/a.txt
   --- a/a.txt
   +++ b/a.txt
@@ -142,6 +145,7 @@
   first
   third
   % hg diff
+  eol: detected change in .hgeol
   diff --git a/a.txt b/a.txt
   --- a/a.txt
   +++ b/a.txt
diff --git a/tests/test-eol.t b/tests/test-eol.t
--- a/tests/test-eol.t
+++ b/tests/test-eol.t
@@ -152,6 +152,7 @@
   first
   second
   third
+  eol: detected change in .hgeol
   % a.txt
   first
   second
@@ -196,6 +197,7 @@
   first
   second
   third
+  eol: detected change in .hgeol
   % a.txt
   first\r (esc)
   second\r (esc)
@@ -246,6 +248,7 @@
   first\r (esc)
   second\r (esc)
   third\r (esc)
+  eol: detected change in .hgeol
   % a.txt
   first
   second
@@ -290,6 +293,7 @@
   first\r (esc)
   second\r (esc)
   third\r (esc)
+  eol: detected change in .hgeol
   % a.txt
   first\r (esc)
   second\r (esc)
@@ -341,6 +345,7 @@
   3 files updated, 0 files merged, 0 files removed, 0 files unresolved
   % hg status (eol extension not yet activated)
   % hg status (eol activated)
+  eol: detected change in .hgeol
   M win.txt
   % hg commit
   % hg status
@@ -351,6 +356,7 @@
   3 files updated, 0 files merged, 0 files removed, 0 files unresolved
   % hg status (eol extension not yet activated)
   % hg status (eol activated)
+  eol: detected change in .hgeol
   M win.txt
   % hg commit
   % hg status
@@ -369,6 +375,7 @@
   3 files updated, 0 files merged, 0 files removed, 0 files unresolved
   % hg status (eol extension not yet activated)
   % hg status (eol activated)
+  eol: detected change in .hgeol
   M unix.txt
   % hg commit
   % hg status
@@ -379,6 +386,7 @@
   3 files updated, 0 files merged, 0 files removed, 0 files unresolved
   % hg status (eol extension not yet activated)
   % hg status (eol activated)
+  eol: detected change in .hgeol
   M unix.txt
   % hg commit
   % hg status
@@ -392,11 +400,13 @@
   $ cd repo
   $ touch .hgeol
   $ hg status
+  eol: detected change in .hgeol
   ? .hgeol
   $ chmod -R -w .hg
   $ sleep 1
   $ touch .hgeol
   $ hg status --traceback
+  eol: detected change in .hgeol
   ? .hgeol
   $ cd ..
 
@@ -431,6 +441,7 @@
 
   $ touch .hgeol
   $ hg add .hgeol
+  eol: detected change in .hgeol
   $ hg commit -m 'clean version'
   $ echo "bad" > .hgeol
   $ hg status
@@ -439,4 +450,5 @@
   $ hg revert .hgeol
   warning: ignoring .hgeol file due to parse error at .hgeol:1: bad
   $ hg status
+  eol: detected change in .hgeol
   ? .hgeol.orig

----------
messages: 15591
nosy: djc, mg, tonfa
priority: bug
status: unread
title: Detection of changed .hgeol file is not stable
topic: eol

____________________________________________________
Mercurial issue tracker <bugs at mercurial.selenic.com>
<http://mercurial.selenic.com/bts/issue2691>
____________________________________________________


More information about the Mercurial-devel mailing list