Rev 3692: (mbp) Windows test fixes from markh in file:///home/pqm/archives/thelove/bzr/%2Btrunk/
Canonical.com Patch Queue Manager
pqm at pqm.ubuntu.com
Fri Sep 5 06:55:10 BST 2008
At file:///home/pqm/archives/thelove/bzr/%2Btrunk/
------------------------------------------------------------
revno: 3692
revision-id: pqm at pqm.ubuntu.com-20080905055502-uq3g4uwzl6agbyy4
parent: pqm at pqm.ubuntu.com-20080905013604-6zvq8467ip7l4m9i
parent: mbp at sourcefrog.net-20080905051235-am3gwu6qjwlgqkeo
committer: Canonical.com Patch Queue Manager <pqm at pqm.ubuntu.com>
branch nick: +trunk
timestamp: Fri 2008-09-05 06:55:02 +0100
message:
(mbp) Windows test fixes from markh
modified:
NEWS NEWS-20050323055033-4e00b5db738777ff
bzrlib/merge.py merge.py-20050513021216-953b65a438527106
bzrlib/tests/blackbox/test_outside_wt.py test_outside_wt.py-20060116200058-98edd33e7db8bdde
bzrlib/tests/workingtree_implementations/test_parents.py test_set_parents.py-20060807231740-yicmnlci1mj8smu1-1
bzrlib/tests/workingtree_implementations/test_workingtree.py test_workingtree.py-20060203003124-817757d3e31444fb
bzrlib/workingtree.py workingtree.py-20050511021032-29b6ec0a681e02e3
------------------------------------------------------------
revno: 3691.1.1
revision-id: mbp at sourcefrog.net-20080905051235-am3gwu6qjwlgqkeo
parent: pqm at pqm.ubuntu.com-20080905013604-6zvq8467ip7l4m9i
parent: mhammond at skippinet.com.au-20080815005423-x59t7pzm8igr66td
committer: Martin Pool <mbp at sourcefrog.net>
branch nick: integration
timestamp: Fri 2008-09-05 15:12:35 +1000
message:
Merge Windows test fixes
modified:
NEWS NEWS-20050323055033-4e00b5db738777ff
bzrlib/merge.py merge.py-20050513021216-953b65a438527106
bzrlib/tests/blackbox/test_outside_wt.py test_outside_wt.py-20060116200058-98edd33e7db8bdde
bzrlib/tests/workingtree_implementations/test_parents.py test_set_parents.py-20060807231740-yicmnlci1mj8smu1-1
bzrlib/tests/workingtree_implementations/test_workingtree.py test_workingtree.py-20060203003124-817757d3e31444fb
bzrlib/workingtree.py workingtree.py-20050511021032-29b6ec0a681e02e3
------------------------------------------------------------
revno: 3619.6.9
revision-id: mhammond at skippinet.com.au-20080815005423-x59t7pzm8igr66td
parent: mhammond at skippinet.com.au-20080815004504-2rzrodsu1ic8oesp
committer: Mark Hammond <mhammond at skippinet.com.au>
branch nick: bzr.work.tests.file_in_use
timestamp: Fri 2008-08-15 10:54:23 +1000
message:
Move check for os.link to the start of the test
modified:
bzrlib/tests/workingtree_implementations/test_workingtree.py test_workingtree.py-20060203003124-817757d3e31444fb
------------------------------------------------------------
revno: 3619.6.8
revision-id: mhammond at skippinet.com.au-20080815004504-2rzrodsu1ic8oesp
parent: mhammond at skippinet.com.au-20080815004418-2s0jnsyyb7ra6an8
parent: pqm at pqm.ubuntu.com-20080814032324-mhfk4rggo7hgxeuf
committer: Mark Hammond <mhammond at skippinet.com.au>
branch nick: bzr.work.tests.file_in_use
timestamp: Fri 2008-08-15 10:45:04 +1000
message:
merge tip
added:
doc/en/developer-guide/testing.txt testing.txt-20080812140359-i70zzh6v2z7grqex-1
modified:
Makefile Makefile-20050805140406-d96e3498bb61c5bb
NEWS NEWS-20050323055033-4e00b5db738777ff
bzrlib/osutils.py osutils.py-20050309040759-eeaff12fbf77ac86
bzrlib/repofmt/pack_repo.py pack_repo.py-20070813041115-gjv5ma7ktfqwsjgn-1
bzrlib/repository.py rev_storage.py-20051111201905-119e9401e46257e3
bzrlib/tests/__init__.py selftest.py-20050531073622-8d0e3c8845c97a64
bzrlib/tests/interrepository_implementations/test_fetch.py test_fetch.py-20080425213627-j60cjh782ufm83ry-1
bzrlib/tests/test_bzrdir.py test_bzrdir.py-20060131065654-deba40eef51cf220
bzrlib/tests/test_config.py testconfig.py-20051011041908-742d0c15d8d8c8eb
bzrlib/tests/test_plugins.py plugins.py-20050622075746-32002b55e5e943e9
bzrlib/tests/test_source.py test_source.py-20051207061333-a58dea6abecc030d
bzrlib/tests/test_transform.py test_transaction.py-20060105172520-b3ffb3946550e6c4
bzrlib/transform.py transform.py-20060105172343-dd99e54394d91687
bzrlib/transport/local.py local_transport.py-20050711165921-9b1f142bfe480c24
doc/developers/HACKING.txt HACKING-20050805200004-2a5dc975d870f78c
setup.py setup.py-20050314065409-02f8a0a6e3f9bc70
tools/win32/bzr.iss.cog bzr.iss.cog-20060622100836-b3yup582rt3y0nvm-5
------------------------------------------------------------
revno: 3619.6.7
revision-id: mhammond at skippinet.com.au-20080815004418-2s0jnsyyb7ra6an8
parent: mhammond at skippinet.com.au-20080812130700-05ohg06353nxg22q
committer: Mark Hammond <mhammond at skippinet.com.au>
branch nick: bzr.work.tests.file_in_use
timestamp: Fri 2008-08-15 10:44:18 +1000
message:
John asked for TestNotApplicable instead of TestSkipped when no os.link.
modified:
bzrlib/tests/workingtree_implementations/test_workingtree.py test_workingtree.py-20060203003124-817757d3e31444fb
------------------------------------------------------------
revno: 3619.6.6
revision-id: mhammond at skippinet.com.au-20080812130700-05ohg06353nxg22q
parent: mhammond at skippinet.com.au-20080812130601-x1r70uyerz50h4gd
committer: Mark Hammond <mhammond at skippinet.com.au>
branch nick: bzr.work.tests.file_in_use
timestamp: Tue 2008-08-12 23:07:00 +1000
message:
eagerly unlock the result_basis to prevent handles staying open.
modified:
bzrlib/tests/workingtree_implementations/test_parents.py test_set_parents.py-20060807231740-yicmnlci1mj8smu1-1
------------------------------------------------------------
revno: 3619.6.5
revision-id: mhammond at skippinet.com.au-20080812130601-x1r70uyerz50h4gd
parent: mhammond at skippinet.com.au-20080812113721-13deviynbqzwrul7
committer: Mark Hammond <mhammond at skippinet.com.au>
branch nick: bzr.work.tests.file_in_use
timestamp: Tue 2008-08-12 23:06:01 +1000
message:
ensure merge_modified() closes the hash file.
modified:
bzrlib/workingtree.py workingtree.py-20050511021032-29b6ec0a681e02e3
------------------------------------------------------------
revno: 3619.6.4
revision-id: mhammond at skippinet.com.au-20080812113721-13deviynbqzwrul7
parent: mhammond at skippinet.com.au-20080812111212-81vo1v69y1dtachv
committer: Mark Hammond <mhammond at skippinet.com.au>
branch nick: bzr.work.tests.file_in_use
timestamp: Tue 2008-08-12 21:37:21 +1000
message:
do_merge gets one 'finally' per lock so locks always released on failure.
modified:
bzrlib/merge.py merge.py-20050513021216-953b65a438527106
------------------------------------------------------------
revno: 3619.6.3
revision-id: mhammond at skippinet.com.au-20080812111212-81vo1v69y1dtachv
parent: mhammond at skippinet.com.au-20080812110839-emxho9q2id04wnr2
committer: Mark Hammond <mhammond at skippinet.com.au>
branch nick: bzr.work.tests.file_in_use
timestamp: Tue 2008-08-12 21:12:12 +1000
message:
ensure we aren't trying to remove the cwd, which fails on Windows.
modified:
bzrlib/tests/blackbox/test_outside_wt.py test_outside_wt.py-20060116200058-98edd33e7db8bdde
------------------------------------------------------------
revno: 3619.6.2
revision-id: mhammond at skippinet.com.au-20080812110839-emxho9q2id04wnr2
parent: mhammond at skippinet.com.au-20080812110800-cib2ht1l27md0sj1
committer: Mark Hammond <mhammond at skippinet.com.au>
branch nick: bzr.work.tests.file_in_use
timestamp: Tue 2008-08-12 21:08:39 +1000
message:
ensure the conflict list file is closed before returning.
modified:
bzrlib/workingtree.py workingtree.py-20050511021032-29b6ec0a681e02e3
------------------------------------------------------------
revno: 3619.6.1
revision-id: mhammond at skippinet.com.au-20080812110800-cib2ht1l27md0sj1
parent: pqm at pqm.ubuntu.com-20080811083307-tbibm26paa3r4hg8
committer: Mark Hammond <mhammond at skippinet.com.au>
branch nick: bzr.work.tests.file_in_use
timestamp: Tue 2008-08-12 21:08:00 +1000
message:
raise TestSkipped if os.link doesn't exist.
modified:
bzrlib/tests/workingtree_implementations/test_workingtree.py test_workingtree.py-20060203003124-817757d3e31444fb
=== modified file 'NEWS'
--- a/NEWS 2008-09-05 01:36:04 +0000
+++ b/NEWS 2008-09-05 05:12:35 +0000
@@ -132,6 +132,10 @@
addition, addCleanup no longer requires that the callables passed to
it be unique. (Jonathan Lange)
+ * Fix some tests that fail on Windows because files are deleted while
+ still in use.
+ (Mark Hammond)
+
* ``selftest``'s ``--starting-with`` option can now use predefined
prefixes so that one can say ``bzr selftest -s bp.loom`` instead of
``bzr selftest -s bzrlib.plugins.loom``. (Vincent Ladeuil)
=== modified file 'bzrlib/merge.py'
--- a/bzrlib/merge.py 2008-08-27 20:32:22 +0000
+++ b/bzrlib/merge.py 2008-09-05 05:12:35 +0000
@@ -413,37 +413,43 @@
change_reporter=self.change_reporter,
**kwargs)
+ def _do_merge_to(self, merge):
+ merge.do_merge()
+ if self.recurse == 'down':
+ for relpath, file_id in self.this_tree.iter_references():
+ sub_tree = self.this_tree.get_nested_tree(file_id, relpath)
+ other_revision = self.other_tree.get_reference_revision(
+ file_id, relpath)
+ if other_revision == sub_tree.last_revision():
+ continue
+ sub_merge = Merger(sub_tree.branch, this_tree=sub_tree)
+ sub_merge.merge_type = self.merge_type
+ other_branch = self.other_branch.reference_parent(file_id, relpath)
+ sub_merge.set_other_revision(other_revision, other_branch)
+ base_revision = self.base_tree.get_reference_revision(file_id)
+ sub_merge.base_tree = \
+ sub_tree.branch.repository.revision_tree(base_revision)
+ sub_merge.base_rev_id = base_revision
+ sub_merge.do_merge()
+
def do_merge(self):
self.this_tree.lock_tree_write()
- if self.base_tree is not None:
- self.base_tree.lock_read()
- if self.other_tree is not None:
- self.other_tree.lock_read()
try:
- merge = self.make_merger()
- merge.do_merge()
- if self.recurse == 'down':
- for relpath, file_id in self.this_tree.iter_references():
- sub_tree = self.this_tree.get_nested_tree(file_id, relpath)
- other_revision = self.other_tree.get_reference_revision(
- file_id, relpath)
- if other_revision == sub_tree.last_revision():
- continue
- sub_merge = Merger(sub_tree.branch, this_tree=sub_tree)
- sub_merge.merge_type = self.merge_type
- other_branch = self.other_branch.reference_parent(file_id, relpath)
- sub_merge.set_other_revision(other_revision, other_branch)
- base_revision = self.base_tree.get_reference_revision(file_id)
- sub_merge.base_tree = \
- sub_tree.branch.repository.revision_tree(base_revision)
- sub_merge.base_rev_id = base_revision
- sub_merge.do_merge()
-
- finally:
- if self.other_tree is not None:
- self.other_tree.unlock()
if self.base_tree is not None:
- self.base_tree.unlock()
+ self.base_tree.lock_read()
+ try:
+ if self.other_tree is not None:
+ self.other_tree.lock_read()
+ try:
+ merge = self.make_merger()
+ self._do_merge_to(merge)
+ finally:
+ if self.other_tree is not None:
+ self.other_tree.unlock()
+ finally:
+ if self.base_tree is not None:
+ self.base_tree.unlock()
+ finally:
self.this_tree.unlock()
if len(merge.cooked_conflicts) == 0:
if not self.ignore_zero and not is_quiet():
=== modified file 'bzrlib/tests/blackbox/test_outside_wt.py'
--- a/bzrlib/tests/blackbox/test_outside_wt.py 2008-08-26 08:25:27 +0000
+++ b/bzrlib/tests/blackbox/test_outside_wt.py 2008-09-05 05:12:35 +0000
@@ -33,6 +33,7 @@
def test_cwd_log(self):
tmp_dir = osutils.mkdtemp()
self.addCleanup(lambda: osutils.rmtree(tmp_dir))
+ self.addCleanup(lambda: os.chdir('..'))
os.chdir(tmp_dir)
out, err = self.run_bzr('log', retcode=3)
self.assertEqual(u'bzr: ERROR: Not a branch: "%s/".\n'
@@ -48,6 +49,7 @@
def test_diff_outside_tree(self):
tmp_dir = osutils.mkdtemp()
self.addCleanup(lambda: osutils.rmtree(tmp_dir))
+ self.addCleanup(lambda: os.chdir('..'))
os.chdir(tmp_dir)
self.run_bzr('init branch1')
self.run_bzr(['commit', '-m', 'nothing',
=== modified file 'bzrlib/tests/workingtree_implementations/test_parents.py'
--- a/bzrlib/tests/workingtree_implementations/test_parents.py 2008-06-02 16:09:09 +0000
+++ b/bzrlib/tests/workingtree_implementations/test_parents.py 2008-08-12 13:07:00 +0000
@@ -337,8 +337,10 @@
# the delta.
result_basis = tree.basis_tree()
result_basis.lock_read()
- self.addCleanup(result_basis.unlock)
- self.assertEqual(expected_inventory, result_basis.inventory)
+ try:
+ self.assertEqual(expected_inventory, result_basis.inventory)
+ finally:
+ result_basis.unlock()
def make_inv_delta(self, old, new):
"""Make an inventory delta from two inventories."""
=== modified file 'bzrlib/tests/workingtree_implementations/test_workingtree.py'
--- a/bzrlib/tests/workingtree_implementations/test_workingtree.py 2008-07-08 14:55:19 +0000
+++ b/bzrlib/tests/workingtree_implementations/test_workingtree.py 2008-08-15 00:54:23 +0000
@@ -34,7 +34,7 @@
UnsupportedOperation, PathsNotVersionedError)
from bzrlib.inventory import Inventory
from bzrlib.osutils import pathjoin, getcwd, has_symlinks
-from bzrlib.tests import TestSkipped
+from bzrlib.tests import TestSkipped, TestNotApplicable
from bzrlib.tests.workingtree_implementations import TestCaseWithWorkingTree
from bzrlib.trace import mutter
from bzrlib.workingtree import (TreeEntry, TreeDirectory, TreeFile, TreeLink,
@@ -894,13 +894,15 @@
tree.all_file_ids())
def test_sprout_hardlink(self):
+ real_os_link = getattr(os, 'link', None)
+ if real_os_link is None:
+ raise TestNotApplicable("This platform doesn't provide os.link")
source = self.make_branch_and_tree('source')
self.build_tree(['source/file'])
source.add('file')
source.commit('added file')
def fake_link(source, target):
raise OSError(errno.EPERM, 'Operation not permitted')
- real_os_link = os.link
os.link = fake_link
try:
# Hard-link support is optional, so supplying hardlink=True may
=== modified file 'bzrlib/workingtree.py'
--- a/bzrlib/workingtree.py 2008-09-02 19:59:56 +0000
+++ b/bzrlib/workingtree.py 2008-09-05 05:12:35 +0000
@@ -900,21 +900,24 @@
hashfile = self._transport.get('merge-hashes')
except errors.NoSuchFile:
return {}
- merge_hashes = {}
try:
- if hashfile.next() != MERGE_MODIFIED_HEADER_1 + '\n':
+ merge_hashes = {}
+ try:
+ if hashfile.next() != MERGE_MODIFIED_HEADER_1 + '\n':
+ raise errors.MergeModifiedFormatError()
+ except StopIteration:
raise errors.MergeModifiedFormatError()
- except StopIteration:
- raise errors.MergeModifiedFormatError()
- for s in RioReader(hashfile):
- # RioReader reads in Unicode, so convert file_ids back to utf8
- file_id = osutils.safe_file_id(s.get("file_id"), warn=False)
- if file_id not in self.inventory:
- continue
- text_hash = s.get("hash")
- if text_hash == self.get_file_sha1(file_id):
- merge_hashes[file_id] = text_hash
- return merge_hashes
+ for s in RioReader(hashfile):
+ # RioReader reads in Unicode, so convert file_ids back to utf8
+ file_id = osutils.safe_file_id(s.get("file_id"), warn=False)
+ if file_id not in self.inventory:
+ continue
+ text_hash = s.get("hash")
+ if text_hash == self.get_file_sha1(file_id):
+ merge_hashes[file_id] = text_hash
+ return merge_hashes
+ finally:
+ hashfile.close()
@needs_write_lock
def mkdir(self, path, file_id=None):
@@ -2596,11 +2599,14 @@
except errors.NoSuchFile:
return _mod_conflicts.ConflictList()
try:
- if confile.next() != CONFLICT_HEADER_1 + '\n':
+ try:
+ if confile.next() != CONFLICT_HEADER_1 + '\n':
+ raise errors.ConflictFormatError()
+ except StopIteration:
raise errors.ConflictFormatError()
- except StopIteration:
- raise errors.ConflictFormatError()
- return _mod_conflicts.ConflictList.from_stanzas(RioReader(confile))
+ return _mod_conflicts.ConflictList.from_stanzas(RioReader(confile))
+ finally:
+ confile.close()
def unlock(self):
# do non-implementation specific cleanup
More information about the bazaar-commits
mailing list