def get_git_line_counts(testsubmition, startrevison, endrevison): scm_info = CodeCommitLogService.get_git_scminfo( testsubmition.TPSProductName) scm_local_file_path = scm_info.localdir + CommonHelper.get_slash( ) + str(time.time()) + ".log" git_helper = GitHelper( "", scm_info.localdir + CommonHelper.get_slash() + ".git", scm_local_file_path) codeline_counts = git_helper.get_changecode_lines( startrevison, endrevison) FileHelper.delete_file(scm_local_file_path) return codeline_counts
def save_git_commit_log(testsubmition): scm_info = CodeCommitLogService.get_git_scminfo( testsubmition.TPSProductName) scm_local_file_path = scm_info.localdir + CommonHelper.get_slash( ) + str(time.time()) + ".log" git_url = CodeCommitLogService.generate_git_url( testsubmition.TPSCodeUrl, scm_info.scmuser, scm_info.scmpassword) git_helper = GitHelper( git_url, scm_info.localdir + CommonHelper.get_slash() + ".git", scm_local_file_path) # if CodeCommitLogService.has_gitlog_indb(testsubmition.TPSProductName,testsubmition.id): # git_helper.save_commitlog("-200") # else: git_helper.save_commitlog("") return scm_local_file_path
def pull_git_project(testsubmition): SimpleLogger.logger.info("start to pull git project for submition:" + str(testsubmition.id)) scm_info = CodeCommitLogService.get_git_scminfo( testsubmition.TPSProductName) scm_local_file_path = scm_info.localdir + str(time.time()) + ".log" git_url = CodeCommitLogService.generate_git_url( testsubmition.TPSCodeUrl, scm_info.scmuser, scm_info.scmpassword) git_helper = GitHelper( git_url + " master", scm_info.localdir + CommonHelper.get_slash() + ".git", scm_local_file_path) git_helper.pull_project() FileHelper.delete_file(scm_local_file_path)
def get_scminfo(productnameid, user_dicdataname, password_dicdataname, coderoot_dicdataname): scm_user = str( DAL_DictValue.getdatavaluebydataname("SCMInfo", user_dicdataname).DicDataDesc) scm_password = str( DAL_DictValue.getdatavaluebydataname( "SCMInfo", password_dicdataname).DicDataDesc) scm_desc = str(DAL_TestProject.get_testproject(productnameid).TPKEY) scm_coderoot = str( DAL_DictValue.getdatavaluebydataname( "SCMInfo", coderoot_dicdataname).DicDataDesc) scm_info = SCMInfo(scm_user, scm_password, scm_coderoot + CommonHelper.get_slash() + scm_desc) return scm_info