Merge lp:~amanica/bzr/find_bzrdirs-ignore-PermissionDenied-dirs into lp:bzr
Status: | Merged |
---|---|
Merged at revision: | 5320 |
Proposed branch: | lp:~amanica/bzr/find_bzrdirs-ignore-PermissionDenied-dirs |
Merge into: | lp:bzr |
Diff against target: |
130 lines (+50/-6) (has conflicts) 4 files modified
NEWS (+6/-0) bzrlib/bzrdir.py (+2/-3) bzrlib/tests/__init__.py (+4/-2) bzrlib/tests/test_bzrdir.py (+38/-1) Text conflict in NEWS |
To merge this branch: | bzr merge lp:~amanica/bzr/find_bzrdirs-ignore-PermissionDenied-dirs |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Robert Collins (community) | Needs Fixing | ||
Andrew Bennetts | Needs Information | ||
Review via email: mp+24979@code.launchpad.net |
Commit message
find_bzrdirs should ignore dirs that raises PermissionDenied. (Marius Kruger)
Description of the change
bzrtools' bzr branches crashes if it tries to walk subdirs on which the current user does not have permissions.
So find_bzrdirs should ignore dirs that raises PermissionDenied.
other notes:
* I moved TestCaseWithMem
because I needed it in a non-memory-
I also made it possible to specify a backing_server.
* I used a PathFilteringServer to raise PermissionDenied for arbitrary paths, because chmod is not available on all platforms (on recommendation from Andrew - thanks!).
Thanks for working on this!
review needs-information
Marius Kruger wrote: oryTransport. make_smart_ server TestCaseWithTra nsport, transport- test, and I can't see anything transport- tests.
[...]
> other notes:
> * I moved TestCaseWithMem
> because I needed it in a non-memory-
> that makes this specific to memory-
> I also made it possible to specify a backing_server.
I don't understand this part. TestCaseWithTra nsport is a subclass of oryTransport, so by moving it you've made it available to
TestCaseWithMem
strictly fewer tests, not more.
I think you should move it back. The change to optionally pass a
backing_server is fine.
> === modified file 'NEWS'
> --- NEWS 2010-05-06 06:51:11 +0000
> +++ NEWS 2010-05-10 11:08:28 +0000
> @@ -75,6 +75,8 @@
> * ``bzr selftest`` should not use ui.note() since it's not unicode safe.
> (Vincent Ladeuil, #563997)
>
> +* BzrDir.find_bzrdirs should ignore dirs that raises PermissionDenied. (Marius Kruger)
Put double-backticks around the method name, i.e. ``BzrDir. find_bzrdirs` `,
to format it as code rather than regular text.
> === modified file 'bzrlib/ tests/_ _init__ .py' tests/_ _init__ .py 2010-05-05 14:11:13 +0000 tests/_ _init__ .py 2010-05-10 11:08:28 +0000 bzrdir( relpath, format=format) create_ repository( shared= shared) server( self, path):
> --- bzrlib/
> +++ bzrlib/
> @@ -2408,12 +2408,6 @@
> made_control = self.make_
> return made_control.
>
> - def make_smart_
As stated above, I don't think you should move this.
> === modified file 'bzrlib/ tests/test_ bzrdir. py' permission_ denied_ transport( self, transport, paths): PermissionDenie d(path) PathFilteringSe rver(transport, filter) server. start_server( )
[...]
> + def make_fake_
> + # multiplatform chmod(0000)
> + def filter(path):
> + if path in paths:
> + raise errors.
> + return path
> + path_filter_server = pathfilter.
> + path_filter_
You should do self.addCleanup (path_filter_ server. stop_server) here.
It would be good to add a docstring.
> + path_filter_ transport = pathfilter. PathFilteringTr ansport( server, path_filter_ transport) branch_ urls(self, expect_ url_suffixes, actual_bzrdirs):
> + path_filter_server, '.')
> + return (path_filter_
> +
> + def _assert_
> + "See if each of the actual urls ends with the corresponding suffix"
Style-wise, you should just go ahead and call this assert* rather than double- quoted. We generally
_assert*. And docstrings are always triple-
also use mixedCamelCase for our assertion methods for consistency with
pyunit, but I don't particularly mind if you don't.
“Assert URL” isn't really a meaningful phrase in the way that “assert ends yet-meaningful name for bzrdir_ user_url_ has_suffix” .
with” is. It can be hard to find a concise-
assertion methods... although I see you never pass in more than one
suffix/bzrdir pair at a time in the current code, so you could simplify the
name (and implementation) and call it “assert_
> + self._assert_ branch_ urls([' baz/'], list( BzrDir. find_bzrdirs( path_filter_ transport) ))
> + bzrdir.
e.g. this would be: BzrDir. find_b. ..
bzrdirs = list(bzrdir.