Changeset - 7c43e15fb8bc
[Not reviewed]
default
0 1 0
Mads Kiilerich - 6 years ago 2019-12-27 00:26:14
mads@kiilerich.com
Grafted from: b4f9ae39b9b3
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.
1 file changed with 3 insertions and 3 deletions:
0 comments (0 inline, 0 general)
kallithea/lib/vcs/backends/hg/repository.py
Show inline comments
 
@@ -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))
 

	
0 comments (0 inline, 0 general)