Exemple #1
0
def ls(args=None):
    if not args.non_scm_only:
        projects = list_projects(args.all, args.dir)
    else:
        all = list_projects(True, args.dir)
        git = list_projects(False, args.dir)

        projects = list(set(all) - set(git))

    for p in projects:
        print("{} (scm:{})".format(p.name, p.scm))

    print("")
    print("{} projects".format(len(projects)))
Exemple #2
0
def update(args=None):
    projects = list_projects(False, args.dir)

    print("Update in progress...")

    if args.j:
        pool = Pool(args.j)

        def worker(p):
            if p.is_behind():
                p.update()
                print("{} updated".format(p.name))

        for p in projects:
            pool.apply_async(worker, (p,))

        pool.close()
        pool.join()
    else:
        for p in projects:
            if p.is_behind():
                p.update()
                print("{} updated".format(p.name))

    print("Update done")
Exemple #3
0
def fetch(args=None):
    projects = list_projects(False, args.dir)

    print("Fetch in progres...")

    if args.j:
        pool = Pool(args.j)

        def worker(p):
            p.fetch_all()

        for p in projects:
            pool.apply_async(worker, (p,))

        pool.close()
        pool.join()
    else:
        for p in projects:
            p.fetch_all()

    print("Fetch done")
Exemple #4
0
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("")