Commits

Marcin Kuzminski committed 2876a2f

fixed bug with passing start_date and end_date to get_changesets
function

Comments (0)

Files changed (2)

vcs/backends/hg/repository.py

         if branch_name:
             filter_.append('branch("%s")' % (branch_name))
 
-        if start_date:
+        if start_date and not end_date:
             filter_.append('date(">%s")' % start_date)
-        if end_date:
+        if end_date and not start_date:
             filter_.append('date("<%s")' % end_date)
+        if start_date and end_date:
+            filter_.append('date(">%s") and date("<%s")' % (start_date, end_date))
         if filter_:
             revisions = scmutil.revrange(self._repo, filter_)
         else:

vcs/tests/test_changesets.py

             self.assertGreaterEqual(cs.date, start_date)
 
     def test_get_changesets_respects_end_date(self):
+        start_date = datetime.datetime(2010, 1, 1)
+        end_date = datetime.datetime(2010, 2, 1)
+        for cs in self.repo.get_changesets(start_date=start_date,
+                                           end_date=end_date):
+            self.assertGreaterEqual(cs.date, start_date)
+            self.assertLessEqual(cs.date, end_date)
+
+    def test_get_changesets_respects_start_date_and_end_date(self):
         end_date = datetime.datetime(2010, 2, 1)
         for cs in self.repo.get_changesets(end_date=end_date):
             self.assertLessEqual(cs.date, end_date)