aboutsummaryrefslogtreecommitdiffstats
path: root/bridge/core/export.go
diff options
context:
space:
mode:
authorJosh Bialkowski <josh.bialkowski@gmail.com>2019-12-13 13:17:26 -0800
committerJosh Bialkowski <josh.bialkowski@gmail.com>2019-12-18 07:42:16 -0800
commit4e64c834e2cd672f3daff59fe8117873688dfebc (patch)
tree694269594f13f4f9d545e0bd8a2c8a08df1e5a9e /bridge/core/export.go
parent98bd372e604285cf79ffcf04d0fdf423200cab8f (diff)
downloadgit-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/export.go')
-rw-r--r--bridge/core/export.go14
1 files changed, 14 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,