Rev 3662: Fix PreviewTree implementation of walkdirs in file:///home/pqm/archives/thelove/bzr/%2Btrunk/
Canonical.com Patch Queue Manager
pqm at pqm.ubuntu.com
Fri Aug 29 02:03:39 BST 2008
At file:///home/pqm/archives/thelove/bzr/%2Btrunk/
------------------------------------------------------------
revno: 3662
revision-id: pqm at pqm.ubuntu.com-20080829010334-5rll9kw98912mbxd
parent: pqm at pqm.ubuntu.com-20080828220458-9l8imklutrsvcw5t
parent: aaron at aaronbentley.com-20080829003314-kkw7p0fpj7gkucfz
committer: Canonical.com Patch Queue Manager <pqm at pqm.ubuntu.com>
branch nick: +trunk
timestamp: Fri 2008-08-29 02:03:34 +0100
message:
Fix PreviewTree implementation of walkdirs
modified:
bzrlib/tests/test_transform.py test_transaction.py-20060105172520-b3ffb3946550e6c4
bzrlib/tests/tree_implementations/test_walkdirs.py test_walkdirs.py-20060729160421-gmjnkotqgxdh98ce-1
bzrlib/transform.py transform.py-20060105172343-dd99e54394d91687
------------------------------------------------------------
revno: 3363.9.12
revision-id: aaron at aaronbentley.com-20080829003314-kkw7p0fpj7gkucfz
parent: aaron at aaronbentley.com-20080729050924-sfbj1zq3philccv4
parent: pqm at pqm.ubuntu.com-20080828220458-9l8imklutrsvcw5t
committer: Aaron Bentley <aaron at aaronbentley.com>
branch nick: walkdirs
timestamp: Thu 2008-08-28 20:33:14 -0400
message:
merge with bzr.dev
removed:
tools/win32/survey.txt survey.txt-20070809075950-sf265mgu9oog8jjb-1
added:
bzrlib/_btree_serializer_c.pyx _parse_btree_c.pyx-20080703034413-3q25bklkenti3p8p-2
bzrlib/_btree_serializer_py.py _parse_btree_py.py-20080703034413-3q25bklkenti3p8p-3
bzrlib/btree_index.py index.py-20080624222253-p0x5f92uyh5hw734-7
bzrlib/chunk_writer.py chunk_writer.py-20080630234519-6ggn4id17nipovny-1
bzrlib/tests/test_btree_index.py test_index.py-20080624222253-p0x5f92uyh5hw734-13
bzrlib/tests/test_chunk_writer.py test_chunk_writer.py-20080630234519-6ggn4id17nipovny-2
bzrlib/tests/test_pack_repository.py test_pack_repository-20080801043947-eaw0e6h2gu75kwmy-1
bzrlib/tests/test_upgrade_stacked.py test_upgrade_stacked-20080804072225-jd13yami19nskns5-1
bzrlib/transport/ftp/ ftp-20080611185801-3vm145h8dmnfgh25-1
bzrlib/transport/ftp/_gssapi.py _gssapi.py-20080611190840-7ejrtp884bk5eu72-2
doc/en/developer-guide/testing.txt testing.txt-20080812140359-i70zzh6v2z7grqex-1
tools/packaging/ packaging-20080825202834-3j433iaawnt72wqa-1
tools/packaging/build-packages.sh buildpackages.sh-20080821102059-fzlodktas65qmo1k-1
tools/packaging/update-changelogs.sh updatechangelogs.sh-20080821102059-fzlodktas65qmo1k-2
tools/packaging/update-packaging-branches.sh updatepackagingbranc-20080825210254-6is8ciit1yzyd3a2-1
renamed:
bzrlib/transport/ftp.py => bzrlib/transport/ftp/__init__.py ftp.py-20051116161804-58dc9506548c2a53
modified:
.bzrignore bzrignore-20050311232317-81f7b71efa2db11a
Makefile Makefile-20050805140406-d96e3498bb61c5bb
NEWS NEWS-20050323055033-4e00b5db738777ff
bzr bzr.py-20050313053754-5485f144c7006fa6
bzrlib/__init__.py __init__.py-20050309040759-33e65acf91bbcd5d
bzrlib/_patiencediff_c.c _patiencediff_c.c-20070721205602-q3imkipwlgagp3cy-1
bzrlib/annotate.py annotate.py-20050922133147-7c60541d2614f022
bzrlib/branch.py branch.py-20050309040759-e4baf4e0d046576e
bzrlib/branchbuilder.py branchbuilder.py-20070427022007-zlxpqz2lannhk6y8-1
bzrlib/builtins.py builtins.py-20050830033751-fc01482b9ca23183
bzrlib/bzrdir.py bzrdir.py-20060131065624-156dfea39c4387cb
bzrlib/commit.py commit.py-20050511101309-79ec1a0168e0e825
bzrlib/config.py config.py-20051011043216-070c74f4e9e338e8
bzrlib/diff.py diff.py-20050309040759-26944fbbf2ebbf36
bzrlib/dirstate.py dirstate.py-20060728012006-d6mvoihjb3je9peu-1
bzrlib/errors.py errors.py-20050309040759-20512168c4e14fbd
bzrlib/export/__init__.py __init__.py-20051114235828-1ba62cb4062304e6
bzrlib/export/dir_exporter.py dir_exporter.py-20051114235828-b51397f56bc7b117
bzrlib/export/tar_exporter.py tar_exporter.py-20051114235828-1f6349a2f090a5d0
bzrlib/export/zip_exporter.py zip_exporter.py-20051114235828-8f57f954fba6497e
bzrlib/fetch.py fetch.py-20050818234941-26fea6105696365d
bzrlib/help_topics/en/rules.txt rules.txt-20080516063844-ghr5l6pvvrhiycun-1
bzrlib/index.py index.py-20070712131115-lolkarso50vjr64s-1
bzrlib/inventory.py inventory.py-20050309040759-6648b84ca2005b37
bzrlib/knit.py knit.py-20051212171256-f056ac8f0fbe1bd9
bzrlib/log.py log.py-20050505065812-c40ce11702fe5fb1
bzrlib/mail_client.py mail_client.py-20070809192806-vuxt3t19srtpjpdn-1
bzrlib/merge.py merge.py-20050513021216-953b65a438527106
bzrlib/merge_directive.py merge_directive.py-20070228184838-ja62280spt1g7f4x-1
bzrlib/option.py option.py-20051014052914-661fb36e76e7362f
bzrlib/osutils.py osutils.py-20050309040759-eeaff12fbf77ac86
bzrlib/plugin.py plugin.py-20050622060424-829b654519533d69
bzrlib/reconcile.py reweave_inventory.py-20051108164726-1e5e0934febac06e
bzrlib/remote.py remote.py-20060720103555-yeeg2x51vn0rbtdp-1
bzrlib/repofmt/pack_repo.py pack_repo.py-20070813041115-gjv5ma7ktfqwsjgn-1
bzrlib/repofmt/weaverepo.py presplitout.py-20070125045333-wfav3tsh73oxu3zk-1
bzrlib/repository.py rev_storage.py-20051111201905-119e9401e46257e3
bzrlib/smart/medium.py medium.py-20061103051856-rgu2huy59fkz902q-1
bzrlib/status.py status.py-20050505062338-431bfa63ec9b19e6
bzrlib/tests/__init__.py selftest.py-20050531073622-8d0e3c8845c97a64
bzrlib/tests/blackbox/test_commit.py test_commit.py-20060212094538-ae88fc861d969db0
bzrlib/tests/blackbox/test_export.py test_export.py-20051229024010-e6c26658e460fb1c
bzrlib/tests/blackbox/test_init.py test_init.py-20060309032856-a292116204d86eb7
bzrlib/tests/blackbox/test_merge.py test_merge.py-20060323225809-9bc0459c19917f41
bzrlib/tests/blackbox/test_missing.py test_missing.py-20051211212735-a2cf4c1840bb84c4
bzrlib/tests/blackbox/test_non_ascii.py test_non_ascii.py-20060105214030-68010be784a5d854
bzrlib/tests/blackbox/test_push.py test_push.py-20060329002750-929af230d5d22663
bzrlib/tests/blackbox/test_remove.py test_remove.py-20060530011439-fika5rm84lon0goe-1
bzrlib/tests/blackbox/test_send.py test_bundle.py-20060616222707-c21c8b7ea5ef57b1
bzrlib/tests/blackbox/test_shared_repository.py test_shared_repository.py-20060317053531-ed30c0d79325e483
bzrlib/tests/blackbox/test_status.py teststatus.py-20050712014354-508855eb9f29f7dc
bzrlib/tests/blackbox/test_uncommit.py test_uncommit.py-20051027212835-84944b63adae51be
bzrlib/tests/branch_implementations/test_permissions.py test_permissions.py-20060210110243-245c01403bf0fde6
bzrlib/tests/branch_implementations/test_stacking.py test_stacking.py-20080214020755-msjlkb7urobwly0f-1
bzrlib/tests/commands/test_init.py test_init.py-20070514074921-audbcdd8o56dpame-1
bzrlib/tests/commands/test_init_repository.py test_init_repository-20070525163812-87xw0678ky573l27-1
bzrlib/tests/http_utils.py HTTPTestUtil.py-20050914180604-247d3aafb7a43343
bzrlib/tests/interrepository_implementations/test_fetch.py test_fetch.py-20080425213627-j60cjh782ufm83ry-1
bzrlib/tests/intertree_implementations/test_compare.py test_compare.py-20060724101752-09ysswo1a92uqyoz-2
bzrlib/tests/inventory_implementations/basics.py basics.py-20070903044446-kdjwbiu1p1zi9phs-1
bzrlib/tests/repository_implementations/test_repository.py test_repository.py-20060131092128-ad07f494f5c9d26c
bzrlib/tests/test_annotate.py test_annotate.py-20061213215015-sttc9agsxomls7q0-1
bzrlib/tests/test_branch.py test_branch.py-20060116013032-97819aa07b8ab3b5
bzrlib/tests/test_branchbuilder.py test_branchbuilder.p-20070427022007-zlxpqz2lannhk6y8-2
bzrlib/tests/test_bzrdir.py test_bzrdir.py-20060131065654-deba40eef51cf220
bzrlib/tests/test_config.py testconfig.py-20051011041908-742d0c15d8d8c8eb
bzrlib/tests/test_diff.py testdiff.py-20050727164403-d1a3496ebb12e339
bzrlib/tests/test_errors.py test_errors.py-20060210110251-41aba2deddf936a8
bzrlib/tests/test_fetch.py testfetch.py-20050825090644-f73e07e7dfb1765a
bzrlib/tests/test_http.py testhttp.py-20051018020158-b2eef6e867c514d9
bzrlib/tests/test_log.py testlog.py-20050728115707-1a514809d7d49309
bzrlib/tests/test_memorytree.py test_memorytree.py-20060906023413-4wlkalbdpsxi2r4y-3
bzrlib/tests/test_merge.py testmerge.py-20050905070950-c1b5aa49ff911024
bzrlib/tests/test_merge_directive.py test_merge_directive-20070228184838-ja62280spt1g7f4x-2
bzrlib/tests/test_options.py testoptions.py-20051014093702-96457cfc86319a8f
bzrlib/tests/test_plugins.py plugins.py-20050622075746-32002b55e5e943e9
bzrlib/tests/test_repository.py test_repository.py-20060131075918-65c555b881612f4d
bzrlib/tests/test_selftest.py test_selftest.py-20051202044319-c110a115d8c0456a
bzrlib/tests/test_source.py test_source.py-20051207061333-a58dea6abecc030d
bzrlib/tests/test_status.py test_status.py-20060516190614-fbf6432e4a6e8aa5
bzrlib/tests/test_transform.py test_transaction.py-20060105172520-b3ffb3946550e6c4
bzrlib/tests/test_tree.py test_tree.py-20060724065232-khgrr0vvmt6ih0mi-1
bzrlib/tests/test_tsort.py testtsort.py-20051025073946-27da871c394d5be4
bzrlib/tests/tree_implementations/test_iter_search_rules.py test_iter_search_rul-20080528065532-1ml1ttb12az20cxf-1
bzrlib/tests/workingtree_implementations/test_commit.py test_commit.py-20060421013633-1610ec2331c8190f
bzrlib/tests/workingtree_implementations/test_remove.py test_remove.py-20070413183901-rvnp85rtc0q0sclp-1
bzrlib/transform.py transform.py-20060105172343-dd99e54394d91687
bzrlib/transport/__init__.py transport.py-20050711165921-4978aa7ce1285ad5
bzrlib/transport/http/__init__.py http_transport.py-20050711212304-506c5fd1059ace96
bzrlib/transport/http/_pycurl.py pycurlhttp.py-20060110060940-4e2a705911af77a6
bzrlib/transport/local.py local_transport.py-20050711165921-9b1f142bfe480c24
bzrlib/transport/remote.py ssh.py-20060608202016-c25gvf1ob7ypbus6-1
bzrlib/transport/sftp.py sftp.py-20051019050329-ab48ce71b7e32dfe
bzrlib/tree.py tree.py-20050309040759-9d5f2496be663e77
bzrlib/tsort.py tsort.py-20051025073946-7808f6aaf7d07208
bzrlib/upgrade.py history2weaves.py-20050818063535-e7d319791c19a8b2
bzrlib/workingtree.py workingtree.py-20050511021032-29b6ec0a681e02e3
bzrlib/workingtree_4.py workingtree_4.py-20070208044105-5fgpc5j3ljlh5q6c-1
doc/developers/HACKING.txt HACKING-20050805200004-2a5dc975d870f78c
doc/developers/ppa.txt ppa.txt-20080722055539-606u7t2z32t3ae4w-1
doc/en/mini-tutorial/index.txt index.txt-20070813141352-2u64ooqzo0or4hss-2
doc/en/user-guide/configuring_bazaar.txt configuring_bazaar.t-20071128000722-ncxiua259xwbdbg7-1
doc/es/mini-tutorial/index.txt index.txt-20080504182136-wmoc35u2t6kom8ca-1
setup.py setup.py-20050314065409-02f8a0a6e3f9bc70
tools/win32/bzr.iss.cog bzr.iss.cog-20060622100836-b3yup582rt3y0nvm-5
------------------------------------------------------------
revno: 3363.9.11
revision-id: aaron at aaronbentley.com-20080729050924-sfbj1zq3philccv4
parent: aaron at aaronbentley.com-20080723190946-ifb6ndd62vvoxc2z
parent: pqm at pqm.ubuntu.com-20080729005846-o7t0ck17azx0xddl
committer: Aaron Bentley <aaron at aaronbentley.com>
branch nick: walkdirs
timestamp: Tue 2008-07-29 17:09:24 +1200
message:
Merge with bzr.dev
added:
doc/developers/ppa.txt ppa.txt-20080722055539-606u7t2z32t3ae4w-1
modified:
NEWS NEWS-20050323055033-4e00b5db738777ff
bzrlib/_dirstate_helpers_py.py _dirstate_helpers_py-20070710145033-90nz6cqglsk150jy-1
bzrlib/_patiencediff_py.py cdvdifflib.py-20051106064558-f8f8097fbf0db4e4
bzrlib/branch.py branch.py-20050309040759-e4baf4e0d046576e
bzrlib/builtins.py builtins.py-20050830033751-fc01482b9ca23183
bzrlib/bzrdir.py bzrdir.py-20060131065624-156dfea39c4387cb
bzrlib/check.py check.py-20050309040759-f3a679400c06bcc1
bzrlib/errors.py errors.py-20050309040759-20512168c4e14fbd
bzrlib/fetch.py fetch.py-20050818234941-26fea6105696365d
bzrlib/remote.py remote.py-20060720103555-yeeg2x51vn0rbtdp-1
bzrlib/repofmt/knitrepo.py knitrepo.py-20070206081537-pyy4a00xdas0j4pf-1
bzrlib/repofmt/pack_repo.py pack_repo.py-20070813041115-gjv5ma7ktfqwsjgn-1
bzrlib/repofmt/weaverepo.py presplitout.py-20070125045333-wfav3tsh73oxu3zk-1
bzrlib/repository.py rev_storage.py-20051111201905-119e9401e46257e3
bzrlib/revisionspec.py revisionspec.py-20050907152633-17567659fd5c0ddb
bzrlib/smart/branch.py branch.py-20061124031907-mzh3pla28r83r97f-1
bzrlib/tests/blackbox/test_branch.py test_branch.py-20060524161337-noms9gmcwqqrfi8y-1
bzrlib/tests/blackbox/test_check.py test_check.py-20071024054728-mn44rt3z5hnqcbke-1
bzrlib/tests/blackbox/test_info.py test_info.py-20060215045507-bbdd2d34efab9e0a
bzrlib/tests/blackbox/test_selftest.py test_selftest.py-20060123024542-01c5f1bbcb596d78
bzrlib/tests/branch_implementations/test_hooks.py test_hooks.py-20070129154855-blhpwxmvjs07waei-1
bzrlib/tests/branch_implementations/test_stacking.py test_stacking.py-20080214020755-msjlkb7urobwly0f-1
bzrlib/tests/repository_implementations/test_repository.py test_repository.py-20060131092128-ad07f494f5c9d26c
bzrlib/tests/test_errors.py test_errors.py-20060210110251-41aba2deddf936a8
bzrlib/tests/test_info.py test_info.py-20070320150933-m0xxm1g7xi9v6noe-1
bzrlib/tests/test_remote.py test_remote.py-20060720103555-yeeg2x51vn0rbtdp-2
bzrlib/tests/test_repository.py test_repository.py-20060131075918-65c555b881612f4d
bzrlib/tests/test_smart.py test_smart.py-20061122024551-ol0l0o0oofsu9b3t-2
bzrlib/tests/test_urlutils.py test_urlutils.py-20060502192900-46b1f9579987cf9c
bzrlib/urlutils.py urlutils.py-20060502195429-e8a161ecf8fac004
doc/developers/index.txt index.txt-20070508041241-qznziunkg0nffhiw-1
doc/developers/releasing.txt releasing.txt-20080502015919-fnrcav8fwy8ccibu-1
tools/doc_generate/autodoc_rstx.py autodoc_rstx.py-20060420024836-3e0d4a526452193c
------------------------------------------------------------
revno: 3363.9.10
revision-id: aaron at aaronbentley.com-20080723190946-ifb6ndd62vvoxc2z
parent: aaron at aaronbentley.com-20080723155426-rztmpd206oz7fwkd
committer: Aaron Bentley <aaron at aaronbentley.com>
branch nick: walkdirs
timestamp: Wed 2008-07-23 15:09:46 -0400
message:
Handle dangling file-ids correctly
modified:
bzrlib/tests/tree_implementations/test_walkdirs.py test_walkdirs.py-20060729160421-gmjnkotqgxdh98ce-1
bzrlib/transform.py transform.py-20060105172343-dd99e54394d91687
------------------------------------------------------------
revno: 3363.9.9
revision-id: aaron at aaronbentley.com-20080723155426-rztmpd206oz7fwkd
parent: aaron at aaronbentley.com-20080722203743-365cpimh27w7nzrx
committer: Aaron Bentley <aaron at aaronbentley.com>
branch nick: walkdirs
timestamp: Wed 2008-07-23 11:54:26 -0400
message:
Implement walkdirs in terms of TreeTransform
modified:
bzrlib/tests/test_transform.py test_transaction.py-20060105172520-b3ffb3946550e6c4
bzrlib/transform.py transform.py-20060105172343-dd99e54394d91687
=== modified file 'bzrlib/tests/test_transform.py'
--- a/bzrlib/tests/test_transform.py 2008-08-12 14:03:41 +0000
+++ b/bzrlib/tests/test_transform.py 2008-08-29 00:33:14 +0000
@@ -2442,3 +2442,13 @@
('new-a', 'e\n'),
('new-b', 'f\n'),
], list(tree_a.plan_file_merge('file-id', tree_b)))
+
+ def test_walkdirs(self):
+ preview = self.get_empty_preview()
+ preview.version_file('tree-root', preview.root)
+ preview_tree = preview.get_preview_tree()
+ file_trans_id = preview.new_file('a', preview.root, 'contents',
+ 'a-id')
+ expected = [(('', 'tree-root'),
+ [('a', 'a', 'file', None, 'a-id', 'file')])]
+ self.assertEqual(expected, list(preview_tree.walkdirs()))
=== modified file 'bzrlib/tests/tree_implementations/test_walkdirs.py'
--- a/bzrlib/tests/tree_implementations/test_walkdirs.py 2007-04-14 11:55:51 +0000
+++ b/bzrlib/tests/tree_implementations/test_walkdirs.py 2008-07-23 19:09:46 +0000
@@ -16,6 +16,9 @@
"""Tests for the generic Tree.walkdirs interface."""
+import os
+
+from bzrlib import tests
from bzrlib.osutils import has_symlinks
from bzrlib.tests.tree_implementations import TestCaseWithTree
@@ -98,3 +101,22 @@
for pos, item in enumerate(expected_dirblocks):
self.assertEqual(item, result[pos])
self.assertEqual(len(expected_dirblocks), len(result))
+
+ def test_walkdir_versioned_kind(self):
+ work_tree = self.make_branch_and_tree('tree')
+ work_tree.set_root_id('tree-root')
+ self.build_tree(['tree/file', 'tree/dir/'])
+ work_tree.add(['file', 'dir'], ['file-id', 'dir-id'])
+ os.unlink('tree/file')
+ os.rmdir('tree/dir')
+ tree = self._convert_tree(work_tree)
+ tree.lock_read()
+ self.addCleanup(tree.unlock)
+ if tree.path2id('file') is None:
+ raise tests.TestNotApplicable(
+ 'Tree type cannot represent dangling ids.')
+ expected = [(('', 'tree-root'), [
+ ('dir', 'dir', 'unknown', None, 'dir-id', 'directory'),
+ ('file', 'file', 'unknown', None, 'file-id', 'file')]),
+ (('dir', 'dir-id'), [])]
+ self.assertEqual(expected, list(tree.walkdirs()))
=== modified file 'bzrlib/transform.py'
--- a/bzrlib/transform.py 2008-08-13 22:51:55 +0000
+++ b/bzrlib/transform.py 2008-08-29 00:33:14 +0000
@@ -1734,8 +1734,34 @@
def list_files(self, include_root=False):
return self._transform._tree.list_files(include_root)
- def walkdirs(self, prefix=""):
- return self._transform._tree.walkdirs(prefix)
+ def walkdirs(self, prefix=''):
+ pending = [self._transform.root]
+ while len(pending) > 0:
+ parent_id = pending.pop()
+ children = []
+ subdirs = []
+ prefix = prefix.rstrip('/')
+ parent_path = self._final_paths.get_path(parent_id)
+ parent_file_id = self._transform.final_file_id(parent_id)
+ for child_id in self._all_children(parent_id):
+ path_from_root = self._final_paths.get_path(child_id)
+ basename = self._transform.final_name(child_id)
+ file_id = self._transform.final_file_id(child_id)
+ try:
+ kind = self._transform.final_kind(child_id)
+ versioned_kind = kind
+ except NoSuchFile:
+ kind = 'unknown'
+ versioned_kind = self._transform._tree.stored_kind(file_id)
+ if versioned_kind == 'directory':
+ subdirs.append(child_id)
+ children.append((path_from_root, basename, kind, None,
+ file_id, versioned_kind))
+ children.sort()
+ if parent_path.startswith(prefix):
+ yield (parent_path, parent_file_id), children
+ pending.extend(sorted(subdirs, key=self._final_paths.get_path,
+ reverse=True))
def get_parent_ids(self):
return self._parent_ids
More information about the bazaar-commits
mailing list