# HG changeset patch # User Christophe de Vienne # Date 1414445896 -3600 # Node ID 3c3734c184d9e41787ede241c22d370e44fa0caa # Parent 3e5dfa8a94ef4f3e38e589e8a80792eb51cdc303 Use revsets to find newer and older cset of the current changeset. With obsolescence markers enabled, rev numbers are not linear diff -r 3e5dfa8a94ef -r 3c3734c184d9 review/web.py --- a/review/web.py Mon Oct 27 18:42:14 2014 +0100 +++ b/review/web.py Mon Oct 27 22:38:16 2014 +0100 @@ -190,8 +190,12 @@ cu_signoff = cu_signoffs[0] if cu_signoffs else None tip = g.datastore.target['tip'].rev() - newer = rcset.target[rev.rev() + 1] if rev.rev() < tip else None - older = rcset.target[rev.rev() - 1] if rev.rev() > 0 else None + newer = rcset.target[ + rcset.target.revs('sort(first(%s:, 2), -rev)' % rev.rev())[0] + ] if rev.rev() < tip else None + older = rcset.target[ + rcset.target.revs('sort(last(:%s, 2), rev)' % rev.rev())[0] + ] if rev.rev() > 0 else None return _render('changeset.html', rcset=rcset, rev=rev, cu_signoff=cu_signoff, newer=newer, older=older)