bridge/gitlab: Fix test project path

Amine Hilaly created

bridge/gitlab: update comments

Change summary

bridge/gitlab/import.go       |  4 ++++
bridge/gitlab/import_notes.go |  5 +----
bridge/gitlab/import_test.go  | 10 +++++-----
bridge/gitlab/iterator.go     |  1 +
4 files changed, 11 insertions(+), 9 deletions(-)

Detailed changes

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 {

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

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 {
 

bridge/gitlab/iterator.go 🔗

@@ -47,6 +47,7 @@ type iterator struct {
 	// notes iterator
 	note *noteIterator
 
+	// labelEvent iterator
 	labelEvent *labelEventIterator
 }