From d091725b9af5057d0ff85fb84bb792450b4a1f92 Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Fri, 12 Jun 2015 17:01:33 +0200 Subject: Remove git scripts, they are now in separate repository --- git/branch.sh | 21 ------- git/checkout.sh | 26 -------- git/commit.sh | 58 ----------------- git/diff.sh | 29 --------- git/fetch.sh | 21 ------- git/gc.sh | 21 ------- git/git-cheatsheet.txt | 72 --------------------- git/makefile | 168 ------------------------------------------------- git/merge.sh | 43 ------------- git/modules | 3 +- git/pull.sh | 21 ------- git/push.sh | 34 ---------- git/rebase.sh | 26 -------- git/remote.sh | 21 ------- git/stash.sh | 30 --------- git/stat.sh | 21 ------- git/tag.sh | 26 -------- makefile | 168 +++++++++++++++++++++++++++++++++++++++++++++++++ 18 files changed, 170 insertions(+), 639 deletions(-) delete mode 100755 git/branch.sh delete mode 100755 git/checkout.sh delete mode 100755 git/commit.sh delete mode 100755 git/diff.sh delete mode 100755 git/fetch.sh delete mode 100755 git/gc.sh delete mode 100644 git/git-cheatsheet.txt delete mode 100644 git/makefile delete mode 100755 git/merge.sh delete mode 100755 git/pull.sh delete mode 100755 git/push.sh delete mode 100755 git/rebase.sh delete mode 100755 git/remote.sh delete mode 100755 git/stash.sh delete mode 100755 git/stat.sh delete mode 100755 git/tag.sh create mode 100644 makefile diff --git a/git/branch.sh b/git/branch.sh deleted file mode 100755 index 14d72dd..0000000 --- a/git/branch.sh +++ /dev/null @@ -1,21 +0,0 @@ -#! /bin/sh - -# Assume this script never run via PATH. -# -self=`realpath $0` -. `dirname $self`/modules - -wd=`pwd` - -for i in $modules; do - echo "branch $i" 1>&2 - cd $i - git branch $* - - if [ $? -ne 0 ]; then - echo "branch FAILED" 1>&2 - exit 1 - fi - - cd $wd -done diff --git a/git/checkout.sh b/git/checkout.sh deleted file mode 100755 index 11643c4..0000000 --- a/git/checkout.sh +++ /dev/null @@ -1,26 +0,0 @@ -#! /bin/sh - -# Assume this script never run via PATH. -# -self=`realpath $0` -. `dirname $self`/modules - -wd=`pwd` - -if [ "$1" = "" ]; then - echo "branch name expected" 1>&2 - exit 1 -fi - -for i in $modules; do - echo "checkout $i" 1>&2 - cd $i - git checkout $* - - if [ $? -ne 0 ]; then - echo "checkout FAILED" 1>&2 - exit 1 - fi - - cd $wd -done diff --git a/git/commit.sh b/git/commit.sh deleted file mode 100755 index aa96c8c..0000000 --- a/git/commit.sh +++ /dev/null @@ -1,58 +0,0 @@ -#! /bin/sh - -# Assume this script never run via PATH. -# -self=`realpath $0` -. `dirname $self`/modules - -wd=`pwd` - -if [ "$1" = "-i" ]; then - add=n -else - add=y -fi - -if [ "$EDITOR" = "" ]; then - echo "no editor specified with the EDITOR variable" 1>&2 - exit 1 -fi - -msg_file=`mktemp -p /tmp` -$EDITOR "$msg_file" - -if [ $? -ne 0 ]; then - echo "$EDITOR failed" 1>&2 - rm -f $msg_file - exit 1 -fi - -if test ! -s "$msg_file"; then - echo "commit message is empty" 1>&2 - rm -f $msg_file - exit 1 -fi - -for i in $modules; do - echo "commit $i" 1>&2 - cd $i - if [ "$add" = "y" ]; then - git add . - - if [ $? -ne 0 ]; then - echo "add FAILED" 1>&2 - exit 1 - fi - - fi - git commit -F $msg_file - -# if [ $? -ne 0 ]; then -# echo "commit FAILED" 1>&2 -# exit 1 -# fi - - cd $wd -done - -rm -f $msg_file diff --git a/git/diff.sh b/git/diff.sh deleted file mode 100755 index bd4639e..0000000 --- a/git/diff.sh +++ /dev/null @@ -1,29 +0,0 @@ -#! /bin/sh - -# Assume this script never run via PATH. -# -self=`realpath $0` -. `dirname $self`/modules - -wd=`pwd` - -for i in $modules; do - echo "diff $i" 1>&2 - cd $i - - git --no-pager diff - - if [ $? -ne 0 ]; then - echo "diff FAILED" 1>&2 - exit 1 - fi - - git --no-pager diff --check - - if [ $? -ne 0 ]; then - echo "diff --check FAILED" 1>&2 - exit 1 - fi - - cd $wd -done diff --git a/git/fetch.sh b/git/fetch.sh deleted file mode 100755 index 185d531..0000000 --- a/git/fetch.sh +++ /dev/null @@ -1,21 +0,0 @@ -#! /bin/sh - -# Assume this script never run via PATH. -# -self=`realpath $0` -. `dirname $self`/modules - -wd=`pwd` - -for i in $modules; do - echo "fetch $i" 1>&2 - cd $i - git fetch $* - - if [ $? -ne 0 ]; then - echo "fetch FAILED" 1>&2 - exit 1 - fi - - cd $wd -done diff --git a/git/gc.sh b/git/gc.sh deleted file mode 100755 index c12be6f..0000000 --- a/git/gc.sh +++ /dev/null @@ -1,21 +0,0 @@ -#! /bin/sh - -# Assume this script never run via PATH. -# -self=`realpath $0` -. `dirname $self`/modules - -wd=`pwd` - -for i in $modules; do - echo "gc $i" 1>&2 - cd $i - git gc - - if [ $? -ne 0 ]; then - echo "gc FAILED" 1>&2 - exit 1 - fi - - cd $wd -done diff --git a/git/git-cheatsheet.txt b/git/git-cheatsheet.txt deleted file mode 100644 index 211e808..0000000 --- a/git/git-cheatsheet.txt +++ /dev/null @@ -1,72 +0,0 @@ -Tag - - git tag -a x.y.z -m "Tag version x.y.z" - -Squash multiple commits into one - - git rebase -i HEAD~ - - http://www.gitready.com/advanced/2009/02/10/squashing-commits-with-rebase.html - -Change commit message - - git commit --amend - -Revert uncommited changes - - git reset --hard HEAD - -Copy commit from one branch to the other - - # On the source branch - git log -1 - git cout - git cherry-pick - -Setup remote repository - - On remote: - - 1. mkdir proj.git - 2. chgrp scm proj.git - 2. cd proj.git - 3. git --bare init --shared=all - 4. chgrp -R scm ../proj.git - 5. edit description - 5a touch git-daemon-export-ok && chgrp scm git-daemon-export-ok && \ - chmod g+w git-daemon-export-ok # if public - 6. cd hooks - 7. mv post-update.sample post-update - - On local: - - 1. git remote add origin scm.codesynthesis.com:/var/scm/proj/proj.git - 2. git push --tags origin master - 3. # blow the local project and do clone - git clone scm.codesynthesis.com:/var/scm/proj/proj.git [name] - -Delete a branch from a remote repository - - git push origin :experimental - - Find a ref that matches experimental in the origin repository (e.g. - refs/heads/experimental), and delete it. - - Using the push.sh script: - - ./push.sh : - -Rebasing - - Local (e.g., from a feature branch to master): - - git rebase [] - - If is not specified, current branch is used. If is - specified, it is checked out. - - Remote (e.g., merge someone else's changes): - - git fetch - git rebase origin[/master] - git push --tags origin diff --git a/git/makefile b/git/makefile deleted file mode 100644 index 3abd510..0000000 --- a/git/makefile +++ /dev/null @@ -1,168 +0,0 @@ -# Root makefile that can be used to build/run tests and/or examples for -# some or all databases: -# -# make - build tests and examples for all the databases -# make t - build only tests for all the databases -# make e - build only examples for all the databases -# -# make - build tests and examples for -# make -t - build only tests for -# make -e - build only examples for -# -# make test - run tests and examples for all the databases -# make ttest - run only tests for all the databases -# make etest - run only examples for all the databases -# -# make -test - run tests and examples for -# make -ttest - run only tests for -# make -etest - run only examples for -# -# make clean - clean tests and examples for all the databases -# make tclean - clean only tests for all the databases -# make eclean - clean only examples for all the databases -# -# make -clean - clean tests and examples for -# make -tclean - clean only tests for -# make -eclean - clean only examples for -# -# Additional command line variables: -# -# conf - configuration to build (e.g., conf=c++) -# -# Note that you can run tests and examples with -j; the makefile is -# smart enough to build the tests and examples in parallel but run -# them sequentially. -# -# Ordering: -# - tests before examples -# - build before run -# -db := mssql oracle pgsql sqlite mysql common - -tdb := $(db) -edb := $(filter-out common,$(db)) # No multi-database build for examples. - -# Disable parallelism for this makefile (the sub-directories will -# still be built with parallelism). This makes this makefile much -# more usable. -# -.NOTPARALLEL: - -ifeq ($(conf),) -conf_suffix := default -else -conf_suffix := builds/$(conf) -endif - -.PHONY: t e all $(db) \ -ttest etest test $(addsuffix -test,$(db)) \ -tclean eclean clean $(addsuffix -clean,$(db)) - -all: t e -t: $(addsuffix -t,$(tdb)) -e: $(addsuffix -e,$(edb)) - -test: ttest etest -ttest: t $(addsuffix -ttest,$(tdb)) -etest: e $(addsuffix -etest,$(edb)) - -clean: tclean eclean -tclean: $(addsuffix -tclean,$(tdb)) -eclean: $(addsuffix -eclean,$(edb)) - -define test_deps -$1-test: $1-t $(if $(filter $1,$(edb)),$1-e) - -endef - -$(eval $(foreach d,$(tdb),$(call test_deps,$d))) - -define set_edir -edir := $$(wildcard examples-$1-$(conf_suffix)) -ifeq ($(conf),) -ifeq ($$(edir),) -edir := examples-$1 -endif -endif -endef - -define set_tdir -tdir := $$(wildcard tests-$1-$(conf_suffix)) -ifeq ($(conf),) -ifeq ($$(tdir),) -tdir := tests-$1 -endif -endif -endef - -define ebuild_rule -.PHONY: $1-e -$1: $1-e -$1-e: dir := $$(edir) -$1-e: - @$$(MAKE) -C $$(dir) -endef - -define tbuild_rule -.PHONY: $1-t -$1: $1-t -$1-t: dir := $$(tdir) -$1-t: - @$$(MAKE) -C $$(dir) -endef - -define etest_rule -.PHONY: $1-etest -$1-test: $1-etest -$1-etest: dir := $$(edir) -$1-etest: $1-e - @$$(MAKE) -C $$(dir) -j 1 test -endef - -define ttest_rule -.PHONY: $1-ttest -$1-test: $1-ttest -$1-ttest: dir := $$(tdir) -$1-ttest: $1-t - @$$(MAKE) -C $$(dir) -j 1 test -endef - -define eclean_rule -.PHONY: $1-eclean -$1-clean: $1-eclean -$1-eclean: dir := $$(edir) -$1-eclean: - @$$(MAKE) -C $$(dir) clean -endef - -define tclean_rule -.PHONY: $1-tclean -$1-clean: $1-tclean -$1-tclean: dir := $$(tdir) -$1-tclean: - @$$(MAKE) -C $$(dir) clean -endef - -# Note: empty line at the end is important. -# -# -define erules -$(call set_edir,$1) -$(call ebuild_rule,$1) -$(call etest_rule,$1) -$(call eclean_rule,$1) - -endef - -define trules -$(call set_tdir,$1) -$(call tbuild_rule,$1) -$(call ttest_rule,$1) -$(call tclean_rule,$1) - -endef - -# Do all tests for all the database first. Then examples. -# -$(eval $(foreach d,$(tdb),$(call trules,$d))) -$(eval $(foreach d,$(edb),$(call erules,$d))) diff --git a/git/merge.sh b/git/merge.sh deleted file mode 100755 index 898a0c0..0000000 --- a/git/merge.sh +++ /dev/null @@ -1,43 +0,0 @@ -#! /bin/sh - -# Assume this script never run via PATH. -# -self=`realpath $0` -. `dirname $self`/modules - -wd=`pwd` - -if [ "$1" = "" ]; then - echo "source branch name expected" 1>&2 - exit 1 -fi - -for i in $modules; do - echo "merge $i" 1>&2 - cd $i - - br=`git symbolic-ref -q HEAD` - br=`echo $br | sed -e 's%^refs/heads/%%'` - - # Only allow fast-forward merges into master. - # - if [ "$br" = "master" ]; then - git merge --ff-only $* - else - git merge $* - fi - - if [ $? -ne 0 ]; then - echo 1>&2 - echo "merge FAILED" 1>&2 - echo 1>&2 - - # Merge failures (conflicts) into non-master branches are ok. - # - if [ "$br" = "master" ]; then - exit 1 - fi - fi - - cd $wd -done diff --git a/git/modules b/git/modules index e247ab3..9585305 100644 --- a/git/modules +++ b/git/modules @@ -11,4 +11,5 @@ odb \ examples \ tests \ change \ -etc" +etc \ +git" diff --git a/git/pull.sh b/git/pull.sh deleted file mode 100755 index 07684da..0000000 --- a/git/pull.sh +++ /dev/null @@ -1,21 +0,0 @@ -#! /bin/sh - -# Assume this script never run via PATH. -# -self=`realpath $0` -. `dirname $self`/modules - -wd=`pwd` - -for i in $modules; do - echo "pull $i" 1>&2 - cd $i - git pull $* - - if [ $? -ne 0 ]; then - echo "pull FAILED" 1>&2 - exit 1 - fi - - cd $wd -done diff --git a/git/push.sh b/git/push.sh deleted file mode 100755 index d288f3a..0000000 --- a/git/push.sh +++ /dev/null @@ -1,34 +0,0 @@ -#! /bin/sh - -# Assume this script never run via PATH. -# -self=`realpath $0` -. `dirname $self`/modules - -wd=`pwd` -br=$1 - -for i in $modules; do - echo "push $i" 1>&2 - cd $i - - if [ -z "$1" ]; then - br=`git symbolic-ref -q HEAD` - br=`echo $br | sed -e 's%^refs/heads/%%'` - fi - - # Also push tags if we are pushing master. - # - if [ "$br" = "master" ]; then - git push --tags origin master - else - git push $ops origin $1 - fi - - if [ $? -ne 0 ]; then - echo "push FAILED" 1>&2 - exit 1 - fi - - cd $wd -done diff --git a/git/rebase.sh b/git/rebase.sh deleted file mode 100755 index 4248048..0000000 --- a/git/rebase.sh +++ /dev/null @@ -1,26 +0,0 @@ -#! /bin/sh - -# Assume this script never run via PATH. -# -self=`realpath $0` -. `dirname $self`/modules - -wd=`pwd` - -if [ "$1" = "" ]; then - echo "source branch name expected" 1>&2 - exit 1 -fi - -for i in $modules; do - echo "rebase $i" 1>&2 - cd $i - git rebase $* - - if [ $? -ne 0 ]; then - echo "rebase FAILED" 1>&2 - exit 1 - fi - - cd $wd -done diff --git a/git/remote.sh b/git/remote.sh deleted file mode 100755 index acc1e4a..0000000 --- a/git/remote.sh +++ /dev/null @@ -1,21 +0,0 @@ -#! /bin/sh - -# Assume this script never run via PATH. -# -self=`realpath $0` -. `dirname $self`/modules - -wd=`pwd` - -for i in $modules; do - echo "remote $i" 1>&2 - cd $i - git remote $* - - if [ $? -ne 0 ]; then - echo "remote FAILED" 1>&2 - exit 1 - fi - - cd $wd -done diff --git a/git/stash.sh b/git/stash.sh deleted file mode 100755 index 4a3eb99..0000000 --- a/git/stash.sh +++ /dev/null @@ -1,30 +0,0 @@ -#! /bin/sh - -# Assume this script never run via PATH. -# -self=`realpath $0` -. `dirname $self`/modules - -wd=`pwd` - -for i in $modules; do - echo "stash $i" 1>&2 - cd $i - - if [ "$1" = "pop" -o "$1" = "apply" ]; then - l=`git stash list` - if [ -z "$l" ]; then - cd $wd - continue - fi - fi - - git stash $* - - if [ $? -ne 0 ]; then - echo "stash FAILED" 1>&2 - exit 1 - fi - - cd $wd -done diff --git a/git/stat.sh b/git/stat.sh deleted file mode 100755 index 5b9ea45..0000000 --- a/git/stat.sh +++ /dev/null @@ -1,21 +0,0 @@ -#! /bin/sh - -# Assume this script never run via PATH. -# -self=`realpath $0` -. `dirname $self`/modules - -wd=`pwd` - -for i in $modules; do - echo "stat $i" 1>&2 - cd $i - git status - - if [ $? -ne 0 ]; then - echo "stat FAILED" 1>&2 - exit 1 - fi - - cd $wd -done diff --git a/git/tag.sh b/git/tag.sh deleted file mode 100755 index 935934f..0000000 --- a/git/tag.sh +++ /dev/null @@ -1,26 +0,0 @@ -#! /bin/sh - -# Assume this script never run via PATH. -# -self=`realpath $0` -. `dirname $self`/modules - -wd=`pwd` - -if [ "$1" = "" ]; then - echo "missing version" 1>&2 - exit 1 -fi - -for i in $modules; do - echo "tag $i" 1>&2 - cd $i - git tag -a $1 -m "Tag version $1" - - if [ $? -ne 0 ]; then - echo "tag FAILED" 1>&2 - exit 1 - fi - - cd $wd -done diff --git a/makefile b/makefile new file mode 100644 index 0000000..3abd510 --- /dev/null +++ b/makefile @@ -0,0 +1,168 @@ +# Root makefile that can be used to build/run tests and/or examples for +# some or all databases: +# +# make - build tests and examples for all the databases +# make t - build only tests for all the databases +# make e - build only examples for all the databases +# +# make - build tests and examples for +# make -t - build only tests for +# make -e - build only examples for +# +# make test - run tests and examples for all the databases +# make ttest - run only tests for all the databases +# make etest - run only examples for all the databases +# +# make -test - run tests and examples for +# make -ttest - run only tests for +# make -etest - run only examples for +# +# make clean - clean tests and examples for all the databases +# make tclean - clean only tests for all the databases +# make eclean - clean only examples for all the databases +# +# make -clean - clean tests and examples for +# make -tclean - clean only tests for +# make -eclean - clean only examples for +# +# Additional command line variables: +# +# conf - configuration to build (e.g., conf=c++) +# +# Note that you can run tests and examples with -j; the makefile is +# smart enough to build the tests and examples in parallel but run +# them sequentially. +# +# Ordering: +# - tests before examples +# - build before run +# +db := mssql oracle pgsql sqlite mysql common + +tdb := $(db) +edb := $(filter-out common,$(db)) # No multi-database build for examples. + +# Disable parallelism for this makefile (the sub-directories will +# still be built with parallelism). This makes this makefile much +# more usable. +# +.NOTPARALLEL: + +ifeq ($(conf),) +conf_suffix := default +else +conf_suffix := builds/$(conf) +endif + +.PHONY: t e all $(db) \ +ttest etest test $(addsuffix -test,$(db)) \ +tclean eclean clean $(addsuffix -clean,$(db)) + +all: t e +t: $(addsuffix -t,$(tdb)) +e: $(addsuffix -e,$(edb)) + +test: ttest etest +ttest: t $(addsuffix -ttest,$(tdb)) +etest: e $(addsuffix -etest,$(edb)) + +clean: tclean eclean +tclean: $(addsuffix -tclean,$(tdb)) +eclean: $(addsuffix -eclean,$(edb)) + +define test_deps +$1-test: $1-t $(if $(filter $1,$(edb)),$1-e) + +endef + +$(eval $(foreach d,$(tdb),$(call test_deps,$d))) + +define set_edir +edir := $$(wildcard examples-$1-$(conf_suffix)) +ifeq ($(conf),) +ifeq ($$(edir),) +edir := examples-$1 +endif +endif +endef + +define set_tdir +tdir := $$(wildcard tests-$1-$(conf_suffix)) +ifeq ($(conf),) +ifeq ($$(tdir),) +tdir := tests-$1 +endif +endif +endef + +define ebuild_rule +.PHONY: $1-e +$1: $1-e +$1-e: dir := $$(edir) +$1-e: + @$$(MAKE) -C $$(dir) +endef + +define tbuild_rule +.PHONY: $1-t +$1: $1-t +$1-t: dir := $$(tdir) +$1-t: + @$$(MAKE) -C $$(dir) +endef + +define etest_rule +.PHONY: $1-etest +$1-test: $1-etest +$1-etest: dir := $$(edir) +$1-etest: $1-e + @$$(MAKE) -C $$(dir) -j 1 test +endef + +define ttest_rule +.PHONY: $1-ttest +$1-test: $1-ttest +$1-ttest: dir := $$(tdir) +$1-ttest: $1-t + @$$(MAKE) -C $$(dir) -j 1 test +endef + +define eclean_rule +.PHONY: $1-eclean +$1-clean: $1-eclean +$1-eclean: dir := $$(edir) +$1-eclean: + @$$(MAKE) -C $$(dir) clean +endef + +define tclean_rule +.PHONY: $1-tclean +$1-clean: $1-tclean +$1-tclean: dir := $$(tdir) +$1-tclean: + @$$(MAKE) -C $$(dir) clean +endef + +# Note: empty line at the end is important. +# +# +define erules +$(call set_edir,$1) +$(call ebuild_rule,$1) +$(call etest_rule,$1) +$(call eclean_rule,$1) + +endef + +define trules +$(call set_tdir,$1) +$(call tbuild_rule,$1) +$(call ttest_rule,$1) +$(call tclean_rule,$1) + +endef + +# Do all tests for all the database first. Then examples. +# +$(eval $(foreach d,$(tdb),$(call trules,$d))) +$(eval $(foreach d,$(edb),$(call erules,$d))) -- cgit v1.1