##// END OF EJS Templates
vcs: fix get_changesets filtering on hg repo to AND the criteria instead of OR...
domruf -
r7069:bfb1ae42 default
parent child Browse files
Show More
@@ -540,14 +540,13 b' class MercurialRepository(BaseRepository'
540 if branch_name:
540 if branch_name:
541 filter_.append('branch("%s")' % (branch_name))
541 filter_.append('branch("%s")' % (branch_name))
542
542
543 if start_date and not end_date:
543 if start_date:
544 filter_.append('date(">%s")' % start_date)
544 filter_.append('date(">%s")' % start_date)
545 if end_date and not start_date:
545 if end_date:
546 filter_.append('date("<%s")' % end_date)
546 filter_.append('date("<%s")' % end_date)
547 if start_date and end_date:
548 filter_.append('date(">%s") and date("<%s")' % (start_date, end_date))
549 if filter_:
547 if filter_:
550 revisions = scmutil.revrange(self._repo, filter_)
548 revspec = ' and '.join(filter_)
549 revisions = scmutil.revrange(self._repo, [revspec])
551 else:
550 else:
552 revisions = self.revisions
551 revisions = self.revisions
553
552
@@ -21,6 +21,8 b' import random'
21 import mock
21 import mock
22 import re
22 import re
23
23
24 import pytest
25
24 from kallithea.tests.base import *
26 from kallithea.tests.base import *
25 from kallithea.tests.fixture import Fixture
27 from kallithea.tests.fixture import Fixture
26 from kallithea.lib.compat import json
28 from kallithea.lib.compat import json
@@ -2501,6 +2503,19 b' class _BaseTestApi(object):'
2501 assert 'message' in result[0]
2503 assert 'message' in result[0]
2502 assert 'added' not in result[0]
2504 assert 'added' not in result[0]
2503
2505
2506 def test_api_get_changesets_with_branch(self):
2507 if self.REPO == 'vcs_test_hg':
2508 branch = 'stable'
2509 else:
2510 pytest.skip("skipping due to missing branches in git test repo")
2511 id_, params = _build_data(self.apikey, 'get_changesets',
2512 repoid=self.REPO, branch_name=branch, start_date="2011-02-24T00:00:00")
2513 response = api_call(self, params)
2514 result = json.loads(response.body)["result"]
2515 assert len(result) == 5
2516 assert 'message' in result[0]
2517 assert 'added' not in result[0]
2518
2504 def test_api_get_changesets_with_file_list(self):
2519 def test_api_get_changesets_with_file_list(self):
2505 id_, params = _build_data(self.apikey, 'get_changesets',
2520 id_, params = _build_data(self.apikey, 'get_changesets',
2506 repoid=self.REPO, start_date="2010-04-07T23:30:30", end_date="2010-04-08T00:31:14", with_file_list=True)
2521 repoid=self.REPO, start_date="2010-04-07T23:30:30", end_date="2010-04-08T00:31:14", with_file_list=True)
General Comments 0
You need to be logged in to leave comments. Login now