forked from git-lfs/git-lfs
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathchangelog
More file actions
executable file
·88 lines (72 loc) · 1.75 KB
/
changelog
File metadata and controls
executable file
·88 lines (72 loc) · 1.75 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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
#!/usr/bin/env bash
#
# Interactively generates a changelog over a range of commits:
commit_summary() {
local hash=$1
pr=$(git show $hash | grep -o "#\([0-9]*\)" | cut -c 2-)
prjson="$(curl -n https://api.github.com/repos/github/git-lfs/pulls/$pr 2>/dev/null)"
title="$(echo $prjson | jq -r -e ".title")"
id="$(echo $prjson | jq -r -e ".number")"
author="$(echo $prjson | jq -r -e ".user.login")"
# If the title begins with "Backport", then strip everything until the actual
# pull-request title.
if grep -q "Backport" <(echo $title); then
title="$(echo $title | sed 's/^[^:]*: //g')"
fi
echo "* $title #$id (@$author)"
}
range=$1
if [ "$range" = "" ]; then
echo "Usage: $0 [options] base..next"
exit 1
fi
features=""
bugs=""
misc=""
for rev in $(git rev-list --merges $range); do
git show $rev
processed=0
while [ $processed -eq 0 ]; do
echo "Categorize this change: [f,b,m,s,?] ?"
read -n 1 opt
echo ""
case $opt in
[fbms])
processed=1
;;
?)
echo "f - mark this merge as a feature"
echo "b - mark this merge as a bugfix"
echo "m - make this merge as a misc. change"
echo "s - skip this merge, excluding it from the changelog"
echo "? - display this help message"
;;
*)
echo "Unknown option: $opt, try again."
;;
esac
done
if [ $opt != "s" ]; then
summary="$(commit_summary $rev)"
fi
case $opt in
f)
features="$(printf "%s\n%s\n" "$features" "$summary")"
;;
b)
bugs="$(printf "%s\n%s\n" "$bugs" "$summary")"
;;
m)
misc="$(printf "%s\n%s\n" "$misc" "$summary")"
;;
esac
done
echo "" >&2
cat <<- EOF
### Features
$features
### Bugs
$bugs
### Misc
$misc
EOF