comparison mercurial/context.py @ 21125:e94e90a4526e

context: tell when .ancestor picks one of multiple common ancestors heads Show a message like note: using 0f6b37dbe527 as ancestor of adfe50279922 and cf89f02107e5 So far this is just a warning - there is nothing the user can do to select another ancestor.
author Mads Kiilerich <madski@unity3d.com>
date Thu, 17 Apr 2014 17:32:04 +0200
parents a63958bcf63a
children 99b5eaf372a7
comparison
equal deleted inserted replaced
21124:a65714215377 21125:e94e90a4526e
400 """ 400 """
401 # deal with workingctxs 401 # deal with workingctxs
402 n2 = c2._node 402 n2 = c2._node
403 if n2 is None: 403 if n2 is None:
404 n2 = c2._parents[0]._node 404 n2 = c2._parents[0]._node
405 n = self._repo.changelog.ancestor(self._node, n2) 405 cahs = self._repo.changelog.commonancestorsheads(self._node, n2)
406 return changectx(self._repo, n) 406 if not cahs:
407 anc = nullid
408 elif len(cahs) == 1:
409 anc = cahs[0]
410 else:
411 anc = self._repo.changelog.ancestor(self._node, n2)
412 self._repo.ui.status(
413 (_("note: using %s as ancestor of %s and %s\n") %
414 (short(anc), short(self._node), short(n2))))
415 return changectx(self._repo, anc)
407 416
408 def descendant(self, other): 417 def descendant(self, other):
409 """True if other is descendant of this changeset""" 418 """True if other is descendant of this changeset"""
410 return self._repo.changelog.descendant(self._rev, other._rev) 419 return self._repo.changelog.descendant(self._rev, other._rev)
411 420