aboutsummaryrefslogtreecommitdiffstats
path: root/entities/bug/bug_actions.go
blob: c20b81f3578907e11ba4d5473ecb0eda99bad7bd (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
package bug

import (
	"github.com/git-bug/git-bug/entities/identity"
	"github.com/git-bug/git-bug/entity"
	"github.com/git-bug/git-bug/entity/dag"
	"github.com/git-bug/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 {
	return dag.Pull(def, wrapper, repo, resolvers, remote, mergeAuthor)
}

// 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 {
	return dag.MergeAll(def, wrapper, repo, resolvers, remote, mergeAuthor)
}

// Remove will remove a local bug from its entity.Id
func Remove(repo repository.ClockedRepo, id entity.Id) error {
	return dag.Remove(def, repo, id)
}

// RemoveAll will remove all local bugs.
// RemoveAll is idempotent.
func RemoveAll(repo repository.ClockedRepo) error {
	return dag.RemoveAll(def, repo)
}