def pull_subs(path): subs = fsquery.makecontentlist(path, True, False, False, True, False, None) subs = filter_sub_files(subs) report = [] anyfailed = False for s in subs: rs = git_repo_query.get_remotes(s) bs = git_repo_query.get_branches(s) af, r = git_pull.do_pull(s, rs, bs) anyfailed |= af report += r print(os.linesep) for rp in report: print(rp) print(os.linesep) if anyfailed: print("%sErrors detected, see above.%s" % (terminal_colors.TTY_RED, terminal_colors.TTY_WHITE)) else: print("%sAll succeeded.%s" % (terminal_colors.TTY_GREEN, terminal_colors.TTY_WHITE))
def visitor_fetch(repos, options): ORIGINAL_COLOR = terminal_colors.get_standard_color() report = [] all_passed = True for rp in repos: remotes = git_repo_query.get_remotes(rp) remotes = git_visitor_base.filter_remotes(remotes, options) if remotes is None: report.append("%s%s: Failed filtering remotes.%s" % (terminal_colors.TTY_RED, rp, ORIGINAL_COLOR)) continue op_piece, report_piece = git_fetch.do_fetch(rp, remotes) all_passed = all_passed and (not op_piece) for ri in report_piece: report.append(ri) git_visitor_base.print_report(all_passed, report) return all_passed
def visitor_remote_refactor(repos, options): report = [] all_passed = True for rp in repos: remotes = git_repo_query.get_remotes(rp) if remotes is None: continue for rmn in remotes: for rmop in remotes[rmn]: diff, new_url = change_path(rp, rmn, rmop, remotes[rmn][rmop]) if diff: op_piece, report_piece = git_remote.remote_change_url(rp, rmn, rmop, new_url) all_passed = all_passed and (not op_piece) report.append(report_piece) git_visitor_base.print_report(all_passed, report) return all_passed
def apply_filters(repo, options): """ apply_filters on success, returns filtered remotes and branches on failure, raises gvbexcept with detail msg """ remotes = git_repo_query.get_remotes(repo) if remotes is None: raise gvbexcept("No remotes detected") remotes = filter_remotes(remotes, options) if remotes is None: raise gvbexcept("Failed filtering remotes") branches = git_repo_query.get_branches(repo) if branches is None: raise gvbexcept("No branches detected") branches = filter_branches(branches, options) if branches is None: raise gvbexcept("Failed filtering branches") return remotes, branches