diff options
author | Josh Bialkowski <josh.bialkowski@gmail.com> | 2019-12-13 13:17:26 -0800 |
---|---|---|
committer | Josh Bialkowski <josh.bialkowski@gmail.com> | 2019-12-18 07:42:16 -0800 |
commit | 4e64c834e2cd672f3daff59fe8117873688dfebc (patch) | |
tree | 694269594f13f4f9d545e0bd8a2c8a08df1e5a9e /bridge/core | |
parent | 98bd372e604285cf79ffcf04d0fdf423200cab8f (diff) | |
download | git-bug-4e64c834e2cd672f3daff59fe8117873688dfebc.tar.gz |
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
Diffstat (limited to 'bridge/core')
-rw-r--r-- | bridge/core/export.go | 14 | ||||
-rw-r--r-- | bridge/core/import.go | 15 |
2 files changed, 29 insertions, 0 deletions
diff --git a/bridge/core/export.go b/bridge/core/export.go index 0f45404c..ef7a2e57 100644 --- a/bridge/core/export.go +++ b/bridge/core/export.go @@ -29,6 +29,7 @@ const ( // Error happened during export ExportEventError + ExportEventWarning ) // ExportResult is an event that is emitted during the export process, to @@ -65,6 +66,11 @@ func (er ExportResult) String() string { return fmt.Sprintf("export error at %s: %s", er.ID, er.Err.Error()) } return fmt.Sprintf("export error: %s", er.Err.Error()) + case ExportEventWarning: + if er.ID != "" { + return fmt.Sprintf("warning at %s: %s", er.ID, er.Err.Error()) + } + return fmt.Sprintf("warning: %s", er.Err.Error()) default: panic("unknown export result") @@ -79,6 +85,14 @@ func NewExportError(err error, id entity.Id) ExportResult { } } +func NewExportWarning(err error, id entity.Id) ExportResult { + return ExportResult{ + ID: id, + Err: err, + Event: ExportEventWarning, + } +} + func NewExportNothing(id entity.Id, reason string) ExportResult { return ExportResult{ ID: id, 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, |