Mercurial > public > mercurial-scm > hg
comparison mercurial/revset.py @ 23954:310222feb9a8 stable
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.
author | Yuya Nishihara <yuya@tcha.org> |
---|---|
date | Sat, 10 Jan 2015 12:56:38 +0900 |
parents | caff3675cba5 |
children | b1e026c25552 |
comparison
equal
deleted
inserted
replaced
23953:af73c05e735a | 23954:310222feb9a8 |
---|---|
1543 # i18n: "rev" is a keyword | 1543 # i18n: "rev" is a keyword |
1544 l = int(getstring(l[0], _("rev requires a number"))) | 1544 l = int(getstring(l[0], _("rev requires a number"))) |
1545 except (TypeError, ValueError): | 1545 except (TypeError, ValueError): |
1546 # i18n: "rev" is a keyword | 1546 # i18n: "rev" is a keyword |
1547 raise error.ParseError(_("rev expects a number")) | 1547 raise error.ParseError(_("rev expects a number")) |
1548 if l not in fullreposet(repo): | 1548 if l not in fullreposet(repo) and l != node.nullrev: |
1549 return baseset() | 1549 return baseset() |
1550 return subset & baseset([l]) | 1550 return subset & baseset([l]) |
1551 | 1551 |
1552 def matching(repo, subset, x): | 1552 def matching(repo, subset, x): |
1553 """``matching(revision [, field])`` | 1553 """``matching(revision [, field])`` |