aboutsummaryrefslogtreecommitdiffstats
path: root/bridge
diff options
context:
space:
mode:
Diffstat (limited to 'bridge')
-rw-r--r--bridge/gitlab/import.go4
-rw-r--r--bridge/gitlab/import_notes.go5
-rw-r--r--bridge/gitlab/import_test.go10
-rw-r--r--bridge/gitlab/iterator.go1
4 files changed, 11 insertions, 9 deletions
diff --git a/bridge/gitlab/import.go b/bridge/gitlab/import.go
index 6869a103..b2db13d0 100644
--- a/bridge/gitlab/import.go
+++ b/bridge/gitlab/import.go
@@ -14,6 +14,7 @@ import (
"github.com/MichaelMure/git-bug/util/text"
)
+// gitlabImporter implement the Importer interface
type gitlabImporter struct {
conf core.Configuration
@@ -32,6 +33,8 @@ func (gi *gitlabImporter) Init(conf core.Configuration) error {
return nil
}
+// ImportAll iterate over all the configured repository issues (notes) and ensure the creation
+// of the missing issues / comments / label events / title changes ...
func (gi *gitlabImporter) ImportAll(repo *cache.RepoCache, since time.Time) error {
gi.iterator = NewIterator(gi.conf[keyProjectID], gi.conf[keyToken], since)
@@ -90,6 +93,7 @@ func (gi *gitlabImporter) ensureIssue(repo *cache.RepoCache, issue *gitlab.Issue
return nil, err
}
+ // if bug was never imported
if err == bug.ErrBugNotExist {
cleanText, err := text.Cleanup(string(issue.Description))
if err != nil {
diff --git a/bridge/gitlab/import_notes.go b/bridge/gitlab/import_notes.go
index 37bf2834..a096b14e 100644
--- a/bridge/gitlab/import_notes.go
+++ b/bridge/gitlab/import_notes.go
@@ -26,10 +26,7 @@ const (
NOTE_UNKNOWN
)
-// GetNoteType parses note body a give it type
-// Since gitlab api return all these NoteType event as the same object
-// and doesn't provide a field to specify the note type. We must parse the
-// note body to detect it type.
+// GetNoteType parse a note system and body and return the note type and it content
func GetNoteType(n *gitlab.Note) (NoteType, string) {
if !n.System {
return NOTE_COMMENT, n.Body
diff --git a/bridge/gitlab/import_test.go b/bridge/gitlab/import_test.go
index 4a49cfe9..c38d3ce3 100644
--- a/bridge/gitlab/import_test.go
+++ b/bridge/gitlab/import_test.go
@@ -26,7 +26,7 @@ func TestImport(t *testing.T) {
}{
{
name: "simple issue",
- url: "https://gitlab.com/a-hilaly/git-bug-test/issues/1",
+ url: "https://gitlab.com/git-bug/test/issues/1",
bug: &bug.Snapshot{
Operations: []bug.Operation{
bug.NewCreateOp(author, 0, "simple issue", "initial comment", nil),
@@ -37,7 +37,7 @@ func TestImport(t *testing.T) {
},
{
name: "empty issue",
- url: "https://gitlab.com/a-hilaly/git-bug-test/issues/2",
+ url: "https://gitlab.com/git-bug/test/issues/2",
bug: &bug.Snapshot{
Operations: []bug.Operation{
bug.NewCreateOp(author, 0, "empty issue", "", nil),
@@ -46,7 +46,7 @@ func TestImport(t *testing.T) {
},
{
name: "complex issue",
- url: "https://gitlab.com/a-hilaly/git-bug-test/issues/3",
+ url: "https://gitlab.com/git-bug/test/issues/3",
bug: &bug.Snapshot{
Operations: []bug.Operation{
bug.NewCreateOp(author, 0, "complex issue", "initial comment", nil),
@@ -63,7 +63,7 @@ func TestImport(t *testing.T) {
},
{
name: "editions",
- url: "https://gitlab.com/a-hilaly/git-bug-test/issues/4",
+ url: "https://gitlab.com/git-bug/test/issues/4",
bug: &bug.Snapshot{
Operations: []bug.Operation{
bug.NewCreateOp(author, 0, "editions", "initial comment edited", nil),
@@ -113,7 +113,7 @@ func TestImport(t *testing.T) {
require.NoError(t, err)
ops := b.Snapshot().Operations
- assert.Len(t, tt.bug.Operations, len(ops))
+ require.Len(t, tt.bug.Operations, len(ops))
for i, op := range tt.bug.Operations {
diff --git a/bridge/gitlab/iterator.go b/bridge/gitlab/iterator.go
index 8502504d..5a627ade 100644
--- a/bridge/gitlab/iterator.go
+++ b/bridge/gitlab/iterator.go
@@ -47,6 +47,7 @@ type iterator struct {
// notes iterator
note *noteIterator
+ // labelEvent iterator
labelEvent *labelEventIterator
}