Esempio n. 1
0
def _main():

    log = logging.getLogger(name="dls_ade")
    usermsg = logging.getLogger(name="usermessages")

    parser = make_parser()
    args = parser.parse_args()

    log.info(json.dumps({'CLI': sys.argv, 'options_args': vars(args)}))

    if args.module_name == "":
        answer = input("Would you like to checkout the whole " + args.area +
                       " area? This may take some time. Enter Y or N: ")
        if answer.upper() != "Y":
            return

    check_technical_area(args.area, args.module_name)

    module = args.module_name

    server = Server()

    if module == "":
        # Set source to area folder
        source = server.dev_area_path(args.area)
    else:
        # Set source to module in area folder
        source = server.dev_module_path(module, args.area)

    if module == "":
        usermsg.info("Checking out entire {} area".format(args.area))
        server.clone_multi(source)
    elif module.endswith('/') and args.area == 'ioc':
        usermsg.info("Checking out {} technical area...".format(module))

        source = server.dev_group_path(module, args.area)

        server.clone_multi(source)
    else:
        usermsg.info("Checking out {module} from {area}".format(
            module=module, area=args.area))
        vcs = server.clone(source, module)

        if args.branch:
            # Get branches list
            branches = vcs_git.list_remote_branches(vcs.repo)
            if args.branch in branches:
                vcs_git.checkout_remote_branch(args.branch, vcs.repo)
            else:
                # Invalid branch name, print branches list and exit
                usermsg.info("Branch '{branch}' does not exist in {source}. "
                             "Leaving clone on default branch. "
                             "Branch List: {branchlist}".format(
                                 branch=args.branch,
                                 source=source,
                                 branchlist=str(branches)))

        vcs_git.add_remotes(vcs.repo, module)
Esempio n. 2
0
def main():

    parser = make_parser()
    args = parser.parse_args()

    pathf.check_technical_area(args.area, args.module_name)

    source = pathf.dev_module_path(args.module_name, args.area)

    print("Branches of " + args.module_name + ":\n")

    repo = vcs_git.temp_clone(source)

    branches = vcs_git.list_remote_branches(repo)
    for branch in branches:
        print(branch)
    print("")

    shutil.rmtree(repo.working_tree_dir)
def main():

    parser = make_parser()
    args = parser.parse_args()

    if args.module_name == "":
        answer = raw_input("Would you like to checkout the whole " +
                           args.area + " area? This may take some time. Enter Y or N: ")
        if answer.upper() != "Y":
            return

    check_technical_area(args.area, args.module_name)

    module = args.module_name

    if module == "":
        # Set source to area folder
        source = pathf.dev_area_path(args.area)
    else:
        # Set source to module in area folder
        source = pathf.dev_module_path(module, args.area)

    if module == "":
        print("Checking out entire " + args.area + " area...\n")
        vcs_git.clone_multi(source)
    elif module.endswith('/') and args.area == 'ioc':
        print("Checking out " + module + " technical area...")
        vcs_git.clone_multi(source)
    else:
        print("Checking out " + module + " from " + args.area + " area...")
        repo = vcs_git.clone(source, module)

        if args.branch:
            # Get branches list
            branches = vcs_git.list_remote_branches(repo)
            if args.branch in branches:
                vcs_git.checkout_remote_branch(args.branch, repo)
            else:
                # Invalid branch name, print branches list and exit
                print("Branch '" + args.branch + "' does not exist in " + source +
                      "\nBranch List:\n")
                for entry in branches:
                    print(entry)
Esempio n. 4
0
def _main():
    log = logging.getLogger(name="dls_ade")
    usermsg = logging.getLogger(name="usermessages")
    output = logging.getLogger(name="output")

    parser = make_parser()
    args = parser.parse_args()

    log.info(json.dumps({'CLI': sys.argv, 'options_args': vars(args)}))

    check_technical_area(args.area, args.module_name)

    server = Server()

    source = server.dev_module_path(args.module_name, args.area)

    vcs = server.temp_clone(source)

    branches = vcs_git.list_remote_branches(vcs.repo)
    usermsg.info("Branches of {module}:".format(module=source))
    output.info("{branches}".format(branches=", ".join(branches)))

    shutil.rmtree(vcs.repo.working_tree_dir)