[MERGE] The eol functionality now raises an error on an unknown eol setting (fixes bug 358199)

Brian de Alwis bsd at cs.ubc.ca
Fri Apr 17 20:59:00 BST 2009


Changed the patch to now raise an error on an unknown eol setting.   
And fixed up tabbing issues.

Brian.

-- 
"Amusement to an observing mind is study." - Benjamin Disraeli

# Bazaar merge directive format 2 (Bazaar 0.90)
# revision_id: brian.de.alwis at usask.ca-20090417195342-txe1x44oljt43pb6
# target_branch: file:///scratch/dev/bzr.dev/
# testament_sha1: 1d73ba513cc3615ae5b627e590030cd0e65f1c63
# timestamp: 2009-04-17 13:56:07 -0600
# source_branch: bzr+ssh://bazaar.launchpad.net/%7Ebzr/bzr/trunk/
# base_revision_id: pqm at pqm.ubuntu.com-20090417153307-fmbzf4klhhqbawrh
#
# Begin patch
=== modified file 'bzrlib/filters/eol.py'
--- bzrlib/filters/eol.py	2009-04-09 01:08:14 +0000
+++ bzrlib/filters/eol.py	2009-04-17 19:53:42 +0000
@@ -66,5 +66,9 @@
              [ContentFilter(_to_crlf_converter, _to_crlf_converter)],
          }
      def eol_lookup(key):
-        return _eol_filter_stack_map.get(key)
+        filter = _eol_filter_stack_map.get(key)
+        if filter is None:
+            from bzrlib.errors import BzrError
+            raise BzrError("Unknown eol filter type '%s'" % key)
+        return filter
      register_filter_stack_map('eol', eol_lookup)

=== modified file 'bzrlib/tests/test_eol_filters.py'
--- bzrlib/tests/test_eol_filters.py	2009-04-02 04:12:11 +0000
+++ bzrlib/tests/test_eol_filters.py	2009-04-17 19:53:42 +0000
@@ -37,3 +37,31 @@
      def test_to_crlf(self):
          result = _to_crlf_converter([_sample_file1])
          self.assertEqual(["hello\r\nworld\r\n"], result)
+
+from bzrlib import (errors, rules)
+from bzrlib.filters import _get_filter_stack_for
+
+class TestEolRulesSpecifications(TestCase):
+
+    def test_exact_setting(self):
+        """'eol = exact' should have no content filters"""
+        prefs = (('eol','exact'),)
+        self.assertEqual([], _get_filter_stack_for(prefs))
+
+    def test_other_known_settings(self):
+        """These known eol settings have corresponding filters."""
+        known_settings = ('lf', 'crlf', 'native',
+            'native-with-crlf-in-repo', 'lf-with-crlf-in-repo',
+            'crlf-with-crlf-in-repo')
+        for setting in known_settings:
+            prefs = (('eol',setting),)
+            self.assertNotEqual([], _get_filter_stack_for(prefs))
+
+    def test_unknown_setting(self):
+        """
+        Unknown settings should emit a warning, and result in no
+        content filters, equivalent to 'exact'.
+        """
+        prefs = (('eol','unknown-setting'),)
+        self.assertRaises(errors.BzrError, _get_filter_stack_for,  
prefs)
+

# Begin bundle
IyBCYXphYXIgcmV2aXNpb24gYnVuZGxlIHY0CiMKQlpoOTFBWSZTWf0au9sAAvffgERQU 
+f//3sB
Hoq//// 
wYAcPvebpXewKZ3W6jbfQ06Yj0ElCJkTyam0TaeqeSeUDJpk9QaNA0ANBJREwBpop5Q0a
BtQaHpANAAAIpmQSehPSaAGgAAAAaNAASKaJok8mk9UeSep6mg2oaaNqPUaPUNDQGQZSmPVGE0AM
IA0ADIAAABJEI00BTYhTyNCekZNQ2kzSaDTEGiABXnsHxYsmVe5tpHvqiuqTIwnu1TDkxZCEldFf
UiYKMzxwj8JAsD7PV1D5yxan6fHaAgrAWC2fbDPRjzhx31XA4xjbfZ1rZWlR7KZSgsm5GnENf47 
+
V7lQDNKFyb0AUqkScaUri1EijEdASLQJGBLpweIDvQMBjWDLT+qJ9MUogJTDIWZ/ 
CaBZmAkDkLqk
A2FPxJ0AEMSltLWu8a1SwNcLIGU4UvLyoLe70b/Ln19eI/OcmO 
+LloaOadqcrEob9dyCHU1Jck+F
tETeJ1jaKmsyqG5pllVcDWEEOqKiF0x3aci4ieBjwKLhJRKssVBH0KSqdolE0yLFsrQ7EZgbPdv7
F1LJdXKPaHrDtAqNucc+jVq62xII1WgvFJ+JqDOfeaG6wYZFa2xR0ylT 
+7WJuHjYIbR4xSDE697Q
Op/ 
CIcojkpOkVhZCgVx5Q6VZOlC6aAamQTczdB1Zw4mpFJ8MIx4iIrDNs9UtOtnofgmm5L0kypIJ
nQZ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