parent
47783e70ba
commit
015e93106c
8
file.go
8
file.go
|
@ -51,6 +51,8 @@ func (fp *FilePages) Save(p string, page Page, summary, author string) error {
|
|||
|
||||
func saveWithGit(fp *FilePages, p string, summary, author string) error {
|
||||
cmd := exec.Command("git", "add", ".")
|
||||
cmd.Stdout = os.Stdout
|
||||
cmd.Stderr = os.Stderr
|
||||
cmd.Dir = fp.dirname
|
||||
err := cmd.Run()
|
||||
if err != nil {
|
||||
|
@ -58,6 +60,8 @@ func saveWithGit(fp *FilePages, p string, summary, author string) error {
|
|||
}
|
||||
|
||||
cmd = exec.Command("git", "commit", "-m", "Changes to "+p+" by "+author+"\n\n"+summary)
|
||||
cmd.Stdout = os.Stdout
|
||||
cmd.Stderr = os.Stderr
|
||||
cmd.Dir = fp.dirname
|
||||
err = cmd.Run()
|
||||
if err != nil {
|
||||
|
@ -101,6 +105,8 @@ func DiffPrettyHtml(diffs []diffmatchpatch.Diff) string {
|
|||
func (fp *FilePages) PageHistory(p string) ([]Revision, error) {
|
||||
page := strings.Replace(p, " ", "_", -1)
|
||||
cmd := exec.Command("git", "log", "--pretty=oneline", "--no-decorate", "--color=never", page)
|
||||
cmd.Stderr = os.Stderr
|
||||
cmd.Stdout = os.Stdout
|
||||
cmd.Dir = fp.dirname
|
||||
output, err := cmd.StdoutPipe()
|
||||
if err != nil {
|
||||
|
@ -151,6 +157,7 @@ func (fp *FilePages) PageHistory(p string) ([]Revision, error) {
|
|||
func gitRevision(dirname, page, version string) string {
|
||||
cmd := exec.Command("git", "show", version+":"+page)
|
||||
cmd.Dir = dirname
|
||||
cmd.Stderr = os.Stderr
|
||||
buf := bytes.Buffer{}
|
||||
cmd.Stdout = &buf
|
||||
cmd.Start()
|
||||
|
@ -161,6 +168,7 @@ func gitRevision(dirname, page, version string) string {
|
|||
func (fp *FilePages) RecentChanges() ([]Change, error) {
|
||||
cmd := exec.Command("git", "log", "--format=--1--%nDate: %aI%n--2--", "--name-only")
|
||||
cmd.Dir = fp.dirname
|
||||
cmd.Stderr = os.Stderr
|
||||
buf := bytes.Buffer{}
|
||||
cmd.Stdout = &buf
|
||||
err := cmd.Start()
|
||||
|
|
Loading…
Reference in New Issue
Block a user