Skip to content

Commit 7694eb5

Browse files
authored
Add .gitattributes and update changelog.sh (#33)
* Update changelog.sh * Add .gitattributes Also update Makefile release.sh requirements.txt
1 parent b682713 commit 7694eb5

File tree

5 files changed

+46
-21
lines changed

5 files changed

+46
-21
lines changed

.gitattributes

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
.github export-ignore
2+
.gitattributes export-ignore
3+
.gitignore export-ignore
4+
.gitkeep export-ignore
5+
.gitmodules export-ignore
6+
.gitlab-ci.yml export-ignore
7+
scripts export-ignore
8+
Makefile export-ignore
9+
release.sh export-ignore
10+
requirements.txt export-ignore
11+
setup.cfg export-ignore

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ $(ZIP_FILE):
1818
zip: $(ZIP_FILE)
1919

2020
clean_arch:
21-
rm -f $(ZIP_FILE)
21+
rm -f $(ZIP_FILE)
2222

2323
clean:
2424
rm -f $(ZIP_FILE)

release.sh

100644100755
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,5 +24,5 @@ make
2424
if [[ $TAG != *-* ]]
2525
then
2626
make zip
27-
make upload
27+
make upload
2828
fi

requirements.txt

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,2 @@
11
flake8
2-
sphinx
3-
sphinx-autobuild
2+
future

scripts/changelog.sh

Lines changed: 32 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,34 @@
1-
#!/bin/sh
2-
echo "context.elementum changelog"
1+
#!/bin/bash
2+
3+
set -o errexit
4+
set -o nounset
5+
6+
git_dir="$(git rev-parse --show-toplevel)"
7+
if [[ -f "$git_dir"/addon.xml ]]; then
8+
name="$(grep -Po '(?<=addon id=")[^"]+(?=")' "$git_dir"/addon.xml)"
9+
else
10+
name="$(basename "$(git rev-parse --show-toplevel)")"
11+
fi
12+
13+
echo "$name changelog"
314
echo "==============="
4-
git tag -l | sort -u -r -V | while read TAG ; do
5-
if [ $NEXT ];then
6-
TAG_DATE=$(git log --no-merges --date=short --format="%ad" $TAG..$NEXT | head -1)
7-
echo "[B]$NEXT[/B] - $TAG_DATE"
15+
16+
cat="$(command -v cat)"
17+
export GIT_PAGER="$cat"
18+
19+
previous_tag=0
20+
while read -r current_tag; do
21+
if [[ "$previous_tag" != 0 ]]; then
22+
tag_date=$(git log -1 --pretty=format:'%ad' --date=short ${previous_tag})
23+
printf "[B]%s[/B] - %s\n" "${previous_tag}" "${tag_date}"
24+
cmp="${current_tag}...${previous_tag}"
25+
[[ $current_tag == "LAST" ]] && cmp="${previous_tag}"
26+
git log "$cmp" --no-merges --pretty=format:' - %s' | awk -F ' - ' '
27+
{
28+
gsub(/.{50,60} /,"&\n ", $2); \
29+
printf "%s - %s\n", $1, $2
30+
}'
831
fi
9-
GIT_PAGER=cat git log --no-merges --format=" - %s" $TAG..$NEXT | awk -F ' - ' '
10-
{ gsub(/.{50,60} /,"&\n ", $2); \
11-
printf "%s - %s\n", $1, $2 }'
12-
NEXT=$TAG
13-
echo
14-
done
15-
FIRST=$(git tag -l | head -1)
16-
TAG_DATE=$(git log --no-merges --date=short --format="%ad" $FIRST | head -1)
17-
echo "[B]$FIRST[/B] - $TAG_DATE"
18-
GIT_PAGER=cat git log --no-merges --format=" - %s" $FIRST
19-
echo
32+
previous_tag="${current_tag}"
33+
printf "\n"
34+
done < <(git tag -l | sort -u -r -V; echo LAST)

0 commit comments

Comments
 (0)