aboutsummaryrefslogtreecommitdiffstats
path: root/bug/bug_actions.go
diff options
context:
space:
mode:
authorMichael Muré <batolettre@gmail.com>2022-08-18 23:34:05 +0200
committerMichael Muré <batolettre@gmail.com>2022-08-18 23:44:06 +0200
commit5511c230b678a181cc596238bf6669428d1b1902 (patch)
tree8701efc87732439f993eb4f1d00585fc419b87ab /bug/bug_actions.go
parent5ca686b59751e3c87740b84108c54fc675a074cf (diff)
downloadgit-bug-5511c230b678a181cc596238bf6669428d1b1902.tar.gz
move {bug,identity} to /entities, move input to /commands
Diffstat (limited to 'bug/bug_actions.go')
-rw-r--r--bug/bug_actions.go74
1 files changed, 0 insertions, 74 deletions
diff --git a/bug/bug_actions.go b/bug/bug_actions.go
deleted file mode 100644
index 3a8ec3f0..00000000
--- a/bug/bug_actions.go
+++ /dev/null
@@ -1,74 +0,0 @@
-package bug
-
-import (
- "github.com/pkg/errors"
-
- "github.com/MichaelMure/git-bug/entity"
- "github.com/MichaelMure/git-bug/entity/dag"
- "github.com/MichaelMure/git-bug/identity"
- "github.com/MichaelMure/git-bug/repository"
-)
-
-// Fetch retrieve updates from a remote
-// This does not change the local bugs state
-func Fetch(repo repository.Repo, remote string) (string, error) {
- return dag.Fetch(def, repo, remote)
-}
-
-// Push update a remote with the local changes
-func Push(repo repository.Repo, remote string) (string, error) {
- return dag.Push(def, repo, remote)
-}
-
-// Pull will do a Fetch + MergeAll
-// This function will return an error if a merge fail
-// Note: an author is necessary for the case where a merge commit is created, as this commit will
-// have an author and may be signed if a signing key is available.
-func Pull(repo repository.ClockedRepo, resolvers entity.Resolvers, remote string, mergeAuthor identity.Interface) error {
- _, err := Fetch(repo, remote)
- if err != nil {
- return err
- }
-
- for merge := range MergeAll(repo, resolvers, remote, mergeAuthor) {
- if merge.Err != nil {
- return merge.Err
- }
- if merge.Status == entity.MergeStatusInvalid {
- return errors.Errorf("merge failure: %s", merge.Reason)
- }
- }
-
- return nil
-}
-
-// MergeAll will merge all the available remote bug
-// Note: an author is necessary for the case where a merge commit is created, as this commit will
-// have an author and may be signed if a signing key is available.
-func MergeAll(repo repository.ClockedRepo, resolvers entity.Resolvers, remote string, mergeAuthor identity.Interface) <-chan entity.MergeResult {
- out := make(chan entity.MergeResult)
-
- go func() {
- defer close(out)
-
- results := dag.MergeAll(def, repo, resolvers, remote, mergeAuthor)
-
- // wrap the dag.Entity into a complete Bug
- for result := range results {
- result := result
- if result.Entity != nil {
- result.Entity = &Bug{
- Entity: result.Entity.(*dag.Entity),
- }
- }
- out <- result
- }
- }()
-
- return out
-}
-
-// RemoveBug will remove a local bug from its entity.Id
-func RemoveBug(repo repository.ClockedRepo, id entity.Id) error {
- return dag.Remove(def, repo, id)
-}