comparison mercurial/bundle2.py @ 45117:b1e51ef4e536

phases: sparsify phase lists When the internal and archived phase was added, allphase became a large, sparsely populated list. This dramatically increased the number of lookup operations for public relations in `phasecache.phase`. As a first step, define allphases and related lists explicitly to contain only the actual phases. Make phasenames a dictionary and create corresponding dictionaries for mapping phase names back to numbers. Adjust various list to be sparse as well with the exception of phaseroots and phasesets members of phasecache. Keep those as a separate step as it involves changes to the C module. Differential Revision: https://phab.mercurial-scm.org/D8697
author Joerg Sonnenberger <joerg@bec.de>
date Wed, 08 Jul 2020 00:15:15 +0200
parents a03c177a4679
children c93dd9d9f1e6
comparison
equal deleted inserted replaced
45116:361a7444bc41 45117:b1e51ef4e536
2206 phasecache = unfi._phasecache 2206 phasecache = unfi._phasecache
2207 msg = ( 2207 msg = (
2208 b'remote repository changed while pushing - please try again ' 2208 b'remote repository changed while pushing - please try again '
2209 b'(%s is %s expected %s)' 2209 b'(%s is %s expected %s)'
2210 ) 2210 )
2211 for expectedphase, nodes in enumerate(phasetonodes): 2211 for expectedphase, nodes in pycompat.iteritems(phasetonodes):
2212 for n in nodes: 2212 for n in nodes:
2213 actualphase = phasecache.phase(unfi, cl.rev(n)) 2213 actualphase = phasecache.phase(unfi, cl.rev(n))
2214 if actualphase != expectedphase: 2214 if actualphase != expectedphase:
2215 finalmsg = msg % ( 2215 finalmsg = msg % (
2216 nodemod.short(n), 2216 nodemod.short(n),