comparison mercurial/revset.py @ 32704:af854b1b36f8

revlog: add support for partial matching of wdir node id The idea is simple. If the given node id prefix is 'ff...f', add +1 to the number of matches (e.g. ambiguous if partial + maybewdir > 1). This patch also fixes id() revset and shortest() template since _partialmatch() can raise WdirUnsupported exception.
author Yuya Nishihara <yuya@tcha.org>
date Fri, 19 Aug 2016 18:26:04 +0900
parents 9f840d99054c
children f75d0aa5dc83
comparison
equal deleted inserted replaced
32703:9f840d99054c 32704:af854b1b36f8
1307 rn = node.wdirrev 1307 rn = node.wdirrev
1308 except (LookupError, TypeError): 1308 except (LookupError, TypeError):
1309 rn = None 1309 rn = None
1310 else: 1310 else:
1311 rn = None 1311 rn = None
1312 pm = repo.changelog._partialmatch(n) 1312 try:
1313 if pm is not None: 1313 pm = repo.changelog._partialmatch(n)
1314 try: 1314 if pm is not None:
1315 rn = repo.changelog.rev(pm) 1315 rn = repo.changelog.rev(pm)
1316 except error.WdirUnsupported: 1316 except error.WdirUnsupported:
1317 rn = node.wdirrev 1317 rn = node.wdirrev
1318 1318
1319 if rn is None: 1319 if rn is None:
1320 return baseset() 1320 return baseset()
1321 result = baseset([rn]) 1321 result = baseset([rn])
1322 return result & subset 1322 return result & subset