diff 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
line wrap: on
line diff
--- 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"