Merge lp:~larstiq/bzr-svn/filter_stacks_registry into lp:bzr-svn

Proposed by Wouter van Heyst
Status: Merged
Approved by: Jelmer Vernooij
Approved revision: 4191
Merged at revision: 4190
Proposed branch: lp:~larstiq/bzr-svn/filter_stacks_registry
Merge into: lp:bzr-svn
Diff against target: 32 lines (+10/-5)
1 file modified
__init__.py (+10/-5)
To merge this branch: bzr merge lp:~larstiq/bzr-svn/filter_stacks_registry
Reviewer Review Type Date Requested Status
Jelmer Vernooij (community) code Approve
Review via email: mp+100790@code.launchpad.net
To post a comment you must log in.
4190. By Wouter van Heyst

replace deprecated lazy_register_filter_stack_map() with filter_stacks_registry.register_lazy()

Revision history for this message
Wouter van Heyst (larstiq) wrote :

When pulling into branches bzr-svn would spit out a warning:

  /home/larstiq/.bazaar/plugins/dev/svn/__init__.py:391: DeprecationWarning: bzrlib.filters.lazy_register_filter_stack_map was deprecated in version 2.6.0. "bzrlib.plugins.svn.keywords", "create_svn_keywords_filter")

This commit gets rid of the warning by using the, hopefully, intended replacement.

Revision history for this message
Jelmer Vernooij (jelmer) wrote :

Hi Wouter,

Thanks for the fix. We should still look for the old name too, as bzr-svn supports bzr 2.5 and bzr 2.6 (only 2.6 deprecates lazy_register_filter_stack_map). 2.5 doesn't have the new registry.

review: Needs Fixing
Revision history for this message
Wouter van Heyst (larstiq) wrote :

Ah, yes. Let me fix that.

4191. By Wouter van Heyst

retain compatibility with bzr 2.5 re: lazy_register_filter_stack_map

Revision history for this message
Wouter van Heyst (larstiq) wrote :

I moved the import down to where it is used fall back on lazy_register_filter_stack_map when it fails.

Revision history for this message
Jelmer Vernooij (jelmer) wrote :

Thanks, seems good to land. You should be able to do that yourself.

It might be nice to move the register call into an else: clause, though I guess it's not likely that will raise an ImportError anyway.

review: Approve (code)
Revision history for this message
Wouter van Heyst (larstiq) wrote :

On Wed, Apr 04, 2012 at 14:42:31 -0000, Jelmer Vernooij wrote:
> Review: Approve code
>
> Thanks, seems good to land. You should be able to do that yourself.
>
> It might be nice to move the register call into an else: clause, though I guess it's not likely that will raise an ImportError anyway.

Yeah, given the remote possibility of raising an ImportError there I
prefer the clarity of keeping the two lines together. Merging and
landing.

Wouter

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file '__init__.py'
2--- __init__.py 2012-03-29 13:14:13 +0000
3+++ __init__.py 2012-04-04 14:21:22 +0000
4@@ -77,9 +77,6 @@
5 NoSuchFile,
6 UnsupportedFormatError,
7 )
8-from bzrlib.filters import (
9- lazy_register_filter_stack_map,
10- )
11 from bzrlib.repository import (
12 format_registry as repository_format_registry,
13 network_format_registry as repository_network_format_registry,
14@@ -387,8 +384,16 @@
15 'bzrlib.plugins.svn.commands')
16
17
18-lazy_register_filter_stack_map("svn-keywords",
19- "bzrlib.plugins.svn.keywords", "create_svn_keywords_filter")
20+try:
21+ # bzrlib.filters.filter_stacks_registry as introduced in 2.6
22+ from bzrlib.filters import filter_stacks_registry
23+ filter_stacks_registry.register_lazy("svn-keywords",
24+ "bzrlib.plugins.svn.keywords", "create_svn_keywords_filter")
25+except ImportError:
26+ # fall back to lazy_register_filter_stack_map on older bzr
27+ from bzrlib.filters import lazy_register_filter_stack_map
28+ lazy_register_filter_stack_map("svn-keywords",
29+ "bzrlib.plugins.svn.keywords", "create_svn_keywords_filter")
30
31
32 def info_svn_repository(repository, stats, outf):

Subscribers

People subscribed via source and target branches

to status/vote changes: