Mercurial > hg-stable
changeset 45701:b90d7e7f39db
revset: fix sorting key of wdir revision
It would go wrong on Python 2, and would crash on Python 3.
author | Yuya Nishihara <yuya@tcha.org> |
---|---|
date | Fri, 09 Oct 2020 19:19:10 +0900 |
parents | c694b1841a5e |
children | deeb215be337 |
files | mercurial/revset.py tests/test-revset.t |
diffstat | 2 files changed, 25 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- a/mercurial/revset.py Wed Sep 09 16:18:26 2020 +0900 +++ b/mercurial/revset.py Fri Oct 09 19:19:10 2020 +0900 @@ -2287,13 +2287,13 @@ _sortkeyfuncs = { - b'rev': lambda c: c.rev(), + b'rev': scmutil.intrev, b'branch': lambda c: c.branch(), b'desc': lambda c: c.description(), b'user': lambda c: c.user(), b'author': lambda c: c.user(), b'date': lambda c: c.date()[0], - b'node': lambda c: c.node(), + b'node': scmutil.binnode, }
--- a/tests/test-revset.t Wed Sep 09 16:18:26 2020 +0900 +++ b/tests/test-revset.t Fri Oct 09 19:19:10 2020 +0900 @@ -2899,6 +2899,29 @@ 0 b12 m111 u112 111 10800 2 b111 m11 u12 111 3600 + sort including wdir (rev/-rev has fast path): + + $ hg log -r 'sort(. + wdir(), rev)' -T '{rev}\n' + 4 + 2147483647 + $ hg log -r 'sort(. + wdir(), -rev)' -T '{rev}\n' + 2147483647 + 4 + + $ hg log -r 'sort(. + wdir(), "branch rev")' -T '{rev}\n' + 4 + 2147483647 + $ hg log -r 'sort(. + wdir(), "branch -rev")' -T '{rev}\n' + 2147483647 + 4 + + $ hg log -r 'sort(. + wdir(), node)' -T '{node}\n' + ec7c1c90b589ade8603d5fb619dc6c25173a723f + ffffffffffffffffffffffffffffffffffffffff + $ hg log -r 'sort(. + wdir(), -node)' -T '{node}\n' + ffffffffffffffffffffffffffffffffffffffff + ec7c1c90b589ade8603d5fb619dc6c25173a723f + toposort prioritises graph branches $ hg up 2