Rev 5340: (jameinel) Rename errors.InvalidPattern argument message=>msg to work with in file:///home/pqm/archives/thelove/bzr/%2Btrunk/

Canonical.com Patch Queue Manager pqm at pqm.ubuntu.com
Fri Jul 9 19:02:20 BST 2010


At file:///home/pqm/archives/thelove/bzr/%2Btrunk/

------------------------------------------------------------
revno: 5340 [merge]
revision-id: pqm at pqm.ubuntu.com-20100709180218-431qg3bpsu3yy53o
parent: pqm at pqm.ubuntu.com-20100708103412-bfv99ad1u9a63ly8
parent: parth.malwankar at gmail.com-20100709161611-d9w6eiwze2ilk8dk
committer: Canonical.com Patch Queue Manager <pqm at pqm.ubuntu.com>
branch nick: +trunk
timestamp: Fri 2010-07-09 19:02:18 +0100
message:
  (jameinel) Rename errors.InvalidPattern argument message=>msg to work with
   multiple Python versions. (Parth Malwankar)
modified:
  bzrlib/errors.py               errors.py-20050309040759-20512168c4e14fbd
  bzrlib/globbing.py             glob.py-20061113075651-q63o2v35fm2ydk9x-1
  bzrlib/osutils.py              osutils.py-20050309040759-eeaff12fbf77ac86
  bzrlib/tests/blackbox/test_log.py test_log.py-20060112090212-78f6ea560c868e24
  bzrlib/tests/test_errors.py    test_errors.py-20060210110251-41aba2deddf936a8
  bzrlib/tests/test_globbing.py  test_glob.py-20061113075651-q63o2v35fm2ydk9x-2
  bzrlib/tests/test_lazy_regex.py test_lazy_regex.py-20061009091222-fyettq6z5qomdl9e-2
=== modified file 'bzrlib/errors.py'
--- a/bzrlib/errors.py	2010-06-30 12:03:30 +0000
+++ b/bzrlib/errors.py	2010-07-09 16:16:11 +0000
@@ -3157,8 +3157,8 @@
 
 class InvalidPattern(BzrError):
 
-    _fmt = ('Invalid pattern(s) found. %(message)s')
+    _fmt = ('Invalid pattern(s) found. %(msg)s')
 
-    def __init__(self, message):
-        self.message = message
+    def __init__(self, msg):
+        self.msg = msg
 

=== modified file 'bzrlib/globbing.py'
--- a/bzrlib/globbing.py	2010-07-08 05:11:16 +0000
+++ b/bzrlib/globbing.py	2010-07-09 16:16:11 +0000
@@ -217,11 +217,11 @@
                 if match:
                     return patterns[match.lastindex -1]
         except errors.InvalidPattern, e:
-            # We can't show the default e.message to the user as thats for
+            # We can't show the default e.msg to the user as thats for
             # the combined pattern we sent to regex. Instead we indicate to
             # the user that an ignore file needs fixing.
-            mutter('Invalid pattern found in regex: %s.', e.message)
-            e.message = "File ~/.bazaar/ignore or .bzrignore contains errors."
+            mutter('Invalid pattern found in regex: %s.', e.msg)
+            e.msg = "File ~/.bazaar/ignore or .bzrignore contains errors."
             raise e
         return None
 

=== modified file 'bzrlib/osutils.py'
--- a/bzrlib/osutils.py	2010-07-08 10:34:12 +0000
+++ b/bzrlib/osutils.py	2010-07-09 16:16:11 +0000
@@ -2184,7 +2184,7 @@
             where = ' in ' + where
         # despite the name 'error' is a type
         raise errors.BzrCommandError('Invalid regular expression%s: %s'
-            % (where, e.message))
+            % (where, e.msg))
 
 
 if sys.platform == "win32":

=== modified file 'bzrlib/tests/blackbox/test_log.py'
--- a/bzrlib/tests/blackbox/test_log.py	2010-06-30 12:03:30 +0000
+++ b/bzrlib/tests/blackbox/test_log.py	2010-07-09 16:16:11 +0000
@@ -387,6 +387,7 @@
         self.make_minimal_branch()
         out, err = self.run_bzr(['log', '-m', '*'], retcode=3)
         self.assertContainsRe(err, "ERROR.*Invalid pattern.*nothing to repeat")
+        self.assertNotContainsRe(err, "Unprintable exception")
         self.assertEqual(out, '')
 
     def test_log_unsupported_timezone(self):

=== modified file 'bzrlib/tests/test_errors.py'
--- a/bzrlib/tests/test_errors.py	2010-05-20 18:23:17 +0000
+++ b/bzrlib/tests/test_errors.py	2010-07-09 16:16:11 +0000
@@ -655,6 +655,11 @@
         str(err)
         self.assertEqual(['open_repository'], fake_bzrdir.calls)
 
+    def test_invalid_pattern(self):
+        error = errors.InvalidPattern('Bad pattern msg.')
+        self.assertEqualDiff("Invalid pattern(s) found. Bad pattern msg.",
+            str(error))
+
 
 class PassThroughError(errors.BzrError):
 

=== modified file 'bzrlib/tests/test_globbing.py'
--- a/bzrlib/tests/test_globbing.py	2010-06-30 13:49:02 +0000
+++ b/bzrlib/tests/test_globbing.py	2010-07-09 16:16:11 +0000
@@ -314,7 +314,7 @@
         patterns = [u'RE:[']
         g = Globster(patterns)
         e = self.assertRaises(errors.InvalidPattern, g.match, 'foo')
-        self.assertContainsRe(e.message, "File.*ignore.*contains errors")
+        self.assertContainsRe(e.msg, "File.*ignore.*contains errors")
 
 
 class TestExceptionGlobster(TestCase):

=== modified file 'bzrlib/tests/test_lazy_regex.py'
--- a/bzrlib/tests/test_lazy_regex.py	2010-06-30 13:49:02 +0000
+++ b/bzrlib/tests/test_lazy_regex.py	2010-07-09 16:16:11 +0000
@@ -70,8 +70,7 @@
         # As p.match is lazy, we make it into a lambda so its handled
         # by assertRaises correctly.
         e = self.assertRaises(errors.InvalidPattern, lambda: p.match('foo'))
-        self.assertEqual(e.message,
-            '"RE:[" unexpected end of regular expression')
+        self.assertEqual(e.msg, '"RE:[" unexpected end of regular expression')
 
 
 class TestLazyCompile(tests.TestCase):




More information about the bazaar-commits mailing list