fastpartialmatch: handle nullid correctly

Summary: Special case for nullid

Test Plan: arc unit

Reviewers: #mercurial, simpkins, ikostia

Reviewed By: ikostia

Subscribers: net-systems-diffs@fb.com, mjpieters, #sourcecontrol

Differential Revision: https://phabricator.intern.facebook.com/D4945927

Tasks: 17622253

Signature: t1:4945927:1493123209:712990c1e883241d99c0aeb4af8d48e18e1baa3d
This commit is contained in:
Stanislau Hlebik 2017-04-26 03:55:59 -07:00
parent c48413d98b
commit 64ecdf2691
2 changed files with 8 additions and 0 deletions

View File

@ -52,6 +52,9 @@ from mercurial.i18n import _
from mercurial.node import (
bin,
hex,
nullhex,
nullid,
nullrev,
)
from operator import itemgetter
@ -405,6 +408,8 @@ def _findcandidates(ui, vfs, id):
candidates = {}
if not (isinstance(id, str) and len(id) >= 4 and _maybehash(id)):
return candidates
if nullhex.startswith(id):
candidates[nullid] = nullrev
filename = id[:2]
fullpath = os.path.join(_partialindexdir, filename)
try:

View File

@ -462,3 +462,6 @@ Try to create empty commit
$ hg ci -m empty
nothing changed
[1]
Try to checkout nullid
$ hg up --config fastpartialmatch.raiseifinconsistent=True -q 0000000000