[PATCH] add a test for the inprocess status dirstate race

Ronny Pfannschmidt Ronny.Pfannschmidt at gmx.de
Mon Apr 5 13:11:13 CDT 2010


# HG changeset patch
# User Ronny Pfannschmidt <Ronny.Pfannschmidt at gmx.de>
# Date 1270491046 -7200
# Node ID 6955b14f909d7c91286e663f2023580112ed6294
# Parent  1fdeab02350c636675e93c0206ff469002a93ec1
add a test for the inprocess status dirstate race

diff --git a/tests/test-status-inprocess.py b/tests/test-status-inprocess.py
new file mode 100755
--- /dev/null
+++ b/tests/test-status-inprocess.py
@@ -0,0 +1,32 @@
+#!/usr/bin/python
+import os
+from mercurial.ui import ui
+from mercurial.localrepo import localrepository
+from mercurial.commands import add, commit, status
+
+u = ui()
+
+print '% creating repo'
+repo = localrepository(u, '.', create=True)
+
+f = open('test.py', 'w')
+try:
+    f.write('foo\n')
+finally:
+    f.close
+
+print '% add and commit'
+add(u, repo, 'test.py')
+commit(u, repo, message='*')
+status(u, repo, clean=True)
+
+
+print '% change'
+f = open('test.py', 'w')
+try:
+    f.write('bar\n')
+finally:
+    f.close()
+
+# this would return clean instead of changed before the fix
+status(u, repo, clean=True, modified=True)
diff --git a/tests/test-status-inprocess.py.out b/tests/test-status-inprocess.py.out
new file mode 100644
--- /dev/null
+++ b/tests/test-status-inprocess.py.out
@@ -0,0 +1,5 @@
+% creating repo
+% add and commit
+C test.py
+% change
+M test.py


More information about the Mercurial-devel mailing list