Rev 4343: (Johan Walles) fix bug #180116 by using a sort() and linear operation in file:///home/pqm/archives/thelove/bzr/%2Btrunk/
Canonical.com Patch Queue Manager
pqm at pqm.ubuntu.com
Thu May 7 18:47:51 BST 2009
At file:///home/pqm/archives/thelove/bzr/%2Btrunk/
------------------------------------------------------------
revno: 4343
revision-id: pqm at pqm.ubuntu.com-20090507174741-gavb04vy1c6s0w9n
parent: pqm at pqm.ubuntu.com-20090507015029-ymynxbonvgo1qcqi
parent: john at arbash-meinel.com-20090507162120-ecn0vwn7muzljgly
committer: Canonical.com Patch Queue Manager <pqm at pqm.ubuntu.com>
branch nick: +trunk
timestamp: Thu 2009-05-07 18:47:41 +0100
message:
(Johan Walles) fix bug #180116 by using a sort() and linear operation
for osutils.minimum_path_selection()
modified:
NEWS NEWS-20050323055033-4e00b5db738777ff
bzrlib/osutils.py osutils.py-20050309040759-eeaff12fbf77ac86
bzrlib/tests/test_osutils.py test_osutils.py-20051201224856-e48ee24c12182989
bzrlib/workingtree_4.py workingtree_4.py-20070208044105-5fgpc5j3ljlh5q6c-1
------------------------------------------------------------
revno: 4325.3.9
revision-id: john at arbash-meinel.com-20090507162120-ecn0vwn7muzljgly
parent: johan.walles at gmail.com-20090507050846-nkwvcyauf1eh653q
committer: John Arbash Meinel <john at arbash-meinel.com>
branch nick: jam-integration
timestamp: Thu 2009-05-07 11:21:20 -0500
message:
Fix slightly incorrect ReST formatting in NEWS entry.
modified:
NEWS NEWS-20050323055033-4e00b5db738777ff
------------------------------------------------------------
revno: 4325.3.8
revision-id: johan.walles at gmail.com-20090507050846-nkwvcyauf1eh653q
parent: johan.walles at gmail.com-20090507045858-kbpp96c2qtqj0l8v
parent: pqm at pqm.ubuntu.com-20090507015029-ymynxbonvgo1qcqi
committer: Johan Walles <johan.walles at gmail.com>
branch nick: bzr
timestamp: Thu 2009-05-07 07:08:46 +0200
message:
Merge from upstream.
added:
bzrlib/tests/per_interbranch/test_pull.py test_pull.py-20090227164435-0rtbqqyuh1rmm82n-1
modified:
NEWS NEWS-20050323055033-4e00b5db738777ff
bzrlib/branch.py branch.py-20050309040759-e4baf4e0d046576e
bzrlib/branchbuilder.py branchbuilder.py-20070427022007-zlxpqz2lannhk6y8-1
bzrlib/builtins.py builtins.py-20050830033751-fc01482b9ca23183
bzrlib/filters/eol.py eol.py-20090327060429-todzdjmqt3bpv5r8-1
bzrlib/reconfigure.py reconfigure.py-20070908040425-6ykgo7escxhyrg9p-1
bzrlib/repository.py rev_storage.py-20051111201905-119e9401e46257e3
bzrlib/rules.py properties.py-20080506032617-9k06uqalkf09ck0z-1
bzrlib/smart/repository.py repository.py-20061128022038-vr5wy5bubyb8xttk-1
bzrlib/switch.py switch.py-20071116011000-v5lnw7d2wkng9eux-1
bzrlib/tests/blackbox/test_bound_branches.py test_bound_branches.py-20051109215527-2373188ad566c205
bzrlib/tests/blackbox/test_reconfigure.py test_reconfigure.py-20070908173426-khfo5fi2rgzgtwj3-1
bzrlib/tests/branch_implementations/test_pull.py test_pull.py-20060410103942-83c35b26657414fc
bzrlib/tests/per_interbranch/__init__.py __init__.py-20090225010018-l7w4uvvt73ea2vj9-1
bzrlib/tests/per_repository/test_fetch.py test_fetch.py-20070814052151-5cxha9slx4c93uog-1
bzrlib/tests/test_branchbuilder.py test_branchbuilder.p-20070427022007-zlxpqz2lannhk6y8-2
bzrlib/tests/test_eol_filters.py test_eol_filters.py-20090327060429-todzdjmqt3bpv5r8-2
bzrlib/tests/test_fetch.py testfetch.py-20050825090644-f73e07e7dfb1765a
bzrlib/tests/test_remote.py test_remote.py-20060720103555-yeeg2x51vn0rbtdp-2
bzrlib/tests/test_switch.py test_switch.py-20071116011000-v5lnw7d2wkng9eux-2
bzrlib/tree.py tree.py-20050309040759-9d5f2496be663e77
bzrlib/workingtree.py workingtree.py-20050511021032-29b6ec0a681e02e3
------------------------------------------------------------
revno: 4325.3.7
revision-id: johan.walles at gmail.com-20090507045858-kbpp96c2qtqj0l8v
parent: johan.walles at gmail.com-20090506193256-ome7hfbulo2jth47
committer: Johan Walles <johan.walles at gmail.com>
branch nick: bzr
timestamp: Thu 2009-05-07 06:58:58 +0200
message:
Style fixes for minimum_path_selection().
modified:
bzrlib/osutils.py osutils.py-20050309040759-eeaff12fbf77ac86
bzrlib/tests/test_osutils.py test_osutils.py-20051201224856-e48ee24c12182989
------------------------------------------------------------
revno: 4325.3.6
revision-id: johan.walles at gmail.com-20090506193256-ome7hfbulo2jth47
parent: johan.walles at gmail.com-20090506054225-w4wpx6kewijbs82n
committer: Johan Walles <johan.walles at gmail.com>
branch nick: bzr
timestamp: Wed 2009-05-06 21:32:56 +0200
message:
Move note about bzr rm * fix from Bugs to Improvements.
modified:
NEWS NEWS-20050323055033-4e00b5db738777ff
------------------------------------------------------------
revno: 4325.3.5
revision-id: johan.walles at gmail.com-20090506054225-w4wpx6kewijbs82n
parent: johan.walles at gmail.com-20090506053628-tbf1wz4a0m9t684g
committer: Johan Walles <johan.walles at gmail.com>
branch nick: bzr
timestamp: Wed 2009-05-06 07:42:25 +0200
message:
NEWS: "bzr rm *" is now as fast as "bzr rm * --keep".
modified:
NEWS NEWS-20050323055033-4e00b5db738777ff
------------------------------------------------------------
revno: 4325.3.4
revision-id: johan.walles at gmail.com-20090506053628-tbf1wz4a0m9t684g
parent: johan.walles at gmail.com-20090505165719-x2kib8xvablsfztu
parent: pqm at pqm.ubuntu.com-20090505195559-0qmeyyua7e407sym
committer: Johan Walles <johan.walles at gmail.com>
branch nick: bzr
timestamp: Wed 2009-05-06 07:36:28 +0200
message:
Merge from upstream.
added:
bzrlib/tests/per_interbranch/test_push.py test_push.py-20090330192649-pca31sb2ubbtcs15-1
modified:
NEWS NEWS-20050323055033-4e00b5db738777ff
bzrlib/branch.py branch.py-20050309040759-e4baf4e0d046576e
bzrlib/commands.py bzr.py-20050309040720-d10f4714595cf8c3
bzrlib/errors.py errors.py-20050309040759-20512168c4e14fbd
bzrlib/hashcache.py hashcache.py-20050706091756-fe3a8cc1143ff24f
bzrlib/osutils.py osutils.py-20050309040759-eeaff12fbf77ac86
bzrlib/reconfigure.py reconfigure.py-20070908040425-6ykgo7escxhyrg9p-1
bzrlib/revisiontree.py revisiontree.py-20060724012533-bg8xyryhxd0o0i0h-1
bzrlib/tag.py tag.py-20070212110532-91cw79inah2cfozx-1
bzrlib/tests/__init__.py selftest.py-20050531073622-8d0e3c8845c97a64
bzrlib/tests/blackbox/test_pull.py test_pull.py-20051201144907-64959364f629947f
bzrlib/tests/branch_implementations/test_sprout.py test_sprout.py-20070521151739-b8t8p7axw1h966ws-1
bzrlib/tests/per_interbranch/__init__.py __init__.py-20090225010018-l7w4uvvt73ea2vj9-1
bzrlib/tests/per_interbranch/test_update_revisions.py test_update_revision-20090225011043-7u1jnapdeuj07rre-1
bzrlib/tests/per_repository/test_commit_builder.py test_commit_builder.py-20060606110838-76e3ra5slucqus81-1
bzrlib/tests/test__dirstate_helpers.py test_dirstate_helper-20070504035751-jsbn00xodv0y1eve-2
bzrlib/tests/test_bundle.py test.py-20050630184834-092aa401ab9f039c
bzrlib/tests/test_dirstate.py test_dirstate.py-20060728012006-d6mvoihjb3je9peu-2
bzrlib/tests/test_osutils.py test_osutils.py-20051201224856-e48ee24c12182989
bzrlib/tests/test_shelf.py test_prepare_shelf.p-20081005181341-n74qe6gu1e65ad4v-2
bzrlib/tests/test_tag.py test_tag.py-20070212110532-91cw79inah2cfozx-2
bzrlib/tests/test_transform.py test_transaction.py-20060105172520-b3ffb3946550e6c4
bzrlib/tests/tree_implementations/test_get_symlink_target.py test_get_symlink_tar-20070225165554-ickod3w3t7u0zzqh-1
bzrlib/tests/workingtree_implementations/test_parents.py test_set_parents.py-20060807231740-yicmnlci1mj8smu1-1
bzrlib/transform.py transform.py-20060105172343-dd99e54394d91687
bzrlib/workingtree.py workingtree.py-20050511021032-29b6ec0a681e02e3
------------------------------------------------------------
revno: 4325.3.3
revision-id: johan.walles at gmail.com-20090505165719-x2kib8xvablsfztu
parent: johan.walles at gmail.com-20090505060229-lv655dd7wzkm7gs5
committer: Johan Walles <johan.walles at gmail.com>
branch nick: bzr
timestamp: Tue 2009-05-05 18:57:19 +0200
message:
Add unit test and fix for minimum_path_selection() vs directory names with
non-characters in them.
modified:
bzrlib/osutils.py osutils.py-20050309040759-eeaff12fbf77ac86
bzrlib/tests/test_osutils.py test_osutils.py-20051201224856-e48ee24c12182989
------------------------------------------------------------
revno: 4325.3.2
revision-id: johan.walles at gmail.com-20090505060229-lv655dd7wzkm7gs5
parent: johan.walles at gmail.com-20090505053941-pzukk6cnh34717n9
committer: Johan Walles <johan.walles at gmail.com>
branch nick: bzr
timestamp: Tue 2009-05-05 08:02:29 +0200
message:
Use a linear algorithm for osutil.minimum_path_selection().
This speeds up "bzr rm *" operations a lot and resolves bazaar bug 180116.
modified:
bzrlib/osutils.py osutils.py-20050309040759-eeaff12fbf77ac86
------------------------------------------------------------
revno: 4325.3.1
revision-id: johan.walles at gmail.com-20090505053941-pzukk6cnh34717n9
parent: pqm at pqm.ubuntu.com-20090504033314-7mfh3y311028dk2m
committer: Johan Walles <johan.walles at gmail.com>
branch nick: bzr
timestamp: Tue 2009-05-05 07:39:41 +0200
message:
Don't reinvent osutils.minimum_path_selection().
modified:
bzrlib/workingtree_4.py workingtree_4.py-20070208044105-5fgpc5j3ljlh5q6c-1
=== modified file 'NEWS'
--- a/NEWS 2009-05-07 01:50:29 +0000
+++ b/NEWS 2009-05-07 16:21:20 +0000
@@ -39,6 +39,8 @@
local branch, and not the bound master branch.
(Gary van der Merwe, #194716)
+* ``bzr rm *`` is now as fast as ``bzr rm * --keep``. (Johan Walles, #180116)
+
Bug Fixes
*********
=== modified file 'bzrlib/osutils.py'
--- a/bzrlib/osutils.py 2009-04-17 12:52:36 +0000
+++ b/bzrlib/osutils.py 2009-05-07 04:58:58 +0000
@@ -97,16 +97,22 @@
:param paths: A container (and hence not None) of paths.
:return: A set of paths sufficient to include everything in paths via
- is_inside_any, drawn from the paths parameter.
+ is_inside, drawn from the paths parameter.
"""
- search_paths = set()
- paths = set(paths)
- for path in paths:
- other_paths = paths.difference([path])
- if not is_inside_any(other_paths, path):
- # this is a top level path, we must check it.
- search_paths.add(path)
- return search_paths
+ if len(paths) < 2:
+ return set(paths)
+
+ def sort_key(path):
+ return path.split('/')
+ sorted_paths = sorted(list(paths), key=sort_key)
+
+ search_paths = [sorted_paths[0]]
+ for path in sorted_paths[1:]:
+ if not is_inside(search_paths[-1], path):
+ # This path is unique, add it
+ search_paths.append(path)
+
+ return set(search_paths)
_QUOTE_RE = None
@@ -1756,12 +1762,12 @@
def re_compile_checked(re_string, flags=0, where=""):
"""Return a compiled re, or raise a sensible error.
-
+
This should only be used when compiling user-supplied REs.
:param re_string: Text form of regular expression.
:param flags: eg re.IGNORECASE
- :param where: Message explaining to the user the context where
+ :param where: Message explaining to the user the context where
it occurred, eg 'log search filter'.
"""
# from https://bugs.launchpad.net/bzr/+bug/251352
=== modified file 'bzrlib/tests/test_osutils.py'
--- a/bzrlib/tests/test_osutils.py 2009-05-06 08:53:36 +0000
+++ b/bzrlib/tests/test_osutils.py 2009-05-07 05:08:46 +0000
@@ -789,12 +789,16 @@
def test_minimum_path_selection(self):
self.assertEqual(set(),
osutils.minimum_path_selection([]))
+ self.assertEqual(set(['a']),
+ osutils.minimum_path_selection(['a']))
self.assertEqual(set(['a', 'b']),
osutils.minimum_path_selection(['a', 'b']))
self.assertEqual(set(['a/', 'b']),
osutils.minimum_path_selection(['a/', 'b']))
self.assertEqual(set(['a/', 'b']),
osutils.minimum_path_selection(['a/c', 'a/', 'b']))
+ self.assertEqual(set(['a-b', 'a', 'a0b']),
+ osutils.minimum_path_selection(['a-b', 'a/b', 'a0b', 'a']))
def test_mkdtemp(self):
tmpdir = osutils._win32_mkdtemp(dir='.')
=== modified file 'bzrlib/workingtree_4.py'
--- a/bzrlib/workingtree_4.py 2009-04-09 20:23:07 +0000
+++ b/bzrlib/workingtree_4.py 2009-05-05 05:39:41 +0000
@@ -1,4 +1,4 @@
-# Copyright (C) 2005, 2006, 2007, 2008 Canonical Ltd
+# Copyright (C) 2005, 2006, 2007, 2008, 2009 Canonical Ltd
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -2021,7 +2021,7 @@
else:
specific_files = set([''])
# -- specific_files is now a utf8 path set --
- search_specific_files = set()
+
# -- get the state object and prepare it.
state = self.target.current_dirstate()
state._read_dirblocks_if_needed()
@@ -2051,11 +2051,7 @@
if not all_versioned:
raise errors.PathsNotVersionedError(specific_files)
# -- remove redundancy in supplied specific_files to prevent over-scanning --
- for path in specific_files:
- other_specific_files = specific_files.difference(set([path]))
- if not osutils.is_inside_any(other_specific_files, path):
- # this is a top level path, we must check it.
- search_specific_files.add(path)
+ search_specific_files = osutils.minimum_path_selection(specific_files)
use_filesystem_for_exec = (sys.platform != 'win32')
iter_changes = self.target._iter_changes(include_unchanged,
More information about the bazaar-commits
mailing list