Merge lp:~lifeless/bzr/find-bzrdirs-EPERM-handling into lp:bzr

Proposed by Robert Collins
Status: Merged
Approved by: Robert Collins
Approved revision: no longer in the source branch.
Merged at revision: 5320
Proposed branch: lp:~lifeless/bzr/find-bzrdirs-EPERM-handling
Merge into: lp:bzr
Prerequisite: lp:~amanica/bzr/find_bzrdirs-ignore-PermissionDenied-dirs
Diff against target: 118 lines (+50/-18)
3 files modified
NEWS (+3/-6)
bzrlib/tests/test_bzrdir.py (+7/-12)
contrib/bash/bzr (+40/-0)
To merge this branch: bzr merge lp:~lifeless/bzr/find-bzrdirs-EPERM-handling
Reviewer Review Type Date Requested Status
bzr-core Pending
Review via email: mp+28477@code.launchpad.net

Commit message

Teach BzrDir.find_bzrdirs to handle PermissionDenied errors. (Marius Kruger)

Description of the change

Marius had a branch that was going stale and was approved-with-tweak; I've done the tweaks.

To post a comment you must log in.
Revision history for this message
Robert Collins (lifeless) wrote :

sent to pqm by email

Revision history for this message
Robert Collins (lifeless) wrote :

sent to pqm by email

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'NEWS'
2--- NEWS 2010-06-25 02:10:53 +0000
3+++ NEWS 2010-06-25 02:10:53 +0000
4@@ -58,6 +58,9 @@
5 or pull location in locations.conf or branch.conf.
6 (Gordon Tyler, #534787)
7
8+* ``BzrDir.find_bzrdirs`` should ignore dirs that raises PermissionDenied.
9+ (Marius Kruger, Robert Collins)
10+
11 * Ensure that wrong path specifications in ``BZR_PLUGINS_AT`` display
12 proper error messages. (Vincent Ladeuil, #591215)
13
14@@ -301,7 +304,6 @@
15 * ``bzr selftest`` should not use ui.note() since it's not unicode safe.
16 (Vincent Ladeuil, #563997)
17
18-<<<<<<< TREE
19 * CommitBuilder refuses to create revisions whose trees have no root.
20 (Aaron Bentley)
21
22@@ -311,11 +313,6 @@
23 Python.
24 (Andrew Bennetts, #583941)
25
26-=======
27-* ``BzrDir.find_bzrdirs`` should ignore dirs that raises PermissionDenied.
28- (Marius Kruger)
29-
30->>>>>>> MERGE-SOURCE
31 * Don't mention --no-strict when we just issue the warning about unclean trees.
32 (Vincent Ladeuil, #401599)
33
34
35=== modified file 'bzrlib/tests/test_bzrdir.py'
36--- bzrlib/tests/test_bzrdir.py 2010-06-25 02:10:53 +0000
37+++ bzrlib/tests/test_bzrdir.py 2010-06-25 02:10:53 +0000
38@@ -821,28 +821,23 @@
39 path_filter_server, '.')
40 return (path_filter_server, path_filter_transport)
41
42- def assertBranchUrlsEndsWith(self, expect_url_suffixes, actual_bzrdirs):
43- """Check that each branch url ends with the corresponding suffix"""
44- actual_bzrdirs = list(actual_bzrdirs)
45- self.assertEqual(len(expect_url_suffixes), len(actual_bzrdirs))
46- for expect_url_suffix, actual_bzrdir in zip(
47- expect_url_suffixes, actual_bzrdirs):
48+ def assertBranchUrlsEndWith(self, expect_url_suffix, actual_bzrdirs):
49+ """Check that each branch url ends with the given suffix."""
50+ for actual_bzrdir in actual_bzrdirs:
51 self.assertEndsWith(actual_bzrdir.user_url, expect_url_suffix)
52
53 def test_find_bzrdirs_permission_denied(self):
54 foo, bar, baz = self.make_foo_bar_baz()
55 transport = get_transport(self.get_url())
56- (path_filter_server, path_filter_transport
57- ) = self.make_fake_permission_denied_transport(transport, ['foo'])
58-
59+ path_filter_server, path_filter_transport = \
60+ self.make_fake_permission_denied_transport(transport, ['foo'])
61 # local transport
62- self.assertBranchUrlsEndsWith(['baz/'],
63+ self.assertBranchUrlsEndWith('/baz/',
64 bzrdir.BzrDir.find_bzrdirs(path_filter_transport))
65-
66 # smart server
67 smart_transport = self.make_smart_server('.',
68 backing_server=path_filter_server)
69- self.assertBranchUrlsEndsWith(['baz/'],
70+ self.assertBranchUrlsEndWith('/baz/',
71 bzrdir.BzrDir.find_bzrdirs(smart_transport))
72
73 def test_find_bzrdirs_list_current(self):
74
75=== added file 'contrib/bash/bzr'
76--- contrib/bash/bzr 1970-01-01 00:00:00 +0000
77+++ contrib/bash/bzr 2010-04-22 07:01:22 +0000
78@@ -0,0 +1,40 @@
79+# Copyright (C) 2010 Canonical Ltd
80+#
81+# This program is free software; you can redistribute it and/or modify
82+# it under the terms of the GNU General Public License as published by
83+# the Free Software Foundation; either version 2 of the License, or
84+# (at your option) any later version.
85+#
86+# This program is distributed in the hope that it will be useful,
87+# but WITHOUT ANY WARRANTY; without even the implied warranty of
88+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
89+# GNU General Public License for more details.
90+#
91+# You should have received a copy of the GNU General Public License
92+# along with this program; if not, write to the Free Software
93+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
94+
95+# Programmable completion for the Bazaar-NG bzr command under bash.
96+# Source this file (or add it to your ~/.bash_completion or ~/.bashrc
97+# file, depending on your system configuration, and start a new shell)
98+# and bash's completion mechanism will know all about bzr's options!
99+#
100+# This completion function assumes you have the bzr-bash-completion
101+# plugin installed as a bzr plugin. It will generate the full
102+# completion function at first invocation, thus avoiding long delays
103+# for every shell you start.
104+
105+shopt -s progcomp
106+_bzr_lazy ()
107+{
108+ unset _bzr
109+ eval "$(bzr bash-completion)"
110+ if [[ $(type -t _bzr) == function ]]; then
111+ unset _bzr_lazy
112+ _bzr
113+ return $?
114+ else
115+ return 1
116+ fi
117+}
118+complete -F _bzr_lazy -o default bzr