Rev 4807: 2.1.0b4-win32-trace was accepted in http://bazaar.launchpad.net/~jameinel/bzr/2.1.0b4-win32-accepted

John Arbash Meinel john at arbash-meinel.com
Mon Nov 16 20:16:22 GMT 2009


At http://bazaar.launchpad.net/~jameinel/bzr/2.1.0b4-win32-accepted

------------------------------------------------------------
revno: 4807 [merge]
revision-id: john at arbash-meinel.com-20091116201617-ecfe0ialjw68zflm
parent: john at arbash-meinel.com-20091116201539-khkker3ou4bm512s
parent: john at arbash-meinel.com-20091108052857-pdgy3ty2fjxuvult
committer: John Arbash Meinel <john at arbash-meinel.com>
branch nick: 2.1.0b4-win32-accepted
timestamp: Mon 2009-11-16 14:16:17 -0600
message:
  2.1.0b4-win32-trace was accepted
modified:
  bzrlib/tests/per_workingtree/test_workingtree.py test_workingtree.py-20060203003124-817757d3e31444fb
-------------- next part --------------
=== modified file 'bzrlib/tests/per_workingtree/test_workingtree.py'
--- a/bzrlib/tests/per_workingtree/test_workingtree.py	2009-08-20 04:09:58 +0000
+++ b/bzrlib/tests/per_workingtree/test_workingtree.py	2009-11-08 05:28:57 +0000
@@ -513,30 +513,37 @@
 
     def test_merge_revert(self):
         from bzrlib.merge import merge_inner
-        self.thisFailsStrictLockCheck()
         this = self.make_branch_and_tree('b1')
-        open('b1/a', 'wb').write('a test\n')
-        this.add('a')
-        open('b1/b', 'wb').write('b test\n')
-        this.add('b')
+        self.build_tree_contents([('b1/a', 'a test\n'), ('b1/b', 'b test\n')])
+        this.add(['a', 'b'])
         this.commit(message='')
         base = this.bzrdir.clone('b2').open_workingtree()
-        open('b2/a', 'wb').write('b test\n')
+        self.build_tree_contents([('b2/a', 'b test\n')])
         other = this.bzrdir.clone('b3').open_workingtree()
-        open('b3/a', 'wb').write('c test\n')
-        open('b3/c', 'wb').write('c test\n')
+        self.build_tree_contents([('b3/a', 'c test\n'), ('b3/c', 'c test\n')])
         other.add('c')
 
-        open('b1/b', 'wb').write('q test\n')
-        open('b1/d', 'wb').write('d test\n')
+        self.build_tree_contents([('b1/b', 'q test\n'), ('b1/d', 'd test\n')])
+        # Note: If we don't lock this before calling merge_inner, then we get a
+        #       lock-contention failure. This probably indicates something
+        #       weird going on inside merge_inner. Probably something about
+        #       calling bt = this_tree.basis_tree() in one lock, and then
+        #       locking both this_tree and bt separately, causing a dirstate
+        #       locking race.
+        this.lock_write()
+        self.addCleanup(this.unlock)
         merge_inner(this.branch, other, base, this_tree=this)
-        self.assertNotEqual(open('b1/a', 'rb').read(), 'a test\n')
+        a = open('b1/a', 'rb')
+        try:
+            self.assertNotEqual(a.read(), 'a test\n')
+        finally:
+            a.close()
         this.revert()
-        self.assertEqual(open('b1/a', 'rb').read(), 'a test\n')
-        self.assertIs(os.path.exists('b1/b.~1~'), True)
-        self.assertIs(os.path.exists('b1/c'), False)
-        self.assertIs(os.path.exists('b1/a.~1~'), False)
-        self.assertIs(os.path.exists('b1/d'), True)
+        self.assertFileEqual('a test\n', 'b1/a')
+        self.failUnlessExists('b1/b.~1~')
+        self.failIfExists('b1/c')
+        self.failIfExists('b1/a.~1~')
+        self.failUnlessExists('b1/d')
 
     def test_update_updates_bound_branch_no_local_commits(self):
         # doing an update in a tree updates the branch its bound to too.



More information about the bazaar-commits mailing list