4 changed files with 68 additions and 45 deletions
@ -0,0 +1,27 @@ |
|||
package main |
|||
|
|||
import( |
|||
"log" |
|||
"io/ioutil" |
|||
"os" |
|||
"path/filepath" |
|||
) |
|||
|
|||
func checkRootFolder(storage string) { |
|||
files, err := ioutil.ReadDir(storage) |
|||
if err != nil { log.Fatal(err) } |
|||
|
|||
checked_folders := map[string]bool{"fs": false, "commits": false, "blocks": false} |
|||
for _, f := range files { |
|||
if _, ok := checked_folders[f.Name()]; ok { |
|||
info, err := os.Stat(filepath.Join(storage, f.Name())); |
|||
if err == nil && info.IsDir() { |
|||
checked_folders[f.Name()] = true |
|||
} |
|||
} |
|||
} |
|||
|
|||
for path, seen := range checked_folders { |
|||
if !seen { log.Fatal("Folder ", path, " is required but not present!") } |
|||
} |
|||
} |
@ -0,0 +1,26 @@ |
|||
package main |
|||
|
|||
import ( |
|||
"log" |
|||
) |
|||
|
|||
type Commit struct { |
|||
CommitId string `json:"commit_id"` |
|||
RootId string `json:"root_id"` |
|||
RepoId string `json:"repo_id"` |
|||
CreatorName string `json:"creator_name"` |
|||
Creator string `json:"creator"` |
|||
Description string `json:"description"` |
|||
Ctime uint64 `json:"ctime"` |
|||
ParentId string `json:"parent_id"` |
|||
SecondParentId string `json:"second_parent_id"` |
|||
RepoName string `json:"repo_name"` |
|||
RepoDesc string `json:"repo_desc"` |
|||
RepoCategory string `json:"repo_category"` |
|||
NoLocalHistory int `json:"no_local_history"` |
|||
Version int `json:"version"` |
|||
} |
|||
|
|||
func cmdCommit(config configCollect) { |
|||
log.Println(config) |
|||
} |
@ -0,0 +1,7 @@ |
|||
package main |
|||
|
|||
type configCollect struct { |
|||
Commits bool `docopt:"commits"` |
|||
Storage string `docopt:"--storage"` |
|||
RepoId string `docopt:"<repoid>"` |
|||
} |
Loading…
Reference in new issue