Mercurial > public > mercurial-scm > hg
comparison mercurial/revlogutils/nodemap.py @ 47151:24be247a13b4
revlog: stop usage of `_indexfile` to computing nodemap path
We now have the radix explicitely lets use the radix explicitely
Differential Revision: https://phab.mercurial-scm.org/D10577
author | Pierre-Yves David <pierre-yves.david@octobus.net> |
---|---|
date | Mon, 03 May 2021 12:22:47 +0200 |
parents | a07d5cb03a85 |
children | 09338a2d5c14 |
comparison
equal
deleted
inserted
replaced
47150:8d3c2f9d4af7 | 47151:24be247a13b4 |
---|---|
146 raise error.ProgrammingError( | 146 raise error.ProgrammingError( |
147 "cannot persist nodemap of a filtered changelog" | 147 "cannot persist nodemap of a filtered changelog" |
148 ) | 148 ) |
149 if revlog.nodemap_file is None: | 149 if revlog.nodemap_file is None: |
150 if force: | 150 if force: |
151 revlog.nodemap_file = get_nodemap_file( | 151 revlog.nodemap_file = get_nodemap_file(revlog) |
152 revlog.opener, revlog._indexfile | |
153 ) | |
154 else: | 152 else: |
155 msg = "calling persist nodemap on a revlog without the feature enabled" | 153 msg = "calling persist nodemap on a revlog without the feature enabled" |
156 raise error.ProgrammingError(msg) | 154 raise error.ProgrammingError(msg) |
157 | 155 |
158 can_incremental = util.safehasattr(revlog.index, "nodemap_data_incremental") | 156 can_incremental = util.safehasattr(revlog.index, "nodemap_data_incremental") |
651 if isinstance(entry, dict): | 649 if isinstance(entry, dict): |
652 return _find_node(entry, node[1:]) | 650 return _find_node(entry, node[1:]) |
653 return entry | 651 return entry |
654 | 652 |
655 | 653 |
656 def get_nodemap_file(opener, indexfile): | 654 def get_nodemap_file(revlog): |
657 if indexfile.endswith(b'.a'): | 655 if revlog.postfix == b'a': |
658 pending_path = indexfile[:-4] + b".n.a" | 656 pending_path = revlog.radix + b".n.a" |
659 if opener.exists(pending_path): | 657 if revlog.opener.exists(pending_path): |
660 return pending_path | 658 return pending_path |
661 else: | 659 return revlog.radix + b".n" |
662 return indexfile[:-4] + b".n" | |
663 else: | |
664 return indexfile[:-2] + b".n" |