Mercurial > public > mercurial-scm > hg-stable
comparison mercurial/revlog.py @ 21104:40ace21cb3a1
revlog: introduce commonancestorsheads method
Very similar to commonancestors but giving all the common ancestors heads.
author | Mads Kiilerich <madski@unity3d.com> |
---|---|
date | Thu, 17 Apr 2014 20:01:35 +0200 |
parents | 774ff56cbe34 |
children | 4a6c8b6b10d3 |
comparison
equal
deleted
inserted
replaced
21103:628c16489d1c | 21104:40ace21cb3a1 |
---|---|
732 return True | 732 return True |
733 elif i > end: | 733 elif i > end: |
734 break | 734 break |
735 return False | 735 return False |
736 | 736 |
737 def commonancestorsheads(self, a, b): | |
738 """calculate all the heads of the common ancestors of nodes a and b""" | |
739 a, b = self.rev(a), self.rev(b) | |
740 try: | |
741 ancs = self.index.commonancestorsheads(a, b) | |
742 except (AttributeError, OverflowError): # C implementation failed | |
743 ancs = ancestor.commonancestorsheads(self.parentrevs, a, b) | |
744 return map(self.node, ancs) | |
745 | |
737 def commonancestors(self, a, b): | 746 def commonancestors(self, a, b): |
738 """calculate the least common ancestors of nodes a and b""" | 747 """calculate the least common ancestors of nodes a and b""" |
739 a, b = self.rev(a), self.rev(b) | 748 a, b = self.rev(a), self.rev(b) |
740 try: | 749 try: |
741 ancs = self.index.ancestors(a, b) | 750 ancs = self.index.ancestors(a, b) |