changeset 26765:45976219eb80

merge.mergestate: add a way to get the other side of the merge It's surprising there was no API at all for this until now. In any case this will be needed from custom merge drivers.
author Siddharth Agarwal <sid0@fb.com>
date Thu, 15 Oct 2015 00:49:07 -0700
parents 7ce6fd705495
children a83110faece1
files mercurial/merge.py
diffstat 1 files changed, 7 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/merge.py	Thu Oct 15 00:45:20 2015 -0700
+++ b/mercurial/merge.py	Thu Oct 15 00:49:07 2015 -0700
@@ -84,6 +84,8 @@
         self._state = {}
         self._local = None
         self._other = None
+        if 'otherctx' in vars(self):
+            del self.otherctx
         if node:
             self._local = node
             self._other = other
@@ -101,6 +103,8 @@
         self._local = None
         self._other = None
         self._mdstate = 'u'
+        if 'otherctx' in vars(self):
+            del self.otherctx
         records = self._readrecords()
         for rtype, record in records:
             if rtype == 'L':
@@ -233,6 +237,9 @@
     @util.propertycache
     def mergedriver(self):
         return self._repo.ui.config('experimental', 'mergedriver')
+    @util.propertycache
+    def otherctx(self):
+        return self._repo[self._other]
 
     def active(self):
         """Whether mergestate is active.