comparison hgext/rebase.py @ 35994:ae0d25071fca

rebase: eliminate node from successors early in _computeobsoletenotrebased()
author Denis Laxalde <denis@laxalde.org>
date Fri, 09 Feb 2018 21:45:16 +0100
parents 3d8b0020f470
children b7e2cf114e85
comparison
equal deleted inserted replaced
35993:a603a570cdbe 35994:ae0d25071fca
1796 for srcrev in rebaseobsrevs: 1796 for srcrev in rebaseobsrevs:
1797 srcnode = cl.node(srcrev) 1797 srcnode = cl.node(srcrev)
1798 destnode = cl.node(destmap[srcrev]) 1798 destnode = cl.node(destmap[srcrev])
1799 # XXX: more advanced APIs are required to handle split correctly 1799 # XXX: more advanced APIs are required to handle split correctly
1800 successors = list(obsutil.allsuccessors(repo.obsstore, [srcnode])) 1800 successors = list(obsutil.allsuccessors(repo.obsstore, [srcnode]))
1801 if len(successors) == 1: 1801 # obsutil.allsuccessors includes node itself
1802 # obsutil.allsuccessors includes node itself. When the list only 1802 successors.remove(srcnode)
1803 # contains one element, it means there are no successors. 1803 if not successors:
1804 # no successor
1804 obsoletenotrebased[srcrev] = None 1805 obsoletenotrebased[srcrev] = None
1805 else: 1806 else:
1806 for succnode in successors: 1807 for succnode in successors:
1807 if succnode == srcnode or succnode not in nodemap: 1808 if succnode not in nodemap:
1808 continue 1809 continue
1809 if cl.isancestor(succnode, destnode): 1810 if cl.isancestor(succnode, destnode):
1810 obsoletenotrebased[srcrev] = nodemap[succnode] 1811 obsoletenotrebased[srcrev] = nodemap[succnode]
1811 break 1812 break
1812 else: 1813 else:
1813 # If 'srcrev' has a successor in rebase set but none in 1814 # If 'srcrev' has a successor in rebase set but none in
1814 # destination (which would be catched above), we shall skip it 1815 # destination (which would be catched above), we shall skip it
1815 # and its descendants to avoid divergence. 1816 # and its descendants to avoid divergence.
1816 if any(nodemap[s] in destmap 1817 if any(nodemap[s] in destmap for s in successors):
1817 for s in successors if s != srcnode):
1818 obsoletewithoutsuccessorindestination.add(srcrev) 1818 obsoletewithoutsuccessorindestination.add(srcrev)
1819 1819
1820 return obsoletenotrebased, obsoletewithoutsuccessorindestination 1820 return obsoletenotrebased, obsoletewithoutsuccessorindestination
1821 1821
1822 def summaryhook(ui, repo): 1822 def summaryhook(ui, repo):