@ -2745,29 +2745,39 @@ class Britney(object):
so the ones with most reverse dependencies are at the end of the loop .
so the ones with most reverse dependencies are at the end of the loop .
If an action depends on another one , it is put after it .
If an action depends on another one , it is put after it .
"""
"""
upgrade_me = [ x . name for x in self . excuses if x . name in [ y . uvname for y in self . upgrade_me ] ]
uvnames = frozenset ( y . uvname for y in self . upgrade_me )
for e in self . excuses :
excuses = [ e for e in self . excuses if e . name in uvnames ]
if e . name not in upgrade_me : continue
removals = [ ]
# try removes at the end of the loop
upgrade_me = [ ]
elif e . name [ 0 ] == ' - ' :
upgrade_me . remove ( e . name )
for e in excuses :
upgrade_me . append ( e . name )
# We order removals and regular migrations differently, so
# otherwise, put it in a good position checking its dependencies
# split them out early.
if e . name [ 0 ] == ' - ' :
removals . append ( e . name )
else :
else :
pos = [ ]
upgrade_me . append ( e . name )
udeps = [ upgrade_me . index ( x ) for x in e . deps if x in upgrade_me and x != e . name ]
if len ( udeps ) > 0 :
for e in excuses :
pos . append ( max ( udeps ) )
# put the item (regular migration) in a good position
sdeps = [ upgrade_me . index ( x ) for x in e . sane_deps if x in upgrade_me and x != e . name ]
# checking its dependencies
if len ( sdeps ) > 0 :
pos = [ ]
pos . append ( min ( sdeps ) )
udeps = [ upgrade_me . index ( x ) for x in e . deps if x in upgrade_me and x != e . name ]
if len ( pos ) == 0 : continue
if udeps :
upgrade_me . remove ( e . name )
pos . append ( max ( udeps ) )
upgrade_me . insert ( max ( pos ) + 1 , e . name )
sdeps = [ upgrade_me . index ( x ) for x in e . sane_deps if x in upgrade_me and x != e . name ]
self . dependencies [ e . name ] = e . deps
if sdeps :
pos . append ( min ( sdeps ) )
if not pos :
continue
upgrade_me . remove ( e . name )
upgrade_me . insert ( max ( pos ) + 1 , e . name )
self . dependencies [ e . name ] = e . deps
# replace the list of actions with the new one
# replace the list of actions with the new one
self . upgrade_me = [ make_migrationitem ( x , self . sources ) for x in upgrade_me ]
self . upgrade_me = [ make_migrationitem ( x , self . sources ) for x in upgrade_me ]
self . upgrade_me . extend ( make_migrationitem ( x , self . sources ) for x in removals )
def auto_hinter ( self ) :
def auto_hinter ( self ) :
""" Auto-generate " easy " hints.
""" Auto-generate " easy " hints.