Mercurial > hg-stable
comparison mercurial/merge.py @ 44289:b1069b369d6e
mergestate: add accessors for local and other nodeid, not just contexts
The mergestate can contain invalid nodeids. In that case,
`mergestate.localctx` or `mergestate.otherctx` will fail. This patch
provides a way of accessing the nodeid without failing in such cases.
Differential Revision: https://phab.mercurial-scm.org/D8040
author | Martin von Zweigbergk <martinvonz@google.com> |
---|---|
date | Wed, 29 Jan 2020 11:30:16 -0800 |
parents | cb8b67016110 |
children | f546d2170b0f |
comparison
equal
deleted
inserted
replaced
44288:3d2de64c49d2 | 44289:b1069b369d6e |
---|---|
384 ) | 384 ) |
385 | 385 |
386 return configmergedriver | 386 return configmergedriver |
387 | 387 |
388 @util.propertycache | 388 @util.propertycache |
389 def local(self): | |
390 if self._local is None: | |
391 msg = b"local accessed but self._local isn't set" | |
392 raise error.ProgrammingError(msg) | |
393 return self._local | |
394 | |
395 @util.propertycache | |
389 def localctx(self): | 396 def localctx(self): |
390 if self._local is None: | 397 return self._repo[self.local] |
391 msg = b"localctx accessed but self._local isn't set" | 398 |
399 @util.propertycache | |
400 def other(self): | |
401 if self._other is None: | |
402 msg = b"other accessed but self._other isn't set" | |
392 raise error.ProgrammingError(msg) | 403 raise error.ProgrammingError(msg) |
393 return self._repo[self._local] | 404 return self._other |
394 | 405 |
395 @util.propertycache | 406 @util.propertycache |
396 def otherctx(self): | 407 def otherctx(self): |
397 if self._other is None: | 408 return self._repo[self.other] |
398 msg = b"otherctx accessed but self._other isn't set" | |
399 raise error.ProgrammingError(msg) | |
400 return self._repo[self._other] | |
401 | 409 |
402 def active(self): | 410 def active(self): |
403 """Whether mergestate is active. | 411 """Whether mergestate is active. |
404 | 412 |
405 Returns True if there appears to be mergestate. This is a rough proxy | 413 Returns True if there appears to be mergestate. This is a rough proxy |