Rev 835: Raise appropriate exception when encountering newline in revid property. in file:///data/jelmer/bzr-svn/0.4/

Jelmer Vernooij jelmer at samba.org
Fri Jan 18 04:05:54 GMT 2008


At file:///data/jelmer/bzr-svn/0.4/

------------------------------------------------------------
revno: 835
revision-id:jelmer at samba.org-20080117183740-37frj5z7jlifax5h
parent: jelmer at samba.org-20080112235548-vribbp2ql2zgwpjt
committer: Jelmer Vernooij <jelmer at samba.org>
branch nick: 0.4
timestamp: Thu 2008-01-17 19:37:40 +0100
message:
  Raise appropriate exception when encountering newline in revid property.
modified:
  repository.py                  repository.py-20060306123302-1f8c5069b3fe0265
  tests/test_repos.py            test_repos.py-20060508151940-ddc49a59257ca712
=== modified file 'repository.py'
--- a/repository.py	2008-01-09 11:09:34 +0000
+++ b/repository.py	2008-01-17 18:37:40 +0000
@@ -149,7 +149,9 @@
     :param line: line to parse
     :return: tuple with (bzr_revno, revid)
     """
-    assert not '\n' in line
+    if '\n' in line:
+        raise errors.InvalidPropertyValue(SVN_PROP_BZR_REVISION_ID, 
+                "newline in revision id property line")
     try:
         (revno, revid) = line.split(' ', 1)
     except ValueError:

=== modified file 'tests/test_repos.py'
--- a/tests/test_repos.py	2007-12-06 17:51:13 +0000
+++ b/tests/test_repos.py	2008-01-17 18:37:40 +0000
@@ -1300,5 +1300,8 @@
         self.assertRaises(InvalidPropertyValue, 
                 lambda: parse_revid_property("2 "))
 
+    def test_parse_revid_property_newline(self):
+        self.assertRaises(InvalidPropertyValue, 
+                lambda: parse_revid_property("foo\nbar"))
 
 




More information about the bazaar-commits mailing list