-
Notifications
You must be signed in to change notification settings - Fork 2
/
update-solr-upstream-base.sh
executable file
·41 lines (32 loc) · 1.24 KB
/
update-solr-upstream-base.sh
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
BASE_DIR="$(cd "$(dirname "$0")" && pwd -L)"
SOLR_UPSTREAM_BASE="solr-upstream-base"
specific_ref="$1"
cd "$BASE_DIR"
current_branch="$(git rev-parse --abbrev-ref HEAD)"
if [ "$current_branch" != "$SOLR_UPSTREAM_BASE" ]; then
echo "not on branch \"$SOLR_UPSTREAM_BASE\"" >&2
exit 1
fi
if [ -n "$specific_ref" ]; then
ref="releases/lucene-solr/$specific_ref"
else
latest_tag=$(git ls-remote --tags git@github.com:apache/lucene-solr.git 'refs/tags/releases/lucene-solr/*' | grep -v '\^' | sort -t '/' -k 3 -V | tail -n 1)
ref="${latest_tag##*refs/tags/}"
fi
while read file; do
mkdir -p "$BASE_DIR/src/main/java/${file%/*}"
curl -s "https://raw.githubusercontent.com/apache/lucene-solr/$ref/solr/core/src/java/$file" > "$BASE_DIR/src/main/java/$file"
done << EOF
org/apache/solr/handler/component/FacetComponent.java
org/apache/solr/request/SimpleFacets.java
org/apache/solr/request/DocValuesFacets.java
EOF
while read file; do
mkdir -p "$BASE_DIR/src/main/java/${file%/*}"
curl -s "https://raw.githubusercontent.com/apache/lucene-solr/$ref/solr/solrj/src/java/$file" > "$BASE_DIR/src/main/java/$file"
done << EOF
org/apache/solr/common/params/FacetParams.java
EOF
git add .
git commit -m "solr upstream base for tag \"$ref\""