klesh commented on code in PR #2096:
URL: https://github.com/apache/incubator-devlake/pull/2096#discussion_r892024754


##########
plugins/refdiff/refdiff.go:
##########
@@ -83,19 +85,37 @@ func main() {
        newRef := refdiffCmd.Flags().StringP("new-ref", "n", "", "new ref")
        oldRef := refdiffCmd.Flags().StringP("old-ref", "o", "", "old ref")
 
+       tagsPattern := refdiffCmd.Flags().StringP("tags-pattern", "p", "", 
"tags pattern")
+       tagsLimit := refdiffCmd.Flags().StringP("tags-limit", "l", "", "tags 
limit")

Review Comment:
   why not make it `IntP` or `UnitP`? then you won't have to convert it youself.



##########
plugins/refdiff/tasks/ref_commit_diff_calculator.go:
##########
@@ -27,14 +27,28 @@ import (
        "gorm.io/gorm/clause"
 )
 
-func CalculateCommitsDiff(taskCtx core.SubTaskContext) error {
+// Calculate the commits pairs both from Options.Pairs and TagPattern
+func CalculateCommitsPairs(taskCtx core.SubTaskContext) (RefCommitPairs, 
error) {
        data := taskCtx.GetData().(*RefdiffTaskData)
        repoId := data.Options.RepoId
        pairs := data.Options.Pairs
+       tagsLimit := data.Options.TagsLimit
        db := taskCtx.GetDb()
-       ctx := taskCtx.GetContext()
-       logger := taskCtx.GetLogger()
-       insertCountLimitOfRefsCommitsDiff := int(65535 / 
reflect.ValueOf(code.RefsCommitsDiff{}).NumField())
+
+       rs, err := CaculateTagPattern(taskCtx)

Review Comment:
   I think we should calculate `pairs` inside `PrepareTaskData` method once and 
for all instead of calculation inside every subtasks



##########
plugins/refdiff/README.md:
##########
@@ -90,6 +84,28 @@ and if you want to perform certain subtasks.
   ]
 ]
 ```
+Or you can use tagsPattern to match the tags you want

Review Comment:
   I think alphabelcially order is no enough.
   we should consider `semver` sorting, sth in that nature



##########
plugins/refdiff/refdiff.go:
##########
@@ -83,19 +85,34 @@ func main() {
        newRef := refdiffCmd.Flags().StringP("new-ref", "n", "", "new ref")
        oldRef := refdiffCmd.Flags().StringP("old-ref", "o", "", "old ref")
 
+       tagsPattern := refdiffCmd.Flags().StringP("tags-pattern", "p", "", 
"tags pattern")
+       tagsLimit := refdiffCmd.Flags().StringP("tags-limit", "l", "", "tags 
limit")
+       tagsOrder := refdiffCmd.Flags().StringP("tags-order", "d", "", "tags 
order")
+
        _ = refdiffCmd.MarkFlagRequired("repo-id")

Review Comment:
   @warren830  there is a misunderstanding here,  errors occur when the name is 
invalid or missing. 
   it is safe to ignore the error here.
   and, we did this everywhere in plugin.main



##########
plugins/refdiff/refdiff.go:
##########
@@ -83,19 +85,37 @@ func main() {
        newRef := refdiffCmd.Flags().StringP("new-ref", "n", "", "new ref")
        oldRef := refdiffCmd.Flags().StringP("old-ref", "o", "", "old ref")
 
+       tagsPattern := refdiffCmd.Flags().StringP("tags-pattern", "p", "", 
"tags pattern")
+       tagsLimit := refdiffCmd.Flags().StringP("tags-limit", "l", "", "tags 
limit")

Review Comment:
   should have assigned a default value for it, like 10



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to