hgext/transplant.py
changeset 17009 0c18aed2fcca
parent 16991 1aae34f109fd
child 17010 a6c64211acdb
equal deleted inserted replaced
17008:553e8f5aba7a 17009:0c18aed2fcca
    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 has already been transplanted'''
    93         if hasnode(repo, node):
    93         if hasnode(repo, node):
    94             if node in repo.changelog.reachable(parent, stop=node):
    94             reachablerevs = repo.changelog.incancestors(
       
    95                 [repo.changelog.rev(parent)],
       
    96                 stoprev=repo.changelog.rev(node))
       
    97             reachable = (repo.changelog.node(rev) for rev in reachablerevs)
       
    98             if node in reachable:
    95                 return True
    99                 return True
    96         for t in self.transplants.get(node):
   100         for t in self.transplants.get(node):
    97             # it might have been stripped
   101             # it might have been stripped
    98             if not hasnode(repo, t.lnode):
   102             if not hasnode(repo, t.lnode):
    99                 self.transplants.remove(t)
   103                 self.transplants.remove(t)
   100                 return False
   104                 return False
   101             if t.lnode in repo.changelog.reachable(parent, stop=t.lnode):
   105             reachablerevs = repo.changelog.incancestors(
       
   106                 [repo.changelog.rev(parent)],
       
   107                 stoprev=repo.changelog.rev(t.lnode))
       
   108             reachable = (repo.changelog.node(rev) for rev in reachablerevs)
       
   109             if t.lnode in reachable:
   102                 return True
   110                 return True
   103         return False
   111         return False
   104 
   112 
   105     def apply(self, repo, source, revmap, merges, opts={}):
   113     def apply(self, repo, source, revmap, merges, opts={}):
   106         '''apply the revisions in revmap one by one in revision order'''
   114         '''apply the revisions in revmap one by one in revision order'''