<s> from __future__ import print_function <EOL> import sys <EOL> from command import Command <EOL> from git_command import git <EOL> from progress import Progress <EOL> class Abandon ( Command ) : <EOL> common = True <EOL> helpSummary = "<STR_LIT>" <EOL> helpUsage = """<STR_LIT>""" <EOL> def Execute ( self , opt , args ) : <EOL> if not args : <EOL> self . Usage ( ) <EOL> nb = args [ <NUM_LIT:0> ] <EOL> if not git . check_ref_format ( '<STR_LIT>' % nb ) : <EOL> print ( "<STR_LIT>" % nb , file = sys . stderr ) <EOL> sys . exit ( <NUM_LIT:1> ) <EOL> nb = args [ <NUM_LIT:0> ] <EOL> err = [ ] <EOL> success = [ ] <EOL> all_projects = self . GetProjects ( args [ <NUM_LIT:1> : ] ) <EOL> pm = Progress ( '<STR_LIT>' % nb , len ( all_projects ) ) <EOL> for project in all_projects : <EOL> pm . update ( ) <EOL> status = project . AbandonBranch ( nb ) <EOL> if status is not None : <EOL> if status : <EOL> success . append ( project ) <EOL> else : <EOL> err . append ( project ) <EOL> pm . end ( ) <EOL> if err : <EOL> for p in err : <EOL> print ( "<STR_LIT>" % ( p . relpath , nb ) , <EOL> file = sys . stderr ) <EOL> sys . exit ( <NUM_LIT:1> ) <EOL> elif not success : <EOL> print ( '<STR_LIT>' % nb , file = sys . stderr ) <EOL> sys . exit ( <NUM_LIT:1> ) <EOL> else : <EOL> print ( '<STR_LIT>' <EOL> % ( len ( success ) , '<STR_LIT>' . join ( p . relpath for p in success ) ) , <EOL> file = sys . stderr ) </s>
