[PATCH 2 of 2 STABLE resend] keyword: make status test after record and kwexpand/kwshrink reliable

Christian Ebert blacktrash at gmx.net
Thu Sep 8 15:59:13 CDT 2011


* Matt Mackall on Thursday, September 08, 2011 at 14:16:55 -0500
> On Thu, 2011-09-08 at 19:33 +0100, Christian Ebert wrote:
>> # HG changeset patch
>> # User Christian Ebert <blacktrash at gmx.net>
>> # Date 1315506672 -3600
>> # Node ID 90dbf177b83584a5623fdc8d9dc297a5a869960a
>> # Parent  1e6056cf1f266f91c703c38dbb24a1b854752bbd
>> keyword: make status test after record and kwexpand/kwshrink reliable
>> 
>> This guarantees test failure when the dirstate code is omitted at
>> the end of the kwtemplater.overwrite method.
>> 
>> kwexpand/kwshrink:
>> Without a 1 second wait the test succeeds sometimes, even when
>> the dirstate of the overwritten file is not forced to normal.
>> 
>> record:
>> status after recording an added file allows to check whether
>> normallookup is needed after overwriting.
> 
> This looks highly suspect: we've gone to a great deal of effort to make
> these one second sleeps unnecessary. What's going on here?

Ignore my other confused answer. The problem is
repo.dirstate.normal() in connection with kwexpand/kwshrink.

The problem is that without sleep 1 the test succeeds
_sometimes_(!) when dirstate.normal() is omitted:

$ fgrep 'dirstate.normal(' ../hgext/keyword.py
$ ./run-tests.py test-keyword.t

--- /Users/chris/src/hg-stable/tests/test-keyword.t
+++ /Users/chris/src/hg-stable/tests/test-keyword.t.err
@@ -830,9 +830,12 @@
   $ hg --verbose kwshrink a
   overwriting a shrinking keywords
   $ hg status a
+  M a
   $ hg --verbose kwexpand a
-  overwriting a expanding keywords
+  abort: outstanding uncommitted changes
+  [255]
   $ hg status a
+  M a

 kwexpand x/a should abort

@@ -841,8 +844,10 @@
   [255]
   $ cd x
   $ hg --debug commit -m xa -d '3 0' -u 'User Name <user at example.com>'
+  a
   x/a
    x/a: copy a:779c764182ce5d43e2b1eb66ce06d7b47bfe342e
+  overwriting a expanding keywords
   overwriting x/a expanding keywords
   committed changeset 3:b4560182a3f9a358179fd2d835c15e9da379c1e4
   $ cat a

ERROR: /Users/chris/src/hg-stable/tests/test-keyword.t output changed
!
Failed test-keyword.t: output changed
# Ran 1 tests, 0 skipped, 1 failed.
$ fgrep 'dirstate.normal(' ../hgext/keyword.py
$ ./run-tests.py test-keyword.t
.
# Ran 1 tests, 0 skipped, 0 failed.


The first failure is expected, but does not happen all the time.
The only way I found so far to make this fail reliable with dirstate.normal()
ommitted is sleep 1.

c
-- 
theatre - books - texts - movies
Black Trash Productions at home: http://www.blacktrash.org
Black Trash Productions on Facebook:
http://www.facebook.com/blacktrashproductions


More information about the Mercurial-devel mailing list