[MERGE] Fix detection of directory entries in the inventory.
James Westby
jw+debian at jameswestby.net
Mon Jun 25 21:08:12 BST 2007
# Bazaar merge directive format 1
# revision_id: jw+debian at jameswestby.net-20070625200506-\
# lq602is8c6ofwt6b
# target_branch: http://bazaar-vcs.org/bzr/bzr.dev/
# testament_sha1: d9f7fbadb77945cb6844c567e203e7b8cb1ff380
# timestamp: 2007-06-25 21:08:00 +0100
# message: [MERGE] Fix detection of directory entries in the\
# inventory.
#
# Bazaar revision bundle v0.9
#
# message:
# Add a test for check_inventory_shape.
#
# Also fix up the tests that relied on the buggy behaviour.
#
# committer: James Westby <jw+debian at jameswestby.net>
# date: Mon 2007-06-25 21:05:06.585000038 +0100
=== modified file bzrlib/tests/__init__.py // last-changed:jw+debian at jameswestb
... y.net-20070624211307-tchngkjgvexjrchz
--- bzrlib/tests/__init__.py
+++ bzrlib/tests/__init__.py
@@ -1489,7 +1489,7 @@
shape = list(shape) # copy
for path, ie in inv.entries():
name = path.replace('\\', '/')
- if ie.kind == 'dir':
+ if ie.kind == 'directory':
name = name + '/'
if name in shape:
shape.remove(name)
=== modified file bzrlib/tests/test_commit.py
--- bzrlib/tests/test_commit.py
+++ bzrlib/tests/test_commit.py
@@ -226,7 +226,7 @@
wt.lock_read()
try:
self.check_inventory_shape(wt.read_working_inventory(),
- ['a', 'a/hello', 'b'])
+ ['a/', 'a/hello', 'b/'])
finally:
wt.unlock()
@@ -236,9 +236,9 @@
wt.lock_read()
try:
self.check_inventory_shape(wt.read_working_inventory(),
- ['a', 'a/hello', 'a/b'])
+ ['a/', 'a/hello', 'a/b/'])
self.check_inventory_shape(b.repository.get_revision_inventory(r3),
- ['a', 'a/hello', 'a/b'])
+ ['a/', 'a/hello', 'a/b/'])
finally:
wt.unlock()
@@ -248,7 +248,7 @@
wt.lock_read()
try:
self.check_inventory_shape(wt.read_working_inventory(),
- ['a', 'a/b/hello', 'a/b'])
+ ['a/', 'a/b/hello', 'a/b/'])
finally:
wt.unlock()
=== modified file bzrlib/tests/test_selftest.py
--- bzrlib/tests/test_selftest.py
+++ bzrlib/tests/test_selftest.py
@@ -1531,3 +1531,17 @@
'TestSelftestFiltering.test_filter_suite_by_re')
self.assertEquals(sorted(self.all_names), sorted(sorted_names))
+
+class TestCheckInventoryShape(TestCaseWithTransport):
+
+ def test_check_inventory_shape(self):
+ files = ['a', 'b/', 'b/c']
+ tree = self.make_branch_and_tree('.')
+ self.build_tree(files)
+ tree.add(files)
+ tree.lock_read()
+ try:
+ self.check_inventory_shape(tree.inventory, files)
+ finally:
+ tree.unlock()
+
=== modified file bzrlib/tests/workingtree_implementations/test_workingtree.py
--- bzrlib/tests/workingtree_implementations/test_workingtree.py
+++ bzrlib/tests/workingtree_implementations/test_workingtree.py
@@ -232,17 +232,17 @@
self.log('contents of inventory: %r' % inv.entries())
self.check_inventory_shape(inv,
- ['dir', 'dir/sub', 'dir/sub/file'])
+ ['dir/', 'dir/sub/', 'dir/sub/file'])
wt.rename_one('dir', 'newdir')
wt.lock_read()
self.check_inventory_shape(wt.inventory,
- ['newdir', 'newdir/sub', 'newdir/sub/file'])
+ ['newdir/', 'newdir/sub/', 'newdir/sub/file'])
wt.unlock()
wt.rename_one('newdir/sub', 'newdir/newsub')
wt.lock_read()
self.check_inventory_shape(wt.inventory,
- ['newdir', 'newdir/newsub',
+ ['newdir/', 'newdir/newsub/',
'newdir/newsub/file'])
wt.unlock()
=== modified directory // last-changed:jw+debian at jameswestby.net-2007062520050
... 6-lq602is8c6ofwt6b
# revision id: jw+debian at jameswestby.net-20070625200506-lq602is8c6ofwt6b
# sha1: d9f7fbadb77945cb6844c567e203e7b8cb1ff380
# inventory sha1: a5c53e8de6bdd6b4ade298d6182c119f9d77bdb1
# parent ids:
# jw+debian at jameswestby.net-20070624211307-tchngkjgvexjrchz
# base id: pqm at pqm.ubuntu.com-20070622160825-17gv0lorkzbr3x76
# properties:
# branch-nick: bzr.dev
# message:
# Fix detection of directory entries in the inventory.
#
# check_inventory_shape allows you to check that an inventory entry is a
# directory by ending it in a '/'. However the code to add the '/' to the
# entries for comparison uses the kind == 'dir' to detect directories, when
# the key is 'directory'.
#
# committer: James Westby <jw+debian at jameswestby.net>
# date: Sun 2007-06-24 22:13:07.759000063 +0100
=== modified file bzrlib/tests/__init__.py // encoding:base64
LS0tIGJ6cmxpYi90ZXN0cy9fX2luaXRfXy5weQorKysgYnpybGliL3Rlc3RzL19faW5pdF9fLnB5
CkBAIC0xNDg5LDcgKzE0ODksNyBAQAogICAgICAgICBzaGFwZSA9IGxpc3Qoc2hhcGUpICAgICAg
ICAgICAgICMgY29weQogICAgICAgICBmb3IgcGF0aCwgaWUgaW4gaW52LmVudHJpZXMoKToKICAg
ICAgICAgICAgIG5hbWUgPSBwYXRoLnJlcGxhY2UoJ1xcJywgJy8nKQotICAgICAgICAgICAgaWYg
aWUua2luZCA9PSAnZGlyJzoKKyAgICAgICAgICAgIGlmIGllLmtpbmQgPT0gJ2RpcmVjdG9yeSc6
CiAgICAgICAgICAgICAgICAgbmFtZSA9IG5hbWUgKyAnLycKICAgICAgICAgICAgIGlmIG5hbWUg
aW4gc2hhcGU6CiAgICAgICAgICAgICAgICAgc2hhcGUucmVtb3ZlKG5hbWUpCgo=
=== modified directory // last-changed:jw+debian at jameswestby.net-2007062421130
... 7-tchngkjgvexjrchz
# revision id: jw+debian at jameswestby.net-20070624211307-tchngkjgvexjrchz
# sha1: 8a4dee8a714d924b9c6a58491ff0c7a71985e8f8
# inventory sha1: 1e9d19807922fd987cce9fae7f236a04774c9ae0
# parent ids:
# pqm at pqm.ubuntu.com-20070622160825-17gv0lorkzbr3x76
# properties:
# branch-nick: bzr.dev
More information about the bazaar
mailing list