Mercurial > public > mercurial-scm > hg
comparison mercurial/revlog.py @ 3139:1fd1cdcc4200
Switch revlog.ancestor to use revisions rather than nodeids
author | Matt Mackall <mpm@selenic.com> |
---|---|
date | Thu, 21 Sep 2006 18:15:44 -0500 |
parents | b1db258e875c |
children | d01e4cb2f5f2 |
comparison
equal
deleted
inserted
replaced
3138:cc856c4d91ca | 3139:1fd1cdcc4200 |
---|---|
1014 return node | 1014 return node |
1015 | 1015 |
1016 def ancestor(self, a, b): | 1016 def ancestor(self, a, b): |
1017 """calculate the least common ancestor of nodes a and b""" | 1017 """calculate the least common ancestor of nodes a and b""" |
1018 | 1018 |
1019 def parents(node): | 1019 def parents(rev): |
1020 return [p for p in self.parents(node) if p != nullid] | 1020 return [p for p in self.parentrevs(rev) if p != -1] |
1021 | 1021 |
1022 return ancestor.ancestor(a, b, parents) or nullid | 1022 c = ancestor.ancestor(self.rev(a), self.rev(b), parents) |
1023 if c is None: | |
1024 return nullid | |
1025 | |
1026 return self.node(c) | |
1023 | 1027 |
1024 def group(self, nodelist, lookup, infocollect=None): | 1028 def group(self, nodelist, lookup, infocollect=None): |
1025 """calculate a delta group | 1029 """calculate a delta group |
1026 | 1030 |
1027 Given a list of changeset revs, return a set of deltas and | 1031 Given a list of changeset revs, return a set of deltas and |