changeset 8061:7c43e15fb8bc

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.
author Mads Kiilerich <mads@kiilerich.com>
date Fri, 27 Dec 2019 00:26:14 +0100
parents 2a902d81cb6f
children 9203621cae03
files kallithea/lib/vcs/backends/hg/repository.py
diffstat 1 files changed, 3 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/kallithea/lib/vcs/backends/hg/repository.py	Thu Dec 26 15:10:19 2019 +0100
+++ b/kallithea/lib/vcs/backends/hg/repository.py	Fri Dec 27 00:26:14 2019 +0100
@@ -509,11 +509,11 @@
         :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))