예제 #1
0
func gitPuller(gitRoot string) {
	repo := git.NewGit(gitRoot)
	for {
		if output, e := repo.Pull(); e != nil {
			log.Printf("[%s]:%s, error: %s\n", gitRoot, string(output), e.Error())
		} else {
			log.Printf("[%s]:%s\n", gitRoot, string(output))
		}
		time.Sleep(time.Second * 30)
	}
}
예제 #2
0
func GetRevisionFile(baseDir, filePath, revision string) (data []byte, err error) {
	revisionPath := revision + ":" + filePath

	exist := false
	if data, exist = revisionFileCache[revisionPath]; exist {
		return
	}

	repoGit := git.NewGit(baseDir)

	if data, err = repoGit.CatBlobFile(filePath, revision); err != nil {
		err = fmt.Errorf("%s\n%s", string(data), err.Error())
		return
	}

	revisionFileCache[revisionPath] = data

	return
}