-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathimport
More file actions
executable file
·41 lines (33 loc) · 1.11 KB
/
import
File metadata and controls
executable file
·41 lines (33 loc) · 1.11 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
#!/usr/bin/env bash
set -eu -o pipefail
die() {
local exitcode="$1"; shift
echo 1>&2 "$@"
exit "$exitcode"
}
warn() { echo 1>&2 "$@"; }
check_submodules() {
count=$(git submodule status --recursive | sed -n -e '/^[^ ]/p' | wc -l)
[[ $count -eq 0 ]] || {
warn "$count Git submodules are not up to date"
warn 'Run `git submodule update --init`?'
}
[[ -x $gcf ]] || die 3 "Canot find $gcf"
}
[[ ${#@} -gt 0 ]] || die 2 "Usage: import <revisiondate>"
rev="$1"; shift
[[ ${#@} -eq 0 ]] || die 2 "Usage: import <revisiondate>"
gcf=git-commit-filetree/bin/git-commit-filetree
file="$rev.7z" # previously was .zip
url="http://takeda-toshiya.my.coocan.jp/common/history/$file"
command cd -P $(dirname "$0")
check_submodules
mkdir -p .build/
echo "----- Downloading: $url"
curl --fail --create-dirs -o ".build/$file" "$url"
echo "----- Extracting $file"
rm -rf ".build/$rev"
(cd .build && p7zip -d "$file")
#echo "----- Committing $rev on vendor branch"
GIT_COMMIT_MESSAGE=$(printf "Import CSCP version $rev\n\nFrom: $url") \
git-commit-filetree/bin/git-commit-filetree vendor ".build/$rev"