comparison mercurial/revset.py @ 24904:b5c227f3e461 stable

revset: id() called with 40-byte strings should give the same results as for short strings The patch solves two issues: 1. id(unknown_full_hash) aborts, but id(unknown_short_hash) doesn't 2. id(40byte_tag_or_bookmark) returns tagged/bookmarked revision, but id(non-40byte_tag_or_bookmark) doesn't After the patch: 1. id(unknown_full_hash) doesn't abort 2. id(40byte_tag_or_bookmark) returns empty set
author Alexander Drozdov <al.drozdov@gmail.com>
date Mon, 20 Apr 2015 10:52:20 +0300
parents 077683371b7b
children e5f166961123 8b99e9a8db05
comparison
equal deleted inserted replaced
24903:09124cce913f 24904:b5c227f3e461
1292 # i18n: "id" is a keyword 1292 # i18n: "id" is a keyword
1293 l = getargs(x, 1, 1, _("id requires one argument")) 1293 l = getargs(x, 1, 1, _("id requires one argument"))
1294 # i18n: "id" is a keyword 1294 # i18n: "id" is a keyword
1295 n = getstring(l[0], _("id requires a string")) 1295 n = getstring(l[0], _("id requires a string"))
1296 if len(n) == 40: 1296 if len(n) == 40:
1297 rn = repo[n].rev() 1297 try:
1298 rn = repo.changelog.rev(node.bin(n))
1299 except (LookupError, TypeError):
1300 rn = None
1298 else: 1301 else:
1299 rn = None 1302 rn = None
1300 pm = repo.changelog._partialmatch(n) 1303 pm = repo.changelog._partialmatch(n)
1301 if pm is not None: 1304 if pm is not None:
1302 rn = repo.changelog.rev(pm) 1305 rn = repo.changelog.rev(pm)