[PATCH 2 of 4 V3] merge: add summarizeconflicts()

Phil Cohen phillco at fb.com
Thu Mar 16 22:17:16 EDT 2017


# HG changeset patch
# User Phil Cohen <phillco at fb.com>
# Date 1489716532 25200
#      Thu Mar 16 19:08:52 2017 -0700
# Node ID 864def5028681cdffeaf5b440ff4753e1389f453
# Parent  ad81d182e88ffd3da20364f18204facf6e7750a3
merge: add summarizeconflicts()

calls `filemerge.summarize()` but only requires a workingctx and a path

diff --git a/mercurial/merge.py b/mercurial/merge.py
--- a/mercurial/merge.py
+++ b/mercurial/merge.py
@@ -544,6 +544,25 @@
         Returns whether the merge is complete, and the exit code."""
         return self._resolve(True, dfile, wctx)
 
+    def summarizeconflicts(self, path, workingctx):
+        if self[path] in 'rd':
+            return None
+        stateentry = self._state[path]
+        state, hash, lfile, afile, anode, ofile, onode, flags = stateentry
+        octx = self._repo[self._other]
+        extras = self.extras(path)
+        anccommitnode = extras.get('ancestorlinknode')
+        if anccommitnode:
+            ancestorctx = self._repo[anccommitnode]
+        else:
+            ancestorctx = None
+        workingctx = self._filectxorabsent(hash, workingctx, path)
+        otherctx = self._filectxorabsent(onode, octx, ofile)
+        basectx = self._repo.filectx(afile, fileid=anode,
+                                     changeid=ancestorctx)
+
+        return filemerge.summarize(self._repo, workingctx, otherctx, basectx)
+
     def resolve(self, dfile, wctx):
         """run merge process (assuming premerge was run) for dfile
 


More information about the Mercurial-devel mailing list