def get_allcodelines(self, reversion): svncommandtext = self.get_svncommand(SvnHelper.svn_diffcommand, '0', reversion) FileHelper.delete_file(self.templog) os.popen(svncommandtext) linecounts = FileHelper.get_linecounts(self.templog) return linecounts
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 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 update_svn_commit_log(submitionid): SimpleLogger.logger.info( "start to process svn commit log for submition:" + str(submitionid)) testsubmition = DAL_TestSubmition.gettestsubmition(submitionid) if testsubmition.TPSCodeVersion != None and testsubmition.TPSCodeVersion.isdigit( ): log_file_path = CodeCommitLogService.save_svn_commit_log( testsubmition) CodeCommitLogService.save_svn_commitlog_2DB( log_file_path, testsubmition) FileHelper.delete_file(log_file_path) SimpleLogger.logger.info( "finished to process svn commit log for submition:" + str(submitionid))
def get_svn_line_counts(testsubmition, startrevison, endrevison, is_newcode): scm_info = CodeCommitLogService.get_svn_scminfo( testsubmition.TPSProductName) scm_local_file_path = scm_info.localdir + str(time.time()) + ".log" svn_helper = SvnHelper(testsubmition.TPSCodeUrl, scm_info.scmuser, scm_info.scmpassword, scm_local_file_path) if is_newcode: codeline_counts = svn_helper.get_newcode_lines( startrevison, endrevison) else: codeline_counts = svn_helper.get_deletecode_lines( startrevison, endrevison) FileHelper.delete_file(scm_local_file_path) return codeline_counts
def update_git_commit_log(submitionid): SimpleLogger.logger.info( "start to process git commit log for submition:" + str(submitionid)) testsubmition = DAL_TestSubmition.gettestsubmition(submitionid) if testsubmition.TPSCodeVersion != None and not testsubmition.TPSCodeVersion.isdigit( ): CodeCommitLogService.clone_git_project(testsubmition) # CodeCommitLogService.pull_git_project(testsubmition) log_file_path = CodeCommitLogService.save_git_commit_log( testsubmition) SimpleLogger.logger.info(log_file_path) CodeCommitLogService.save_git_commitlog_2DB( log_file_path, testsubmition) FileHelper.delete_file(log_file_path)
def clone_git_project(testsubmition): SimpleLogger.logger.info("start to clone 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" codeurlinfo = CodeCommitLogService.get_codeurlinfo( testsubmition.TPSCodeUrl) git_url = CodeCommitLogService.generate_git_url( codeurlinfo[0], scm_info.scmuser, scm_info.scmpassword) git_helper = GitHelper(git_url, scm_info.localdir, scm_local_file_path) git_helper.clone_project(codeurlinfo[1]) FileHelper.delete_file(scm_local_file_path) SimpleLogger.logger.info( "finished to clone git project for submition:" + str(testsubmition.id))
def save_commitlog(self, startversion, endversion): svncommandtext = self.get_svncommand(SvnHelper.svn_logcommand, startversion, endversion) FileHelper.delete_file(self.templog) os.popen(svncommandtext)
def get_commitlog(self, startversion, endversion): svncommandtext = self.get_svncommand(SvnHelper.svn_logcommand, startversion, endversion) FileHelper.delete_file(self.templog) os.popen(svncommandtext) return FileHelper.read_lines(self.templog)