def cache_update(cmode, ignore_error): dotrc = Glo.dot_buildc_rc_path() if not os.path.exists(dotrc): print 'Can not found ' + dotrc print 'Please run buildc init and then config .buildc.rc!' sys.exit(Errors.conf_file_not_found) dotrepository = Glo.dot_buildc_repository_path() buildc_rc = Load.load_dot_buildc_rc(dotrc) cache_svn_tree = CacheSvnTree(buildc_rc.external_repositories) cache_svn_tree.import_format_tree_from_file(dotrepository) result = cache_svn_tree.check_tree_consistency() if result == False: return False result = cache_svn_tree.is_new_tree(None) if result == True: print "Warning: local cache does not need to be updated." return False cache_svn_tree.update_tree(None, cmode, ignore_error) cache_svn_tree.export_format_tree_to_file(dotrepository)
def check_consistency(): dotrc = Glo.dot_buildc_rc_path() if not os.path.exists(dotrc): print 'Can not found ~/.buildc.rc!' print 'Please run buildc init to generate this file!' sys.exit(Errors.conf_file_not_found) dotrepository = Glo.dot_buildc_repository_path() buildc_rc = Load.load_dot_buildc_rc(dotrc) cache_svn_tree = CacheSvnTree(buildc_rc.external_repositories) cache_svn_tree.import_format_tree_from_file(dotrepository) result = cache_svn_tree.check_tree_consistency() if result == False: return False