comparison mercurial/merge.py @ 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 949e8c626d19
children a83110faece1
comparison
equal deleted inserted replaced
26764:7ce6fd705495 26765:45976219eb80
82 82
83 def reset(self, node=None, other=None): 83 def reset(self, node=None, other=None):
84 self._state = {} 84 self._state = {}
85 self._local = None 85 self._local = None
86 self._other = None 86 self._other = None
87 if 'otherctx' in vars(self):
88 del self.otherctx
87 if node: 89 if node:
88 self._local = node 90 self._local = node
89 self._other = other 91 self._other = other
90 self._mdstate = 'u' 92 self._mdstate = 'u'
91 shutil.rmtree(self._repo.join('merge'), True) 93 shutil.rmtree(self._repo.join('merge'), True)
99 """ 101 """
100 self._state = {} 102 self._state = {}
101 self._local = None 103 self._local = None
102 self._other = None 104 self._other = None
103 self._mdstate = 'u' 105 self._mdstate = 'u'
106 if 'otherctx' in vars(self):
107 del self.otherctx
104 records = self._readrecords() 108 records = self._readrecords()
105 for rtype, record in records: 109 for rtype, record in records:
106 if rtype == 'L': 110 if rtype == 'L':
107 self._local = bin(record) 111 self._local = bin(record)
108 elif rtype == 'O': 112 elif rtype == 'O':
231 return records 235 return records
232 236
233 @util.propertycache 237 @util.propertycache
234 def mergedriver(self): 238 def mergedriver(self):
235 return self._repo.ui.config('experimental', 'mergedriver') 239 return self._repo.ui.config('experimental', 'mergedriver')
240 @util.propertycache
241 def otherctx(self):
242 return self._repo[self._other]
236 243
237 def active(self): 244 def active(self):
238 """Whether mergestate is active. 245 """Whether mergestate is active.
239 246
240 Returns True if there appears to be mergestate. This is a rough proxy 247 Returns True if there appears to be mergestate. This is a rough proxy