Skip to content

Commit

Permalink
zoekt-mirror-gitlab: add last_activity_after flag (#845)
Browse files Browse the repository at this point in the history
  • Loading branch information
po3rin authored Oct 21, 2024
1 parent da3626e commit d80d701
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions cmd/zoekt-mirror-gitlab/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ import (
"path/filepath"
"strconv"
"strings"
"time"

"github.com/sourcegraph/zoekt/gitindex"
gitlab "github.com/xanzy/go-gitlab"
Expand All @@ -49,6 +50,7 @@ func main() {
excludeUserRepos := flag.Bool("exclude_user", false, "exclude user repos")
namePattern := flag.String("name", "", "only clone repos whose name matches the given regexp.")
excludePattern := flag.String("exclude", "", "don't mirror repos whose names match this regexp.")
lastActivityAfter := flag.String("last_activity_after", "", "only mirror repos that have been active since this date (format: 2006-01-02).")
flag.Parse()

if *dest == "" {
Expand Down Expand Up @@ -90,6 +92,14 @@ func main() {
opt.Visibility = gitlab.Visibility(gitlab.PublicVisibility)
}

if *lastActivityAfter != "" {
targetDate, err := time.Parse("2006-01-02", *lastActivityAfter)
if err != nil {
log.Fatal(err)
}
opt.LastActivityAfter = gitlab.Time(targetDate)
}

var gitlabProjects []*gitlab.Project
for {
projects, _, err := client.Projects.ListProjects(opt)
Expand Down

0 comments on commit d80d701

Please sign in to comment.