aboutsummaryrefslogtreecommitdiffstats
path: root/bridge
diff options
context:
space:
mode:
Diffstat (limited to 'bridge')
-rw-r--r--bridge/gitlab/import_test.go2
-rw-r--r--bridge/gitlab/iterator.go17
2 files changed, 18 insertions, 1 deletions
diff --git a/bridge/gitlab/import_test.go b/bridge/gitlab/import_test.go
index 20fc67c7..a6fd8524 100644
--- a/bridge/gitlab/import_test.go
+++ b/bridge/gitlab/import_test.go
@@ -19,7 +19,7 @@ import (
)
func TestImport(t *testing.T) {
- author := identity.NewIdentity("Amine hilaly", "hilalyamine@gmail.com")
+ author := identity.NewIdentity("Amine Hilaly", "hilalyamine@gmail.com")
tests := []struct {
name string
url string
diff --git a/bridge/gitlab/iterator.go b/bridge/gitlab/iterator.go
index 198af79b..d5425cee 100644
--- a/bridge/gitlab/iterator.go
+++ b/bridge/gitlab/iterator.go
@@ -2,6 +2,7 @@ package gitlab
import (
"context"
+ "sort"
"time"
"github.com/xanzy/go-gitlab"
@@ -25,6 +26,20 @@ type labelEventIterator struct {
cache []*gitlab.LabelEvent
}
+func (l *labelEventIterator) Len() int {
+ return len(l.cache)
+}
+
+func (l *labelEventIterator) Swap(i, j int) {
+ element := l.cache[i]
+ l.cache[i] = l.cache[j]
+ l.cache[j] = element
+}
+
+func (l *labelEventIterator) Less(i, j int) bool {
+ return l.cache[i].ID < l.cache[j].ID
+}
+
type iterator struct {
// gitlab api v4 client
gc *gitlab.Client
@@ -240,6 +255,8 @@ func (i *iterator) getNextLabelEvents() bool {
i.labelEvent.cache = labelEvents
i.labelEvent.page++
i.labelEvent.index = 0
+
+ sort.Sort(i.labelEvent)
return true
}