-
-
Notifications
You must be signed in to change notification settings - Fork 496
/
rcs.go
52 lines (42 loc) · 1.18 KB
/
rcs.go
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
46
47
48
49
50
51
52
package backend
import (
"context"
"time"
"github.com/blang/semver"
)
// RCSBackend is a remote-sync backend
type RCSBackend int
const (
// Noop is a no-op mock backend
Noop RCSBackend = iota
// GitCLI is a git-cli based sync backend
GitCLI
// GoGit is an src-d/go-git.v4 based sync backend
GoGit
)
func (s RCSBackend) String() string {
return rcsNameFromBackend(s)
}
// RCS is a revision control backend
type RCS interface {
Add(ctx context.Context, args ...string) error
Commit(ctx context.Context, msg string) error
Push(ctx context.Context, remote, location string) error
Pull(ctx context.Context, remote, location string) error
Name() string
Version(ctx context.Context) semver.Version
InitConfig(ctx context.Context, name, email string) error
AddRemote(ctx context.Context, remote, location string) error
RemoveRemote(ctx context.Context, remote string) error
Revisions(ctx context.Context, name string) ([]Revision, error)
GetRevision(ctx context.Context, name, revision string) ([]byte, error)
}
// Revision is a SCM revision
type Revision struct {
Hash string
AuthorName string
AuthorEmail string
Date time.Time
Subject string
Body string
}