comparison mercurial/revlogutils/nodemap.py @ 46469:835aafb2543f

revlog: refactor logic to compute nodemap file in separate function I will like to use it one more place. Differential Revision: https://phab.mercurial-scm.org/D9933
author Pulkit Goyal <7895pulkit@gmail.com>
date Sun, 31 Jan 2021 23:38:31 +0530
parents 83f037acf71a
children dadb4db55661
comparison
equal deleted inserted replaced
46468:83f037acf71a 46469:835aafb2543f
632 """find the revision associated with a given node""" 632 """find the revision associated with a given node"""
633 entry = block.get(_to_int(node[0:1])) 633 entry = block.get(_to_int(node[0:1]))
634 if isinstance(entry, dict): 634 if isinstance(entry, dict):
635 return _find_node(entry, node[1:]) 635 return _find_node(entry, node[1:])
636 return entry 636 return entry
637
638
639 def get_nodemap_file(opener, indexfile):
640 if indexfile.endswith(b'.a'):
641 pending_path = indexfile[:-4] + b".n.a"
642 if opener.exists(pending_path):
643 return pending_path
644 else:
645 return indexfile[:-4] + b".n"
646 else:
647 return indexfile[:-2] + b".n"