On py2, we can compare integer type with NoneType but on py3 we can't.
Details
Details
Diff Detail
Diff Detail
- Repository
- rHG Mercurial
- Lint
Lint Skipped - Unit
Unit Tests Skipped
Event Timeline
Comment Actions
for e in log: if e.commitid:
- mindate[e.commitid] = min(e.date, mindate.get(e.commitid))
+ if mindate.get(e.commitid) is None:
+ mindate[e.commitid] = None
+ else:
+ mindate[e.commitid] = min(e.date, mindate.get(e.commitid))
- Merge changesets log.sort(key=lambda x: (mindate.get(x.commitid), x.commitid, x.comment,
mindate is also used here as a comparison key. Filling it to None would
make things worse.
I think the original code, which just fills every mindate element with None,
was wrong. Instead, it should probably keep the minimum value only if exists,
if e.commitid in mindate: mindate[e.commitid] = min(e.date, mindate[e.commitid]) else: mindate[e.commitid] = e.date
and later falls back to the null value.
log.sort(key=lambda x: (mindate.get(x.commitid, (lowest_or_highest_value?, 0)