diff --git a/metatool b/metatool index d13593e..378a2e6 100755 --- a/metatool +++ b/metatool @@ -3,6 +3,12 @@ set -e set -x +org_name=` + git remote -v | + head -n 1 | + sed -r 's#^.*[:/]([^/]*)/_meta.*$#\1#' +` + manyrepos_dir=.many manyrepos_branch=master metarepo_branch=meta @@ -15,6 +21,12 @@ init() { done } +populate() { + mkdir -p .many + find * -maxdepth 0 -type d | + parallel -I"{}" hub clone "${org_name}/{}" "${manyrepos_dir}/{}" +} + sync() { ls $manyrepos_dir | while read project @@ -28,8 +40,8 @@ sync() { check_merge $project done - ls $manyrepos_dir | parallel -I"{}" echo git subtree push --prefix="{}" $manyrepos_dir/"{}" $metarepo_branch - ls $manyrepos_dir | parallel -I"{}" git subtree push --prefix="{}" $manyrepos_dir/"{}" $metarepo_branch + ls $manyrepos_dir | + parallel -I"{}" git subtree push --prefix="{}" $manyrepos_dir/"{}" $metarepo_branch ls $manyrepos_dir | while read project @@ -101,6 +113,9 @@ case $command in init) init $@ ;; + populate) + populate $@ + ;; sync) sync $@ ;;