##// END OF EJS Templates
vcs: Fix internal server error when trying to get diff from Mercurial for paths that include globbing patterns (Issue #308):...
Branko Majic -
r7092:b4a56327 stable
parent child Browse files
Show More
@@ -265,7 +265,7 b' class MercurialRepository(BaseRepository'
265 265 self.get_changeset(rev1)
266 266 self.get_changeset(rev2)
267 267 if path:
268 file_filter = match(self.path, '', [path])
268 file_filter = match(self.path, '', [path], exact=True)
269 269 else:
270 270 file_filter = None
271 271
@@ -79,6 +79,14 b' class RepositoryGetDiffTest(_BackendTest'
79 79 ],
80 80 'removed': [FileNode('foobar')],
81 81 },
82 {
83 'message': u'Commit that contains glob pattern in filename',
84 'author': 'Jane Doe <jane.doe@example.com>',
85 'date': datetime.datetime(2010, 1, 1, 22),
86 'added': [
87 FileNode('README{', content='Strangely-named README file'),
88 ],
89 },
82 90 ]
83 91 return commits
84 92
@@ -86,6 +94,11 b' class RepositoryGetDiffTest(_BackendTest'
86 94 with self.assertRaises(ChangesetDoesNotExistError):
87 95 self.repo.get_diff('a' * 40, 'b' * 40)
88 96
97 def test_glob_patterns_in_filename_do_not_raise_exception(self):
98 revs = self.repo.revisions
99
100 diff = self.repo.get_diff(revs[2], revs[3], path='README{') # should not raise
101
89 102
90 103 class GitRepositoryGetDiffTest(RepositoryGetDiffTest, unittest.TestCase):
91 104 backend_alias = 'git'
@@ -153,6 +166,18 b' index c11c37d41d33fb47741cff93fa5f9d798c'
153 166 +FOOBAR
154 167 ''')
155 168
169 def test_fourth_changeset_diff(self):
170 revs = self.repo.revisions
171 self.assertEqual(self.repo.get_diff(revs[2], revs[3]), '''diff --git a/README{ b/README{
172 new file mode 100644
173 index 0000000000000000000000000000000000000000..cdc0c1b5d234feedb37bbac19cd1b6442061102d
174 --- /dev/null
175 +++ b/README{
176 @@ -0,0 +1 @@
177 +Strangely-named README file
178 \ No newline at end of file
179 ''')
180
156 181
157 182 class HgRepositoryGetDiffTest(RepositoryGetDiffTest, unittest.TestCase):
158 183 backend_alias = 'hg'
@@ -214,6 +239,17 b' diff --git a/foobar3 b/foobar3'
214 239 +FOOBAR
215 240 ''')
216 241
242 def test_fourth_changeset_diff(self):
243 revs = self.repo.revisions
244 self.assertEqual(self.repo.get_diff(revs[2], revs[3]), '''diff --git a/README{ b/README{
245 new file mode 100644
246 --- /dev/null
247 +++ b/README{
248 @@ -0,0 +1,1 @@
249 +Strangely-named README file
250 \ No newline at end of file
251 ''')
252
217 253
218 254 # For each backend create test case class
219 255 for alias in SCM_TESTS:
General Comments 0
You need to be logged in to leave comments. Login now