Rev 6381: (jelmer) Lazily load bzrlib.filters.eol. (Jelmer Vernooij) in file:///srv/pqm.bazaar-vcs.org/archives/thelove/bzr/%2Btrunk/
Patch Queue Manager
pqm at pqm.ubuntu.com
Mon Dec 19 00:49:48 UTC 2011
At file:///srv/pqm.bazaar-vcs.org/archives/thelove/bzr/%2Btrunk/
------------------------------------------------------------
revno: 6381 [merge]
revision-id: pqm at pqm.ubuntu.com-20111219004948-irl4u0gumo2a4sni
parent: pqm at pqm.ubuntu.com-20111218212445-onsppr7rdov3cw42
parent: jelmer at canonical.com-20111218210133-gao4ndj4bjkwhu0p
committer: Patch Queue Manager <pqm at pqm.ubuntu.com>
branch nick: +trunk
timestamp: Mon 2011-12-19 00:49:48 +0000
message:
(jelmer) Lazily load bzrlib.filters.eol. (Jelmer Vernooij)
modified:
bzrlib/filters/__init__.py __init__.py-20080416080515-mkxl29amuwrf6uir-2
bzrlib/filters/eol.py eol.py-20090327060429-todzdjmqt3bpv5r8-1
=== modified file 'bzrlib/filters/__init__.py'
--- a/bzrlib/filters/__init__.py 2011-04-07 10:36:24 +0000
+++ b/bzrlib/filters/__init__.py 2011-12-18 21:01:33 +0000
@@ -282,6 +282,4 @@
return original
-# Register the standard filters
-from bzrlib.filters import eol
-eol.register_eol_content_filter()
+lazy_register_filter_stack_map('eol', 'bzrlib.filters.eol', 'eol_lookup')
=== modified file 'bzrlib/filters/eol.py'
--- a/bzrlib/filters/eol.py 2010-06-17 09:23:19 +0000
+++ b/bzrlib/filters/eol.py 2011-12-18 21:01:33 +0000
@@ -23,6 +23,7 @@
import re, sys
from bzrlib.errors import BzrError
+from bzrlib.filters import ContentFilter
# Real Unix newline - \n without \r before it
@@ -47,29 +48,24 @@
return [_UNIX_NL_RE.sub('\r\n', content)]
-# Register the eol content filter.
-def register_eol_content_filter():
- from bzrlib.filters import ContentFilter, register_filter_stack_map
-
- if sys.platform == 'win32':
- _native_output = _to_crlf_converter
- else:
- _native_output = _to_lf_converter
- _eol_filter_stack_map = {
- 'exact': [],
- 'native': [ContentFilter(_to_lf_converter, _native_output)],
- 'lf': [ContentFilter(_to_lf_converter, _to_lf_converter)],
- 'crlf': [ContentFilter(_to_lf_converter, _to_crlf_converter)],
- 'native-with-crlf-in-repo':
- [ContentFilter(_to_crlf_converter, _native_output)],
- 'lf-with-crlf-in-repo':
- [ContentFilter(_to_crlf_converter, _to_lf_converter)],
- 'crlf-with-crlf-in-repo':
- [ContentFilter(_to_crlf_converter, _to_crlf_converter)],
- }
- def eol_lookup(key):
- filter = _eol_filter_stack_map.get(key)
- if filter is None:
- raise BzrError("Unknown eol value '%s'" % key)
- return filter
- register_filter_stack_map('eol', eol_lookup)
+if sys.platform == 'win32':
+ _native_output = _to_crlf_converter
+else:
+ _native_output = _to_lf_converter
+_eol_filter_stack_map = {
+ 'exact': [],
+ 'native': [ContentFilter(_to_lf_converter, _native_output)],
+ 'lf': [ContentFilter(_to_lf_converter, _to_lf_converter)],
+ 'crlf': [ContentFilter(_to_lf_converter, _to_crlf_converter)],
+ 'native-with-crlf-in-repo':
+ [ContentFilter(_to_crlf_converter, _native_output)],
+ 'lf-with-crlf-in-repo':
+ [ContentFilter(_to_crlf_converter, _to_lf_converter)],
+ 'crlf-with-crlf-in-repo':
+ [ContentFilter(_to_crlf_converter, _to_crlf_converter)],
+ }
+def eol_lookup(key):
+ filter = _eol_filter_stack_map.get(key)
+ if filter is None:
+ raise BzrError("Unknown eol value '%s'" % key)
+ return filter
More information about the bazaar-commits
mailing list