nodemap: make `_persist_nodemap` a public function
authorPulkit Goyal <7895pulkit@gmail.com>
Sun, 31 Jan 2021 23:34:59 +0530
changeset 46529 83f037acf71a
parent 46528 45c3a263d5d1
child 46530 835aafb2543f
nodemap: make `_persist_nodemap` a public function I will like to have a utility function using which we can directly write out nodemap for a repository without going through the recloning process. This function seems like the one containing important pieces for that. Let's make it public. Differential Revision: https://phab.mercurial-scm.org/D9932
mercurial/revlogutils/nodemap.py
--- a/mercurial/revlogutils/nodemap.py	Sun Jan 31 23:13:08 2021 +0530
+++ b/mercurial/revlogutils/nodemap.py	Sun Jan 31 23:34:59 2021 +0530
@@ -81,9 +81,9 @@
     if tr.hasfinalize(callback_id):
         return  # no need to register again
     tr.addpending(
-        callback_id, lambda tr: _persist_nodemap(tr, revlog, pending=True)
+        callback_id, lambda tr: persist_nodemap(tr, revlog, pending=True)
     )
-    tr.addfinalize(callback_id, lambda tr: _persist_nodemap(tr, revlog))
+    tr.addfinalize(callback_id, lambda tr: persist_nodemap(tr, revlog))
 
 
 class _NoTransaction(object):
@@ -123,12 +123,12 @@
         return  # we do not use persistent_nodemap on this revlog
 
     notr = _NoTransaction()
-    _persist_nodemap(notr, revlog)
+    persist_nodemap(notr, revlog)
     for k in sorted(notr._postclose):
         notr._postclose[k](None)
 
 
-def _persist_nodemap(tr, revlog, pending=False):
+def persist_nodemap(tr, revlog, pending=False):
     """Write nodemap data on disk for a given revlog"""
     if getattr(revlog, 'filteredrevs', ()):
         raise error.ProgrammingError(