1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

tool/git-refresh

* tool/git-refresh: tool to clone or update git working directory.

* Makefile.in: use git-refresh.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@58217 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
nobu 2017-03-30 06:44:27 +00:00
parent a84259659e
commit c73db5c172
2 changed files with 56 additions and 57 deletions

View file

@ -473,76 +473,32 @@ update-download:: update-config_files
after-update:: common-srcs
update-mspec:
@$(CHDIR) $(srcdir); \
if [ -d spec/mspec ]; then \
echo updating mspec ...; \
$(Q1:0=:) set -x; \
cd spec/mspec && \
exec git pull; \
else \
echo retrieving mspec ...; \
$(Q1:0=:) set -x; \
exec git clone $(MSPEC_GIT_URL) spec/mspec; \
fi
$(Q) $(srcdir)/tool/git-refresh -C $(srcdir)/spec $(Q1:0=-q) \
$(MSPEC_GIT_URL) mspec $(GIT_OPTS)
$(Q)$(CHDIR) $(srcdir)/spec/mspec && exec git --no-pager log -1 --oneline
update-rubyspec: update-mspec
@$(CHDIR) $(srcdir); \
if [ -d spec/rubyspec ]; then \
echo updating rubyspec ...; \
$(Q1:0=:) set -x; \
cd spec/rubyspec && \
exec git pull; \
else \
echo retrieving rubyspec ...; \
$(Q1:0=:) set -x; \
exec git clone $(RUBYSPEC_GIT_URL) spec/rubyspec; \
fi
$(Q) $(srcdir)/tool/git-refresh -C $(srcdir)/spec $(Q1:0=-q) \
$(RUBYSPEC_GIT_URL) rubyspec $(GIT_OPTS)
$(Q)$(CHDIR) $(srcdir)/spec/rubyspec && exec git --no-pager log -1 --oneline
test-rubyspec-precheck:
@if [ ! -d $(srcdir)/spec/rubyspec ]; then echo No rubyspec here. make update-rubyspec first.; exit 1; fi
update-doclie:
@$(CHDIR) $(srcdir); \
if [ -d coverage/doclie ]; then \
echo updating doclie ...; \
$(Q1:0=:) set -x; \
cd coverage/doclie && \
git fetch && \
exec git checkout $(DOCLIE_GIT_REF); \
else \
echo retrieving doclie ...; \
$(Q1:0=:) set -x; \
exec git clone --branch $(DOCLIE_GIT_REF) $(DOCLIE_GIT_URL) coverage/doclie; \
fi
$(Q) $(srcdir)/tool/git-refresh -C $(srcdir)/coverage $(Q1:0=-q) \
--branch $(DOCLIE_GIT_REF) \
$(DOCLIE_GIT_URL) doclie $(GIT_OPTS)
update-simplecov-html:
@$(CHDIR) $(srcdir); \
if [ -d coverage/simplecov-html ]; then \
echo updating simplecov-html ...; \
$(Q1:0=:) set -x; \
cd coverage/simplecov-html && \
git fetch && \
exec git checkout $(SIMPLECOV_HTML_GIT_REF); \
else \
echo retrieving simplecov-html ...; \
exec git clone --branch $(SIMPLECOV_HTML_GIT_REF) $(SIMPLECOV_HTML_GIT_URL) coverage/simplecov-html; \
fi
$(Q) $(srcdir)/tool/git-refresh -C $(srcdir)/coverage $(Q1:0=-q) \
--branch $(SIMPLECOV_HTML_GIT_REF) \
$(SIMPLECOV_HTML_GIT_URL) simplecov-html $(GIT_OPTS)
update-simplecov:
@$(CHDIR) $(srcdir); \
if [ -d coverage/simplecov ]; then \
echo updating simplecov ...; \
$(Q1:0=:) set -x; \
cd coverage/simplecov && \
git fetch && \
exec git checkout $(SIMPLECOV_GIT_REF); \
else \
echo retrieving simplecov ...; \
$(Q1:0=:) set -x; \
exec git clone --branch $(SIMPLECOV_GIT_REF) $(SIMPLECOV_GIT_URL) coverage/simplecov; \
fi
$(Q) $(srcdir)/tool/git-refresh -C $(srcdir)/coverage $(Q1:0=-q) \
--branch $(SIMPLECOV_GIT_REF) \
$(SIMPLECOV_GIT_URL) simplecov-html $(GIT_OPTS)
update-coverage: update-simplecov update-simplecov-html update-doclie

43
tool/git-refresh Executable file
View file

@ -0,0 +1,43 @@
#!/bin/sh
set -e
quiet=
branch=
OPT_SPEC="\
${0##*/} [options] URL dir [options]
--
C=directory Change directory
q,quiet Quiet
b,branch=branch Checkout branch
"
rev="$(echo "$OPT_SPEC" | git rev-parse --parseopt -- "$@")"
status=$?
eval "$rev"
[ $status = 0 ] || exit $status
until [ $# = 0 ]; do
case "$1" in
--) shift; break;;
-C) shift; cd "$1";;
-q) quiet=1;;
-b) shift; branch="$1";;
-*) echo "unknown option: $1" 1>&2; exit 1;;
*) break;;
esac
shift
done
url="$1"
dir="$2"
shift 2
if [ -d "$dir" ]; then
echo updating "${dir#*/}" ...
[ $quiet ] || set -x
cd "$dir"
git fetch "$@"
exec git checkout ${branch:+"$branch"} "$@"
else
echo retrieving "${dir#*/}" ...
[ $quiet ] || set -x
exec git clone "$url" "$dir" "$@"
fi