From 4e64c834e2cd672f3daff59fe8117873688dfebc Mon Sep 17 00:00:00 2001 From: Josh Bialkowski Date: Fri, 13 Dec 2019 13:17:26 -0800 Subject: codereview #5: reverse-map and ImportWarning * Fix git config reader can't read values with spaces * Add bug-id-revmap config option for the reverse map, and use this in the importer * Add NewImportWarning for things that aren't exactly errors. Use this for unhandled changelog events. * Add NewExportWarning for things that aren't exactly errors. Use this for un-exportable status changes. * Strip newlines from titles on import --- bridge/core/import.go | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'bridge/core/import.go') diff --git a/bridge/core/import.go b/bridge/core/import.go index e4771d2c..109fae85 100644 --- a/bridge/core/import.go +++ b/bridge/core/import.go @@ -31,6 +31,7 @@ const ( // Error happened during import ImportEventError + ImportEventWarning ) // ImportResult is an event that is emitted during the import process, to @@ -69,6 +70,12 @@ func (er ImportResult) String() string { return fmt.Sprintf("import error at id %s: %s", er.ID, er.Err.Error()) } return fmt.Sprintf("import error: %s", er.Err.Error()) + case ImportEventWarning: + if er.ID != "" { + return fmt.Sprintf("warning at id %s: %s", er.ID, er.Err.Error()) + } + return fmt.Sprintf("warning: %s", er.Err.Error()) + default: panic("unknown import result") } @@ -82,6 +89,14 @@ func NewImportError(err error, id entity.Id) ImportResult { } } +func NewImportWarning(err error, id entity.Id) ImportResult { + return ImportResult{ + Err: err, + ID: id, + Event: ImportEventWarning, + } +} + func NewImportNothing(id entity.Id, reason string) ImportResult { return ImportResult{ ID: id, -- cgit