21"""@type args: [str]""" 22iflen(args)!=1: 23raiseUsageError() 24 25name=args[0] 26app=config.app_mgr.lookup_app(name,missing_ok=False) 27history=app.get_history() 28 29ifnothistory: 30raiseSafeException(_("Invalid application: no selections found! Try '0install destroy {name}'").format(name=name)) 31 32importtime 33 34last_checked=app.get_last_checked() 35iflast_checkedisnotNone: 36print(_("Last checked : {date}").format(date=time.ctime(last_checked))) 37 38last_attempt=app.get_last_check_attempt() 39iflast_attemptisnotNone: 40print(_("Last attempted update: {date}").format(date=time.ctime(last_attempt))) 41 42print(_("Last update : {date}").format(date=history[0])) 43current_sels=app.get_selections(snapshot_date=history[0]) 44 45iflen(history)==1: 46print(_("No previous history to compare against.")) 47print(_("Use '0install select {name}' to see the current selections.").format(name=name)) 48return 49 50print(_("Previous update : {date}").format(date=history[1])) 51 52defget_selections_path(date): 53returnos.path.join(app.path,'selections-{date}.xml'.format(date=date))
54 55print() 56 57ifoptions.full: 58importdifflib,sys 59defload_lines(date): 60withopen(get_selections_path(date),'r')asstream: 61returnstream.readlines() 62old_lines=load_lines(history[1]) 63new_lines=load_lines(history[0]) 64forlineindifflib.unified_diff(old_lines,new_lines,fromfile=history[1],tofile=history[0]): 65sys.stdout.write(line) 66else: 67changes=show_changes(app.get_selections(snapshot_date=history[1]).selections,current_sels.selections) 68ifnotchanges: 69print(_("No changes to versions (use --full to see all changes).")) 70 71print() 72print(_("To run using the previous selections, use:")) 73print("0install run {path}".format(path=get_selections_path(history[1]))) 74