Browse Source

通过repo_hash分析commit变化

fulian23 4 months ago
parent
commit
8650e92e6c
1 changed files with 5 additions and 1 deletions
  1. 5 1
      api/aiRouter.py

+ 5 - 1
api/aiRouter.py

@@ -217,8 +217,12 @@ async def summaryCommit(request: RequestBody, background_tasks: BackgroundTasks)
     local_path, repo_name = generate_repo_path(request.uuid, request.repo_url)
     repo=await Repos.get(name=repo_name)
     repo_id=repo.id
+    repo_commit=await Commit_Summary_Tasks.get(repo_id=repo_id)
+    repo_commit_hash=repo_commit.repo_hash
+    print(f"开始提交仓库: {repo_name}")
     await Commit_Summary_Tasks.filter(repo_id=repo_id).update(start_time=int(time.time()))
-    commit_content = Repo(local_path).git.log('-1', '-p', '--pretty=format:%h %s')
+    # commit_content = Repo(local_path).git.log('-1', '-p', '--pretty=format:%h %s')
+    commit_content = Repo(local_path).git.diff(f"{repo_commit_hash}^", repo_commit_hash)
     background_tasks.add_task(commit_task,commit_content,repo_id)
     return {"code": 200, "msg": "添加提交任务成功"}