##// END OF EJS Templates
transplant: convert applied() algorithm from nodes to revs...
Joshua Redstone -
r17010:a6c64211 default
parent child Browse files
Show More
@@ -89,24 +89,21 b' class transplanter(object):'
89
89
90 def applied(self, repo, node, parent):
90 def applied(self, repo, node, parent):
91 '''returns True if a node is already an ancestor of parent
91 '''returns True if a node is already an ancestor of parent
92 or has already been transplanted'''
92 or is parent or has already been transplanted'''
93 if hasnode(repo, parent):
94 parentrev = repo.changelog.rev(parent)
93 if hasnode(repo, node):
95 if hasnode(repo, node):
94 reachablerevs = repo.changelog.incancestors(
96 rev = repo.changelog.rev(node)
95 [repo.changelog.rev(parent)],
97 reachable = repo.changelog.incancestors([parentrev], rev)
96 stoprev=repo.changelog.rev(node))
98 if rev in reachable:
97 reachable = (repo.changelog.node(rev) for rev in reachablerevs)
98 if node in reachable:
99 return True
99 return True
100 for t in self.transplants.get(node):
100 for t in self.transplants.get(node):
101 # it might have been stripped
101 # it might have been stripped
102 if not hasnode(repo, t.lnode):
102 if not hasnode(repo, t.lnode):
103 self.transplants.remove(t)
103 self.transplants.remove(t)
104 return False
104 return False
105 reachablerevs = repo.changelog.incancestors(
105 lnoderev = repo.changelog.rev(t.lnode)
106 [repo.changelog.rev(parent)],
106 if lnoderev in repo.changelog.incancestors([parentrev], lnoderev):
107 stoprev=repo.changelog.rev(t.lnode))
108 reachable = (repo.changelog.node(rev) for rev in reachablerevs)
109 if t.lnode in reachable:
110 return True
107 return True
111 return False
108 return False
112
109
General Comments 0
You need to be logged in to leave comments. Login now