comparison hgext/git/index.py @ 44946:fb2936c5f6dc

git: decode node IDs back into Python strings (issue6349) db.text_factory = bytes, so the database contains only strings. The object IDs we get from pygit2 are Python strings. b'foo' != 'foo' This change allows the "don't reindex" optimization to work by allowing the "cur_cache_heads == cache_heads" comparison a few lines down to succeed. Differential Revision: https://phab.mercurial-scm.org/D8622
author Hollis Blanchard <hollis_blanchard@mentor.com>
date Tue, 09 Jun 2020 13:18:21 -0700
parents ec54b3d2af0b
children 83e41b73d115
comparison
equal deleted inserted replaced
44945:7a0a1be721a3 44946:fb2936c5f6dc
243 # this is a very important performance win. 243 # this is a very important performance win.
244 # 244 #
245 # TODO: we should figure out how to incrementally index history 245 # TODO: we should figure out how to incrementally index history
246 # (preferably by detecting rewinds!) so that we don't have to do a 246 # (preferably by detecting rewinds!) so that we don't have to do a
247 # full changelog walk every time a new commit is created. 247 # full changelog walk every time a new commit is created.
248 cache_heads = {x[0] for x in db.execute('SELECT node FROM possible_heads')} 248 cache_heads = {
249 pycompat.sysstr(x[0])
250 for x in db.execute('SELECT node FROM possible_heads')
251 }
249 walker = None 252 walker = None
250 cur_cache_heads = {h.hex for h in possible_heads} 253 cur_cache_heads = {h.hex for h in possible_heads}
251 if cur_cache_heads == cache_heads: 254 if cur_cache_heads == cache_heads:
252 return 255 return
253 for start in possible_heads: 256 for start in possible_heads: