mercurial/revlogutils/nodemap.py
changeset 46469 835aafb2543f
parent 46468 83f037acf71a
child 46470 dadb4db55661
--- a/mercurial/revlogutils/nodemap.py	Sun Jan 31 23:34:59 2021 +0530
+++ b/mercurial/revlogutils/nodemap.py	Sun Jan 31 23:38:31 2021 +0530
@@ -634,3 +634,14 @@
     if isinstance(entry, dict):
         return _find_node(entry, node[1:])
     return entry
+
+
+def get_nodemap_file(opener, indexfile):
+    if indexfile.endswith(b'.a'):
+        pending_path = indexfile[:-4] + b".n.a"
+        if opener.exists(pending_path):
+            return pending_path
+        else:
+            return indexfile[:-4] + b".n"
+    else:
+        return indexfile[:-2] + b".n"