File: changelog

package info (click to toggle)
git-lfs 3.3.0-1%2Bdeb12u1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 4,676 kB
  • sloc: sh: 19,133; makefile: 487; ruby: 228
file content (120 lines) | stat: -rwxr-xr-x 2,183 bytes parent folder | download | duplicates (3)
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
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
#!/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/git-lfs/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)"
}

revisions_in () {
  git rev-list --merges --first-parent $1
}

noninteractive () {
  local range="$1"

  printf '### Uncategorized\n'
  for rev in $(revisions_in "$range"); do
    commit_summary $rev
  done
  cat <<-EOF

### Features

### Bugs

### Misc
EOF
}

if [ "$1" = "--noninteractive" ]; then
  noninteractive=1
  shift
fi

range=$1

if [ "$range" = "" ]; then
  echo "Usage: $0 [options] base..next"
  exit 1
fi

if [ -n "$noninteractive" ]
then
  noninteractive "$range"
  exit
fi

features=""
bugs=""
misc=""

for rev in $(revisions_in "$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