code: def get_changesets(self, start=None, end=None, start_date=None,
                         end_date=None, branch_name=None, reverse=False):
          
  
          start_raw_id = self._get_revision(start)
          start_pos = self.revisions.index(start_raw_id) if start else None
          end_raw_id = self._get_revision(end)
          end_pos = self.revisions.index(end_raw_id) if end else None
  
          if None not in [start, end] and start_pos > end_pos:
              raise RepositoryError("Start revision '%s' cannot be "
                                    "after end revision '%s'" % (start, end))
  
          if branch_name and branch_name not in self.allbranches.keys():
              raise BranchDoesNotExistError('Branch %s not found in'
                                    ' this repository' % branch_name)
          if end_pos is not None:
              end_pos += 1
          #filter branches
          filter_ = []
          if branch_name:
              filter_.append('branch("%s")' % (branch_name))
  
          if start_date:
              filter_.append('date(">%s")' % start_date)
          if end_date:
              filter_.append('date("<%s")' % end_date)
          if filter_:
              revisions = scmutil.revrange(self._repo, [" and ".join(filter_)])
          else:
              revisions = self.revisions
  
          revs = revisions[start_pos:end_pos]
          if reverse:
              revs = reversed(revs)
  
          return CollectionGenerator(self, revs)
docs: Returns iterator of ``MercurialChangeset`` objects from start to end
          (both are inclusive)
  
          :param start: None, str, int or mercurial lookup format
          :param end:  None, str, int or mercurial lookup format
          :param start_date:
          :param end_date:
          :param branch_name:
          :param reversed: return changesets in reversed order