diff --git a/tracopt/versioncontrol/svn/svn_fs.py b/tracopt/versioncontrol/svn/svn_fs.py index b2c8233b10..f4b53839dd 100644 --- a/tracopt/versioncontrol/svn/svn_fs.py +++ b/tracopt/versioncontrol/svn/svn_fs.py @@ -256,6 +256,9 @@ def db_rev(self, rev): def rev_db(self, rev): return int(rev or 0) + def normalize_rev(self, rev): + return self.repos.normalize_rev(rev) + class SubversionConnector(Component): @@ -427,7 +430,7 @@ def normalize_rev(self, rev): else: try: rev = int(rev) - if rev <= self.youngest_rev: + if 0 <= rev <= self.youngest_rev: return rev except (ValueError, TypeError): pass @@ -766,7 +769,7 @@ def __init__(self, path, rev, repos, pool=None, parent_root=None): try: self.root = fs.revision_root(self.fs_ptr, rev, pool) except core.SubversionException as e: - raise TracError(e) + raise NoSuchChangeset(e) node_type = fs.check_path(self.root, self._scoped_path_utf8, pool) if not node_type in _kindmap: raise NoSuchNode(path, rev) diff --git a/tracopt/versioncontrol/svn/tests/svn_fs.py b/tracopt/versioncontrol/svn/tests/svn_fs.py index 488b2f348b..8aea390546 100644 --- a/tracopt/versioncontrol/svn/tests/svn_fs.py +++ b/tracopt/versioncontrol/svn/tests/svn_fs.py @@ -130,6 +130,8 @@ def test_repos_normalize_rev(self): self.assertEqual(HEAD, self.repos.normalize_rev(None)) self.assertEqual(11, self.repos.normalize_rev('11')) self.assertEqual(11, self.repos.normalize_rev(11)) + self.assertRaises(NoSuchChangeset, self.repos.normalize_rev, -1) + self.assertRaises(NoSuchChangeset, self.repos.normalize_rev, -42) def test_repos_display_rev(self): self.assertEqual(str(HEAD), self.repos.display_rev('latest')) @@ -189,7 +191,7 @@ def test_get_node(self): self.assertEqual(HEAD, node.created_rev) self.assertEqual(datetime(2015, 6, 15, 14, 9, 13, 664490, utc), node.last_modified) - self.assertRaises(TracError, self.repos.get_node, u'/', -1) + self.assertRaises(NoSuchChangeset, self.repos.get_node, u'/', -1) node = self.repos.get_node(u'/tête') self.assertEqual(u'tête', node.name) self.assertEqual(u'/tête', node.path)