def print_subproject(project, sp, padder): blue_print(" {1}-> {2:<{0}s}".format(30 - len(padder) - 2, padder, sp.name)) project.print_submodule_status(sp) print() for ssp in sp.subs: print_subproject(project, ssp, padder + " ")
def status(args=None): projects = list_projects(False, args.dir) if args.parallel_fetch and not args.fetch: print("Warning: -p has no effect without -f") if args.parallel_fetch and not args.j: print("Warning: -p has no effect without -j") if args.fetch: print("Fetch in progres...") if args.j: pool = Pool(args.j) def worker(p): p.cache(args.submodule) if args.parallel_fetch: p.fetch_all() if args.submodule: p.fetch_submodules() for p in projects: pool.apply_async(worker, (p,)) pool.close() pool.join() if args.fetch and not (args.j and args.parallel_fetch): for p in projects: p.fetch_all() if args.submodule: p.fetch_submodules() if args.fetch: print("Fetch done") for p in projects: print(p.name) print(" ", end="") blue_print("{0:<30s}".format(p.branch())) p.print_status() print("") if args.submodule: for sub in p.subprojects(): print_subproject(p, sub, " ") for branch in p.branches(): if branch == p.branch(): continue print(" ", end="") cyan_print("{0:<30s}".format(branch)) remote_branch = "origin/" + branch if not p.remote_branch_exist(remote_branch): red_print("No remote branch {}".format(remote_branch)) else: local_hash = p.hash(branch) remote_hash = p.hash(remote_branch) if local_hash == remote_hash: green_print("Clean") else: red_print("{} not in sync with {}" .format(branch, remote_branch)) print("") print("")