summaryrefslogtreecommitdiff
path: root/doPatchsets.go
diff options
context:
space:
mode:
Diffstat (limited to 'doPatchsets.go')
-rw-r--r--doPatchsets.go32
1 files changed, 32 insertions, 0 deletions
diff --git a/doPatchsets.go b/doPatchsets.go
index 2d70440..e696910 100644
--- a/doPatchsets.go
+++ b/doPatchsets.go
@@ -205,3 +205,35 @@ func lookupRepos(msg []byte) (*gitpb.Repos, error) {
}
return newpb, nil
}
+/* save the git.pb files
++ if repo.Namespace == "" {
++ log.Infof("repo: ERROR. no namespace. %s\n", repo.FullPath)
++ continue
++ }
++
++ repopath := filepath.Join("/home/forge", repo.Namespace)
++ if !shell.IsDir(repopath) {
++ if err := os.MkdirAll(repopath, os.ModePerm); err != nil {
++ log.Warn("mkdir fail", repo.Namespace, err)
++ continue
++ }
++ }
++
++ filename := filepath.Join(repopath, "git.pb")
++ if !shell.Exists(filename) {
++ data, err := repo.Marshal()
++ if err != nil {
++ log.Info("patchsets.Marshal() to wire failed", err)
++ continue
++ }
++ gitpbf, err := os.OpenFile(filename, os.O_RDWR|os.O_CREATE|os.O_TRUNC, 0666)
++ defer gitpbf.Close()
++ if err != nil {
++ log.Info("filename open error:", filename, err)
++ continue
++ }
++ gitpbf.Write(data)
++ }
++
++ log.Infof("repo path: %s\n", repopath)
+*/