# HG changeset patch # User Mads Kiilerich # Date 2019-12-27 00:26:14 # Node ID 7c43e15fb8bc7a73f17f577e59a4698589b6809d # Parent 2a902d81cb6fa6d8ea7601ed0dd7ab50fd1015a6 vcs: make hg get_changesets compatible with py3 If start was 0, we would end up with start_pos None and getting a compare with None which would fail in py3. Instead, make sure start_pos is None iff start is None. Also, make the actual check more robust. diff --git a/kallithea/lib/vcs/backends/hg/repository.py b/kallithea/lib/vcs/backends/hg/repository.py --- a/kallithea/lib/vcs/backends/hg/repository.py +++ b/kallithea/lib/vcs/backends/hg/repository.py @@ -509,11 +509,11 @@ class MercurialRepository(BaseRepository :param reversed: return changesets in reversed order """ start_raw_id = self._get_revision(start) - start_pos = self.revisions.index(start_raw_id) if start else None + start_pos = None if start is None else self.revisions.index(start_raw_id) end_raw_id = self._get_revision(end) - end_pos = self.revisions.index(end_raw_id) if end else None + end_pos = None if end is None else self.revisions.index(end_raw_id) - if None not in [start, end] and start_pos > end_pos: + if start_pos is not None and end_pos is not None and start_pos > end_pos: raise RepositoryError("Start revision '%s' cannot be " "after end revision '%s'" % (start, end))