# HG changeset patch # User Yuya Nishihara # Date 1420862198 -32400 # Node ID 310222feb9a8671d48a8df6b57300d0326176ba0 # Parent af73c05e735aecf8c863ceb57a31ae1bc8487412 revset: allow rev(-1) to indicate null revision (BC) This can simplify the conversion from numeric revision to string. Without it, we have to handle -1 specially because repo['-1'] != repo[-1]. The -1 revision is not officially documented, but this change makes sense assuming that "rev(%d)" exists for scripting or third-party tools. diff -r af73c05e735a -r 310222feb9a8 mercurial/revset.py --- a/mercurial/revset.py Fri Jan 23 20:30:49 2015 -0800 +++ b/mercurial/revset.py Sat Jan 10 12:56:38 2015 +0900 @@ -1545,7 +1545,7 @@ except (TypeError, ValueError): # i18n: "rev" is a keyword raise error.ParseError(_("rev expects a number")) - if l not in fullreposet(repo): + if l not in fullreposet(repo) and l != node.nullrev: return baseset() return subset & baseset([l]) diff -r af73c05e735a -r 310222feb9a8 tests/test-revset.t --- a/tests/test-revset.t Fri Jan 23 20:30:49 2015 -0800 +++ b/tests/test-revset.t Sat Jan 10 12:56:38 2015 +0900 @@ -465,7 +465,9 @@ 9 Test explicit numeric revision + $ log 'rev(-2)' $ log 'rev(-1)' + -1 $ log 'rev(0)' 0 $ log 'rev(9)'