# HG changeset patch # User Pierre-Yves David # Date 1602166446 -7200 # Node ID 17a12f53dd72d39ce62721a0a43b681d4b4b4bb8 # Parent 57b5452a55d5d3e513267ac27324c17e215e6352 revset: add a `node` key for sorting Sorting by node give an arbitrary, but stable order which is useful for sampling. diff -r 57b5452a55d5 -r 17a12f53dd72 mercurial/revset.py --- a/mercurial/revset.py Sun Oct 04 22:32:41 2020 -0700 +++ b/mercurial/revset.py Thu Oct 08 16:14:06 2020 +0200 @@ -2293,6 +2293,7 @@ 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(), } @@ -2356,6 +2357,7 @@ - ``user`` for user name (``author`` can be used as an alias), - ``date`` for the commit date - ``topo`` for a reverse topographical sort + - ``node`` the nodeid of the revision The ``topo`` sort order cannot be combined with other sort keys. This sort takes one optional argument, ``topo.firstbranch``, which takes a revset that diff -r 57b5452a55d5 -r 17a12f53dd72 tests/test-revset.t --- a/tests/test-revset.t Sun Oct 04 22:32:41 2020 -0700 +++ b/tests/test-revset.t Thu Oct 08 16:14:06 2020 +0200 @@ -2885,7 +2885,7 @@ 3 b112 m111 u11 120 0 0 b12 m111 u112 111 10800 - $ hg log -r 'sort(all(), "-desc -date")' + $ hg log -r 'sort(all(), "-desc -node")' 1 b11 m12 u111 112 7200 4 b111 m112 u111 110 14400 3 b112 m111 u11 120 0