equal
deleted
inserted
replaced
427 def ancestor(self, a, b): |
427 def ancestor(self, a, b): |
428 if a == nullid or b == nullid: |
428 if a == nullid or b == nullid: |
429 return nullid |
429 return nullid |
430 |
430 |
431 revmap, parentfunc = self._buildrevgraph(a, b) |
431 revmap, parentfunc = self._buildrevgraph(a, b) |
432 nodemap = dict(((v, k) for (k, v) in pycompat.iteritems(revmap))) |
432 nodemap = {v: k for (k, v) in pycompat.iteritems(revmap)} |
433 |
433 |
434 ancs = ancestor.ancestors(parentfunc, revmap[a], revmap[b]) |
434 ancs = ancestor.ancestors(parentfunc, revmap[a], revmap[b]) |
435 if ancs: |
435 if ancs: |
436 # choose a consistent winner when there's a tie |
436 # choose a consistent winner when there's a tie |
437 return min(map(nodemap.__getitem__, ancs)) |
437 return min(map(nodemap.__getitem__, ancs)) |
442 |
442 |
443 if a == nullid or b == nullid: |
443 if a == nullid or b == nullid: |
444 return nullid |
444 return nullid |
445 |
445 |
446 revmap, parentfunc = self._buildrevgraph(a, b) |
446 revmap, parentfunc = self._buildrevgraph(a, b) |
447 nodemap = dict(((v, k) for (k, v) in pycompat.iteritems(revmap))) |
447 nodemap = {v: k for (k, v) in pycompat.iteritems(revmap)} |
448 |
448 |
449 ancs = ancestor.commonancestorsheads(parentfunc, revmap[a], revmap[b]) |
449 ancs = ancestor.commonancestorsheads(parentfunc, revmap[a], revmap[b]) |
450 return map(nodemap.__getitem__, ancs) |
450 return map(nodemap.__getitem__, ancs) |
451 |
451 |
452 def _buildrevgraph(self, a, b): |
452 def _buildrevgraph(self, a, b): |