aboutsummaryrefslogtreecommitdiffstats
path: root/bridge/gitlab/iterator.go
diff options
context:
space:
mode:
authorAmine Hilaly <hilalyamine@gmail.com>2019-07-23 18:40:10 +0200
committerAmine Hilaly <hilalyamine@gmail.com>2019-07-23 18:40:10 +0200
commit0c8f1c3a58c4707284cc6368af26715520a220c0 (patch)
tree332ad69706cf8633bcd2dc246855350830a95ffc /bridge/gitlab/iterator.go
parent0329bfdf440ec48c5c5c5c6dbe2ca8519d99b706 (diff)
downloadgit-bug-0c8f1c3a58c4707284cc6368af26715520a220c0.tar.gz
bridge/gitlab: fix comment edition target hash in the import
bridge/gitlab: global changes, typo fixes, comments addition
Diffstat (limited to 'bridge/gitlab/iterator.go')
-rw-r--r--bridge/gitlab/iterator.go24
1 files changed, 10 insertions, 14 deletions
diff --git a/bridge/gitlab/iterator.go b/bridge/gitlab/iterator.go
index 320f2a50..73f1614e 100644
--- a/bridge/gitlab/iterator.go
+++ b/bridge/gitlab/iterator.go
@@ -28,8 +28,8 @@ type iterator struct {
// gitlab api v4 client
gc *gitlab.Client
- // if since is given the iterator will query only the updated
- // issues after this date
+ // if since is given the iterator will query only the issues
+ // updated after this date
since time.Time
// project id
@@ -79,8 +79,6 @@ func (i *iterator) Error() error {
}
func (i *iterator) getNextIssues() bool {
- sort := "asc"
- scope := "all"
issues, _, err := i.gc.Issues.ListProjectIssues(
i.project,
&gitlab.ListProjectIssuesOptions{
@@ -88,9 +86,9 @@ func (i *iterator) getNextIssues() bool {
Page: i.issue.page,
PerPage: i.capacity,
},
- Scope: &scope,
+ Scope: gitlab.String("all"),
UpdatedAfter: &i.since,
- Sort: &sort,
+ Sort: gitlab.String("asc"),
},
)
@@ -114,15 +112,15 @@ func (i *iterator) getNextIssues() bool {
}
func (i *iterator) NextIssue() bool {
+ if i.err != nil {
+ return false
+ }
+
// first query
if i.issue.cache == nil {
return i.getNextIssues()
}
- if i.err != nil {
- return false
- }
-
// move cursor index
if i.issue.index < len(i.issue.cache)-1 {
i.issue.index++
@@ -137,8 +135,6 @@ func (i *iterator) IssueValue() *gitlab.Issue {
}
func (i *iterator) getNextNotes() bool {
- sort := "asc"
- order := "created_at"
notes, _, err := i.gc.Notes.ListIssueNotes(
i.project,
i.IssueValue().IID,
@@ -147,8 +143,8 @@ func (i *iterator) getNextNotes() bool {
Page: i.note.page,
PerPage: i.capacity,
},
- Sort: &sort,
- OrderBy: &order,
+ Sort: gitlab.String("asc"),
+ OrderBy: gitlab.String("created_at"),
},
)