[Request] [+ ] D8591: mergestate: move staticmethod _filectxorabsent to module level

durin42 (Augie Fackler) phabricator at mercurial-scm.org
Thu May 28 20:25:54 UTC 2020


durin42 created this revision.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.

REVISION SUMMARY
  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.

REPOSITORY
  rHG Mercurial

BRANCH
  default

REVISION DETAIL
  https://phab.mercurial-scm.org/D8591

AFFECTED FILES
  mercurial/mergestate.py

CHANGE DETAILS

diff --git a/mercurial/mergestate.py b/mercurial/mergestate.py
--- a/mercurial/mergestate.py
+++ b/mercurial/mergestate.py
@@ -30,6 +30,12 @@
     bits = bits[:-2] + bits[-1:]
     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'
@@ -600,8 +606,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 +685,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
 



To: durin42, #hg-reviewers
Cc: mercurial-patches, mercurial-devel
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mercurial-scm.org/pipermail/mercurial-patches/attachments/20200528/ed74e13d/attachment.html>


More information about the Mercurial-patches mailing list