Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

✨ KAI support. #64

Merged
merged 2 commits into from
Aug 13, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions repository/factory.go
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ type SCM interface {
Fetch() (err error)
Branch(name string) (err error)
Commit(files []string, msg string) (err error)
Head() (commit string, err error)
}

// Remote repository.
Expand Down
15 changes: 15 additions & 0 deletions repository/git.go
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,21 @@ func (r *Git) Commit(files []string, msg string) (err error) {
return r.push()
}

// Head returns HEAD commit.
func (r *Git) Head() (commit string, err error) {
cmd := command.New("/usr/bin/git")
cmd.Dir = r.Path
cmd.Options.Add("rev-parse")
cmd.Options.Add("HEAD")
err = cmd.Run()
if err != nil {
return
}
commit = string(cmd.Output())
commit = strings.TrimSpace(commit)
return
}

// push changes to remote.
func (r *Git) push() (err error) {
cmd := command.New("/usr/bin/git")
Expand Down
6 changes: 6 additions & 0 deletions repository/subversion.go
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,12 @@ func (r *Subversion) Commit(files []string, msg string) (err error) {
return
}

// Head returns latest commit.
func (r *Subversion) Head() (commit string, err error) {
// TODO: needs implementation.
return
}

// URL returns the parsed URL.
func (r *Subversion) URL() (u *urllib.URL) {
u, _ = urllib.Parse(r.Remote.URL)
Expand Down
Loading