Ejemplo n.º 1
0
 def save_git_commitlog_2DB(logfilepath, testsubmition):
     linesets = CodeCommitLogService.process_git_commitlog(logfilepath)
     linesets.reverse()
     last_commitnumber = CodeCommitLogService.get_lastest_gitcommit_number(
         testsubmition.TPSProductName, testsubmition.id)
     if last_commitnumber == "0":
         last_commitnumber = ""
     for linelist in linesets:
         try:
             code_commit_log = CodeCommitLogService.init_gitcommitlog(
                 linelist, last_commitnumber, testsubmition)
             if DAL_CodeCommitLog.get_commitlog_by_commitnumber(
                     code_commit_log.CCLCommiteNumber):  # 已经存在的条目不再写入
                 pass
             else:
                 if code_commit_log.CCLCommiteNumber == testsubmition.TPSCodeVersion:
                     DAL_CodeCommitLog.save_commitlog(code_commit_log)
                     break
                 else:
                     SimpleLogger.logger.info(
                         "no exists commit version:" +
                         code_commit_log.CCLCommiteNumber)
                     DAL_CodeCommitLog.save_commitlog(code_commit_log)
                     last_commitnumber = code_commit_log.CCLCommiteNumber
         except Exception as ex:
             SimpleLogger.logger.error(ex)
             continue
Ejemplo n.º 2
0
 def get_developer_newcodelines(submitionid):
     newcodelineslist=DAL_CodeCommitLog.get_developer_newcodelines(submitionid)
     developerlist=list()
     codelinescounts=list()
     for item in newcodelineslist:
         developerlist.append(item.get("CCLCommitor"))
         codelinescounts.append(item.get("NewCodeLines"))
     return str(developerlist).replace("u","")+";"+str(codelinescounts).replace("u","")
Ejemplo n.º 3
0
 def save_svn_commitlog_2DB(logfilepath, testsubmition):
     SimpleLogger.logger.info(
         "start to save svn info to db for submition:" +
         str(testsubmition.id))
     SimpleLogger.logger.info("logfilepaht" + logfilepath)
     if os.path.isfile(logfilepath):
         SimpleLogger.logger.info("logfile exits")
         commitlog = open(logfilepath, 'r')
         last_commitnumber = CodeCommitLogService.get_lastest_svncommit_number(
             testsubmition.TPSProductName, testsubmition.id)
         SimpleLogger.logger.info(last_commitnumber)
         linesets = list()
         for line in commitlog:
             templine = str(line)
             try:
                 if len(linesets) and templine.startswith('----'):
                     SimpleLogger.logger.info(templine)
                     code_commit_log = CodeCommitLogService.init_svncommitlog(
                         linesets, last_commitnumber, testsubmition)
                     if DAL_CodeCommitLog.get_commitlog_by_commitnumber(
                             code_commit_log.CCLCommiteNumber):
                         SimpleLogger.logger.info(
                             code_commit_log.CCLCommiteNumber)
                         pass
                     else:
                         if code_commit_log.CCLCommiteNumber == testsubmition.TPSCodeVersion:
                             SimpleLogger.logger.info(
                                 code_commit_log.CCLCommiteNumber)
                             DAL_CodeCommitLog.save_commitlog(
                                 code_commit_log)
                             break
                         else:
                             SimpleLogger.logger.info("no exits version")
                             DAL_CodeCommitLog.save_commitlog(
                                 code_commit_log)
                             last_commitnumber = code_commit_log.CCLCommiteNumber
                             linesets = list()
                             linesets.append(templine)
                 else:
                     linesets.append(templine)
             except Exception as ex:
                 SimpleLogger.logger.error(ex)
                 continue
     SimpleLogger.logger.info(
         "finished to save svn info to db for submition:" +
         str(testsubmition.id))
Ejemplo n.º 4
0
 def has_gitlog_indb(productid, submitionid):
     commitLogSets = DAL_CodeCommitLog.get_commitlog_by_productid(productid)
     target_submition = DAL_TestSubmition.gettestsubmition(submitionid)
     result = False
     for commitlog in commitLogSets:
         tempSubmition = DAL_TestSubmition.gettestsubmition(
             commitlog.CCLSubmitionID)
         if tempSubmition.TPSPlatform == target_submition.TPSPlatform:
             result = True
             break
     return result
Ejemplo n.º 5
0
 def get_lastest_svncommit_number(productid, submitionid):
     commitLogSets = DAL_CodeCommitLog.get_commitlog_by_productid(productid)
     target_submition = DAL_TestSubmition.gettestsubmition(submitionid)
     result = '0'
     for commitlog in commitLogSets:
         tempSubmition = DAL_TestSubmition.gettestsubmition(
             commitlog.CCLSubmitionID)
         if tempSubmition.TPSPlatform == target_submition.TPSPlatform:
             if commitlog.CCLCommiteNumber.isdigit():
                 result = commitlog.CCLCommiteNumber
                 break
     return result
Ejemplo n.º 6
0
 def update_tesjob_codelines(testjobid):
     SimpleLogger.logger.info("start to update codelines for job:" +
                              str(testjobid))
     testjob = DAL_TestJob.gettestjob(testjobid)
     codeCommitLogs = DAL_CodeCommitLog.get_commitlogs_by_submitionid(
         testjob.TJSubmitionID)
     codeLines = 0
     for codeCommitLog in codeCommitLogs:
         if not CodeCommitLogService.is_codecomite_expire(
                 codeCommitLog.CCLCommiteDate):
             tempcodelines = int(codeCommitLog.CCLNewCodeLines)
             if tempcodelines > 30000:
                 codeLines = codeLines + tempcodelines * 0.1
             elif tempcodelines <= 30000 and tempcodelines > 10000:
                 codeLines = codeLines + tempcodelines * 0.2
             else:
                 codeLines = codeLines + tempcodelines
     testjob.TJCodeLines = codeLines
     DAL_TestJob.updatetestjob(testjob)
     SimpleLogger.logger.info("finished to update codelines for job:" +
                              str(testjobid))