aboutsummaryrefslogtreecommitdiffstats
path: root/bridge/core/import.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/import.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/import.go')
-rw-r--r--bridge/core/import.go15
1 files changed, 15 insertions, 0 deletions
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,