##// 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 self.get_changeset(rev1)
265 self.get_changeset(rev1)
266 self.get_changeset(rev2)
266 self.get_changeset(rev2)
267 if path:
267 if path:
268 file_filter = match(self.path, '', [path])
268 file_filter = match(self.path, '', [path], exact=True)
269 else:
269 else:
270 file_filter = None
270 file_filter = None
271
271
@@ -79,6 +79,14 b' class RepositoryGetDiffTest(_BackendTest'
79 ],
79 ],
80 'removed': [FileNode('foobar')],
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 return commits
91 return commits
84
92
@@ -86,6 +94,11 b' class RepositoryGetDiffTest(_BackendTest'
86 with self.assertRaises(ChangesetDoesNotExistError):
94 with self.assertRaises(ChangesetDoesNotExistError):
87 self.repo.get_diff('a' * 40, 'b' * 40)
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 class GitRepositoryGetDiffTest(RepositoryGetDiffTest, unittest.TestCase):
103 class GitRepositoryGetDiffTest(RepositoryGetDiffTest, unittest.TestCase):
91 backend_alias = 'git'
104 backend_alias = 'git'
@@ -153,6 +166,18 b' index c11c37d41d33fb47741cff93fa5f9d798c'
153 +FOOBAR
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 class HgRepositoryGetDiffTest(RepositoryGetDiffTest, unittest.TestCase):
182 class HgRepositoryGetDiffTest(RepositoryGetDiffTest, unittest.TestCase):
158 backend_alias = 'hg'
183 backend_alias = 'hg'
@@ -214,6 +239,17 b' diff --git a/foobar3 b/foobar3'
214 +FOOBAR
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 # For each backend create test case class
254 # For each backend create test case class
219 for alias in SCM_TESTS:
255 for alias in SCM_TESTS:
General Comments 0
You need to be logged in to leave comments. Login now