def do(args, unknown): rep = match_repo(args.repo) if rep == None: err("Unable to find repository '"+args.repo+"' locally. ") return False # Create a generated instance. gen = Generated(rep) if args.branch == None and not args.list and not args.status: err("Branch argument is required unless --list or --status is given. ") return False if args.install: return gen.install_branch(args.branch) if args.init: return gen.init_branch(args.branch) if args.pull: return gen.pull_branch(args.branch) if args.push: return gen.push_branch(args.branch) if args.list: for b in gen.get_all_branches(tuple=False): std(b) return True return gen.print_status()
def do(args, unknown): rep = match_repo(args.repo) if rep == None: err("Unable to find repository '" + args.repo + "' locally. ") return False # Create a generated instance. gen = Generated(rep) if args.branch == None and not args.list and not args.status: err("Branch argument is required unless --list or --status is given. ") return False if args.install: return gen.install_branch(args.branch) if args.init: return gen.init_branch(args.branch) if args.pull: return gen.pull_branch(args.branch) if args.push: return gen.push_branch(args.branch) if args.list: for b in gen.get_all_branches(tuple=False): std(b) return True return gen.print_status()
def do_pull(rep, needs_update): """ Actually pulls a repository. """ # pre-installation hook. std("Running pre-update hook for '" + rep + "' ... ", newline=False) if not hook_pre_pull(rep): err("Failed. ") return (False, []) std("Done. ") ret = True if needs_update: std("Running git pull ...") rgp = git_pull(match_repo(rep, abs=True)) ret = rgp and ret if rgp: std("OK") else: err("Failed (merge conflicts or network issues?)") ret = False else: std("Nothing to pull ...") std("Running post-update hook for '" + rep + "' ... ", newline=False) if not hook_post_pull(rep): err("Failed. ") return (False, []) std("Done. ") return ret
def do_pull(rep, needs_update): """ Actually pulls a repository. """ # pre-installation hook. std("Running pre-update hook for '"+rep+"' ... ", newline=False) if not hook_pre_pull(rep): err("Failed. ") return (False, []) std("Done. ") ret = True if needs_update: std("Running git pull ...") rgp = git_pull(match_repo(rep, abs=True)) ret = rgp and ret if rgp: std("OK") else: err("Failed (merge conflicts or network issues?)") ret = False else: std("Nothing to pull ...") std("Running post-update hook for '"+rep+"' ... ", newline=False) if not hook_post_pull(rep): err("Failed. ") return (False, []) std("Done. ") return ret
def write_deps(dirname, deps): """Writes dependencies into a given module. """ f = lmh_locate("content", match_repo(dirname), "META-INF", "MANIFEST.MF") n = re.sub(r"dependencies: (.*)", "dependencies: "+",".join(deps), read_file(f)) write_file(f, n) std("Wrote new dependencies to", f)
def calc_deps(repos, apply = False): """Crawls for dependencies in a given directory. """ # Match the repositories mrepos = [match_repo(r) for r in repos] # return each calculated dependency tree return [calc_deps_single(mr, apply = apply) for mr in mrepos]
def get_log(repo): get_format = lambda frm:git_do_data(repo, "log", "--pretty=format:"+frm+"")[0].split("\n") hash_short = get_format("%h") commit_titles = get_format("%s") dates = get_format("%at") dates_human = get_format("%ad") author_names = get_format("%an") author_mails = get_format("%ae") res = [{ "hash": hash_short[i], "subject": commit_titles[i], "date": int(dates[i]), "date_human": dates_human[i], "author": author_names[i], "author_mail": author_mails[i], "repo": match_repo(repo) } for i in range(len(hash_short))] return res
def needs_updating(rep): rep = match_repo(rep, abs=True) if verbose: return True state = get_remote_status(rep) return state == "pull" or state == "failed" or state == "divergence"