changeset 44930:17d928f8abaf

mergestate: move staticmethod _filectxorabsent to module level I suspect this was a static method just because it made merge.py feel less messy, but now we have a mergestate package so we can do better. Differential Revision: https://phab.mercurial-scm.org/D8591
author Augie Fackler <augie@google.com>
date Thu, 28 May 2020 16:17:28 -0400
parents 9f96beb9bafe
children aa790f7c967a
files mercurial/mergestate.py
diffstat 1 files changed, 9 insertions(+), 8 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/mergestate.py	Fri May 29 12:17:59 2020 +0200
+++ b/mercurial/mergestate.py	Thu May 28 16:17:28 2020 -0400
@@ -31,6 +31,13 @@
     return b'\0'.join(bits)
 
 
+def _filectxorabsent(hexnode, ctx, f):
+    if hexnode == nullhex:
+        return filemerge.absentfilectx(ctx, f)
+    else:
+        return ctx[f]
+
+
 # Merge state record types. See ``mergestate`` docs for more.
 RECORD_LOCAL = b'L'
 RECORD_OTHER = b'O'
@@ -600,8 +607,8 @@
             actx = self._repo[anccommitnode]
         else:
             actx = None
-        fcd = self._filectxorabsent(localkey, wctx, dfile)
-        fco = self._filectxorabsent(onode, octx, ofile)
+        fcd = _filectxorabsent(localkey, wctx, dfile)
+        fco = _filectxorabsent(onode, octx, ofile)
         # TODO: move this to filectxorabsent
         fca = self._repo.filectx(afile, fileid=anode, changectx=actx)
         # "premerge" x flags
@@ -679,12 +686,6 @@
 
         return complete, r
 
-    def _filectxorabsent(self, hexnode, ctx, f):
-        if hexnode == nullhex:
-            return filemerge.absentfilectx(ctx, f)
-        else:
-            return ctx[f]
-
     def preresolve(self, dfile, wctx):
         """run premerge process for dfile