本文整理匯總了Golang中github.com/google/git-phabricator-mirror/mirror/repository.Repo.ListNotedRevisions方法的典型用法代碼示例。如果您正苦於以下問題:Golang Repo.ListNotedRevisions方法的具體用法?Golang Repo.ListNotedRevisions怎麽用?Golang Repo.ListNotedRevisions使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類github.com/google/git-phabricator-mirror/mirror/repository.Repo
的用法示例。
在下文中一共展示了Repo.ListNotedRevisions方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。
示例1: mirrorRepoToReview
func mirrorRepoToReview(repo repository.Repo, tool review.Tool, syncToRemote bool) {
if syncToRemote {
if err := repo.PullUpdates(); err != nil {
log.Printf("Failed to pull updates for the repo %v: %v\n", repo, err)
return
}
}
stateHash := repo.GetRepoStateHash()
if processedStates[repo.GetPath()] != stateHash {
log.Print("Mirroring repo: ", repo)
for _, revision := range repo.ListNotedRevisions(request.Ref) {
existingComments[revision] = comment.ParseAllValid(repo.GetNotes(comment.Ref, revision))
for _, req := range request.ParseAllValid(repo.GetNotes(request.Ref, revision)) {
tool.EnsureRequestExists(repo, revision, req, existingComments[revision])
}
}
openReviews[repo.GetPath()] = tool.ListOpenReviews(repo)
processedStates[repo.GetPath()] = stateHash
tool.Refresh(repo)
}
for _, review := range openReviews[repo.GetPath()] {
if reviewCommit := review.GetFirstCommit(repo); reviewCommit != nil {
log.Println("Processing review: ", *reviewCommit)
revisionComments := getExistingComments(*reviewCommit)
log.Printf("Loaded %d comments for %v\n", len(revisionComments), *reviewCommit)
for _, c := range review.LoadComments() {
if !hasOverlap(c, revisionComments) {
// The comment is new.
note, err := c.Write()
if err != nil {
log.Fatal(err)
}
log.Printf("Appending a comment: %s", string(note))
repo.AppendNote(comment.Ref, *reviewCommit, note, c.Author)
} else {
log.Printf("Skipping '%v', as it has already been written\n", c)
}
}
}
}
if syncToRemote {
if err := repo.PushUpdates(); err != nil {
log.Printf("Failed to push updates to the repo %v: %v\n", repo, err)
}
}
}