Pull will do a Fetch + MergeAll Contrary to MergeAll, this function will return an error if a merge fail.
(def Definition, wrapper func(e *Entity) EntityT, repo repository.ClockedRepo, resolvers entity.Resolvers, remote string, author identity.Interface)
| 33 | // Pull will do a Fetch + MergeAll |
| 34 | // Contrary to MergeAll, this function will return an error if a merge fail. |
| 35 | func Pull[EntityT entity.Interface](def Definition, wrapper func(e *Entity) EntityT, repo repository.ClockedRepo, resolvers entity.Resolvers, remote string, author identity.Interface) error { |
| 36 | _, err := Fetch(def, repo, remote) |
| 37 | if err != nil { |
| 38 | return err |
| 39 | } |
| 40 | |
| 41 | for merge := range MergeAll(def, wrapper, repo, resolvers, remote, author) { |
| 42 | if merge.Err != nil { |
| 43 | return merge.Err |
| 44 | } |
| 45 | if merge.Status == entity.MergeStatusInvalid { |
| 46 | return errors.Errorf("merge failure: %s", merge.Reason) |
| 47 | } |
| 48 | } |
| 49 | |
| 50 | return nil |
| 51 | } |
| 52 | |
| 53 | // MergeAll will merge all the available remote Entity: |
| 54 | // |