File tree Expand file tree Collapse file tree 1 file changed +16
-0
lines changed Expand file tree Collapse file tree 1 file changed +16
-0
lines changed Original file line number Diff line number Diff line change 40
40
commentNmw = commentFlagSet .Bool ("nmw" , false , "'Needs More Work'. Set this to express your disapproval. This cannot be combined with lgtm" )
41
41
)
42
42
43
+ func commentHashExists (hashToFind string , threads []review.CommentThread ) bool {
44
+ for _ , thread := range threads {
45
+ if thread .Hash == hashToFind {
46
+ return true
47
+ }
48
+ if commentHashExists (hashToFind , thread .Children ) {
49
+ return true
50
+ }
51
+ }
52
+ return false
53
+ }
54
+
43
55
// commentOnReview adds a comment to the current code review.
44
56
func commentOnReview (repo repository.Repo , args []string ) error {
45
57
commentFlagSet .Parse (args )
@@ -100,6 +112,10 @@ func commentOnReview(repo repository.Repo, args []string) error {
100
112
return errors .New ("There is no matching review." )
101
113
}
102
114
115
+ if * commentParent != "" && ! commentHashExists (* commentParent , r .Comments ) {
116
+ return errors .New ("There is no matching parent comment." )
117
+ }
118
+
103
119
commentedUponCommit , err := r .GetHeadCommit ()
104
120
if err != nil {
105
121
return err
You can’t perform that action at this time.
0 commit comments