##// END OF EJS Templates
rebase: rewrite _computeobsoletenotrebased...
Jun Wu -
r34005:ba9d5d48 default
parent child Browse files
Show More
@@ -1484,31 +1484,24 b' def _computeobsoletenotrebased(repo, reb'
1484 obsolete => None entries in the mapping indicate nodes with no successor"""
1484 obsolete => None entries in the mapping indicate nodes with no successor"""
1485 obsoletenotrebased = {}
1485 obsoletenotrebased = {}
1486
1486
1487 # Build a mapping successor => obsolete nodes for the obsolete
1487 cl = repo.unfiltered().changelog
1488 # nodes to be rebased
1488 nodemap = cl.nodemap
1489 allsuccessors = {}
1489 destnode = cl.node(dest)
1490 cl = repo.changelog
1490 for srcrev in rebaseobsrevs:
1491 for r in rebaseobsrevs:
1491 srcnode = cl.node(srcrev)
1492 node = cl.node(r)
1492 # XXX: more advanced APIs are required to handle split correctly
1493 for s in obsutil.allsuccessors(repo.obsstore, [node]):
1493 successors = list(obsutil.allsuccessors(repo.obsstore, [srcnode]))
1494 try:
1494 if len(successors) == 1:
1495 allsuccessors[cl.rev(s)] = cl.rev(node)
1495 # obsutil.allsuccessors includes node itself. When the list only
1496 except LookupError:
1496 # contains one element, it means there are no successors.
1497 pass
1497 obsoletenotrebased[srcrev] = None
1498
1498 else:
1499 if allsuccessors:
1499 for succnode in successors:
1500 # Look for successors of obsolete nodes to be rebased among
1500 if succnode == srcnode or succnode not in nodemap:
1501 # the ancestors of dest
1501 continue
1502 ancs = cl.ancestors([dest],
1502 if cl.isancestor(succnode, destnode):
1503 stoprev=min(allsuccessors),
1503 obsoletenotrebased[srcrev] = nodemap[succnode]
1504 inclusive=True)
1504 break
1505 for s in allsuccessors:
1506 if s in ancs:
1507 obsoletenotrebased[allsuccessors[s]] = s
1508 elif (s == allsuccessors[s] and
1509 allsuccessors.values().count(s) == 1):
1510 # plain prune
1511 obsoletenotrebased[s] = None
1512
1505
1513 return obsoletenotrebased
1506 return obsoletenotrebased
1514
1507
General Comments 0
You need to be logged in to leave comments. Login now