Exemple #1
0
def get_tipID():
    if os.path.isdir('jenkins-regression-tests'):
        print("Repository exist...!!!")
        with ut.ChDir('jenkins-regression-tests'):
            print("Getting repository ID...")
            tip_id = subprocess.run(['hg', 'id', '-i'], stdout=subprocess.PIPE)
            tipid_str = tip_id.stdout.decode('utf-8')
    return tipid_str
Exemple #2
0
def updateRepo(changesetID):
    if os.path.isdir('jenkins-regression-tests'):
        print("Repository exist...!!!")
        with ut.ChDir('jenkins-regression-tests'):
            print("Getting repository updated to ... ", changesetID)
            baseid = subprocess.run(['hg', 'up', '-C', changesetID],
                                    stdout=subprocess.PIPE)
            baseid_str = baseid.stdout.decode('utf-8')
            print(baseid_str)
Exemple #3
0
def set_baselineID():
    if os.path.isdir('jenkins-regression-tests'):
        print("Repository exist...!!!")
        with ut.ChDir('jenkins-regression-tests'):
            print("Getting repository ID...")
            baseid = subprocess.run(['hg', 'id', '-i'], stdout=subprocess.PIPE)
            baseid_str = baseid.stdout.decode('utf-8')
    if os.path.exists(baselinefile):
        os.remove(baselinefile)
    basef = open(baselinefile, 'a')
    basef.write(baseid_str)
Exemple #4
0
def get_changeset_list(repo, base, tip):

    with ut.ChDir(repo):
        run_cmd = subprocess.Popen(
            ['hg', 'log', '-r', base + ':' + tip, '--template', b'{node} '],
            stdout=subprocess.PIPE)
        run_cmd.wait()
        ids, _ = run_cmd.communicate()
        ids_list = str(ids, 'utf-8').split(' ')

    return ids_list
Exemple #5
0
def clone_jrt_repo():
    # Checks if the repo is already cloned else clone
    if os.path.isdir('jenkins-regression-tests'):
        print("Repository exist...!!!")
        with ut.ChDir('jenkins-regression-tests'):
            print("Getting repository update...")
            cmd = ' hg pull --quiet && hg up -C --quiet'
            ret_st = os.system(cmd)
            if ret_st:
                print("Error: Cannot pull/update repo")
                sys.exit(-1)
    else:
        print("Repository not exist...!!!")
        print("Cloning repository...")
        cmd = 'hg clone https://bitbucket.org/uhnder/jenkins-regression-tests' + ' --quiet'
        ret_st = os.system(cmd)
        if ret_st:
            print("Error: Cannot clone repo")
            sys.exit(-1)
Exemple #6
0
def get_repo_log(repo, changeset):

    with ut.ChDir(repo):
        run_cmd = subprocess.Popen(
            ['hg', 'log', '-r', changeset, '--template', b'{file_adds}'],
            stdout=subprocess.PIPE)
        run_cmd.wait()
        files_adds, _ = run_cmd.communicate()
        files_added_list = str(files_adds, 'utf-8').split(' ')
        # print("Files Added: ")
        # for eachfile in files_added_list:
        # 	print(eachfile)

        run_cmd = subprocess.Popen(
            ['hg', 'log', '-r', changeset, '--template', b'{file_mods}'],
            stdout=subprocess.PIPE)
        run_cmd.wait()
        files_mods, _ = run_cmd.communicate()
        files_modified_list = str(files_mods, 'utf-8').split(' ')
        # print("Files Modified: ")
        # for eachfile in files_modified_list:
        # 	print(eachfile)
        run_cmd = subprocess.Popen(
            ['hg', 'log', '-r', changeset, '--template', b'{author}'],
            stdout=subprocess.PIPE)
        run_cmd.wait()
        committer, _ = run_cmd.communicate()
        commit_author = str(committer, 'utf-8')

        run_cmd = subprocess.Popen(
            ['hg', 'log', '-r', changeset, '--template', b'{rev}'],
            stdout=subprocess.PIPE)
        run_cmd.wait()
        build_number, _ = run_cmd.communicate()
        build = str(build_number, 'utf-8')

        author_email = extractEmail(commit_author)
        author_name = extractAuthor(commit_author)

    return files_added_list + files_modified_list, author_name, author_email, build