hgext3rd/evolve/utility.py
changeset 5314 f12d2172a133
parent 5311 77a77d0f5441
child 5315 c5020c7cdf74
equal deleted inserted replaced
5312:9035901412e6 5314:f12d2172a133
   124     if len(newer) > 1 or len(newer[0]) > 1:
   124     if len(newer) > 1 or len(newer[0]) > 1:
   125         raise MultipleSuccessorsError(newer)
   125         raise MultipleSuccessorsError(newer)
   126 
   126 
   127     return repo[newer[0][0]].rev()
   127     return repo[newer[0][0]].rev()
   128 
   128 
   129 def picksplitsuccessor(ui, repo, ctx, evolvecand):
   129 def pickorphantarget(ui, repo, targetancestors, evolvecand):
   130     """choose a successor of ctx from split targets
   130     """choose a new target for an orphan changeset
   131 
   131 
   132     Choose highest one if all successors are in a topological branch. And if
   132     Choose highest one if all successors of its ancestors are in a topological
   133     they are split over multiple topological branches, we ask user to choose
   133     branch. And if they are on different topological branches, we ask the user
   134     an evolve destination.
   134     to choose an evolve destination.
   135 
   135 
   136     Return (True, succ) unless split targets are split over multiple
   136     Return (True, succ) unless successors of ancestors are on different
   137     topological branches and user didn't choose any evolve destination,
   137     topological branches and user didn't choose any evolve destination, in
   138     in which case return (False, '.')
   138     which case return (False, '.').
   139     """
   139     """
   140     targets = obsutil.successorssets(repo, ctx.node())[0]
   140     heads = repo.revs(b'heads(%ln::%ln)', targetancestors, targetancestors)
   141     assert targets
       
   142     targetrevs = [repo[r].rev() for r in targets]
       
   143     heads = repo.revs(b'heads(%ld::%ld)', targetrevs, targetrevs)
       
   144     if len(heads) > 1:
   141     if len(heads) > 1:
   145         cheader = (_(b"ancestor of '%s' split over multiple topological"
   142         cheader = (_(b"successors of ancestors of %s are on different "
   146                      b" branches.\nchoose an evolve destination:") %
   143                      b"topological branches\nchoose an evolve destination:") %
   147                    evolvecand)
   144                    evolvecand)
   148         selectedrev = revselectionprompt(ui, repo, list(heads), cheader)
   145         selectedrev = revselectionprompt(ui, repo, list(heads), cheader)
   149         if selectedrev is None:
   146         if selectedrev is None:
   150             return (False, '.')
   147             return (False, '.')
   151         succ = repo[selectedrev]
   148         succ = repo[selectedrev]