bug_actions.go

 1package bug
 2
 3import (
 4	"github.com/MichaelMure/git-bug/entity"
 5	"github.com/MichaelMure/git-bug/entity/dag"
 6	"github.com/MichaelMure/git-bug/repository"
 7)
 8
 9// Fetch retrieve updates from a remote
10// This does not change the local bugs state
11func Fetch(repo repository.Repo, remote string) (string, error) {
12	return dag.Fetch(def, repo, remote)
13}
14
15// Push update a remote with the local changes
16func Push(repo repository.Repo, remote string) (string, error) {
17	return dag.Push(def, repo, remote)
18}
19
20// Pull will do a Fetch + MergeAll
21// This function will return an error if a merge fail
22// Note: an author is necessary for the case where a merge commit is created, as this commit will
23// have an author and may be signed if a signing key is available.
24func Pull(repo repository.ClockedRepo, resolvers entity.Resolvers, remote string, mergeAuthor entity.Identity) error {
25	return dag.Pull(def, wrapper, repo, resolvers, remote, mergeAuthor)
26}
27
28// MergeAll will merge all the available remote bug
29// Note: an author is necessary for the case where a merge commit is created, as this commit will
30// have an author and may be signed if a signing key is available.
31func MergeAll(repo repository.ClockedRepo, resolvers entity.Resolvers, remote string, mergeAuthor entity.Identity) <-chan entity.MergeResult {
32	return dag.MergeAll(def, wrapper, repo, resolvers, remote, mergeAuthor)
33}
34
35// Remove will remove a local bug from its entity.Id
36func Remove(repo repository.ClockedRepo, id entity.Id) error {
37	return dag.Remove(def, repo, id)
38}
39
40// RemoveAll will remove all local bugs.
41// RemoveAll is idempotent.
42func RemoveAll(repo repository.ClockedRepo) error {
43	return dag.RemoveAll(def, repo)
44}