Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Open sidebar
Common
GitLabChangelogGen
Commits
bda0d232
Commit
bda0d232
authored
6 years ago
by
Pablo Toharia
Browse files
Options
Download
Email Patches
Plain Diff
Added tags.
parent
7207568d
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
44 additions
and
4 deletions
+44
-4
gitlabChangelogGen.sh
gitlabChangelogGen.sh
+44
-4
No files found.
gitlabChangelogGen.sh
View file @
bda0d232
#!/bin/bash
#Dump output of "git log" command to a string
echo
"# "
$(
grep
project CMakeLists.txt |
head
-n1
|
cut
-d
"("
-f2
|
sed
"s/^[
\t
]*//"
|
cut
-d
" "
-f1
)
echo
""
echo
"## git master"
echo
""
#Dump output of "git log" command to a string
LOG
=
$(
git log 2>&1
)
tagCommitLogLine
=
""
tagCommits
=
""
tags
=
""
for
tag
in
`
git tag
-l
`
;
do
tagCommit
=
`
git show
$tag
|
grep
commit |
cut
-d
" "
-f2
`
tagCommitLogLine
=
$(
echo
"
${
LOG
}
"
|
grep
$tagCommit
-n
|
cut
-d
:
-f1
)
;
if
[
!
-z
$tagCommitLogLine
]
&&
[
!
-z
$tagCommit
]
&&
[
!
-z
$tag
]
;
then
tagCommitLogLines
=
$tagCommitLogLine
" "
$tagCommitLogLines
tagCommits
=
$tagCommit
' '
$tagCommits
tags
=
$tag
' '
$tags
fi
done
tagCommitsCombined
=
$(
paste
-d
' '
<
(
echo
"
$tagCommitLogLines
"
|
sed
-e
"s/ /
\n
/g"
)
<
(
echo
"
$tagCommits
"
|
sed
-e
"s/ /
\n
/g"
)
<
(
echo
"
$tags
"
|
sed
-e
"s/ /
\n
/g"
)
)
$(
paste
-d
' '
<
(
echo
"
$tagCommitLogLines
"
|
sed
-e
"s/ /
\n
/g"
)
<
(
echo
"
$tagCommits
"
|
sed
-e
"s/ /
\n
/g"
)
<
(
echo
"
$tags
"
|
sed
-e
"s/ /
\n
/g"
)
|
sort
-n
|
tail
-n
+2
>
.tagscombined
)
tagCommit
=
$(
cat
.tagscombined |
head
-n1
)
cp
.tagscombined .tagscombined.old
tail
-n
+2 .tagscombined.old
>
.tagscombined
#Search for "See merge request !xxx" lines
for
mrLine
in
$(
echo
"
${
LOG
}
"
|
grep
"See merge request"
-n
|
cut
-d
:
-f1
)
;
do
if
[
!
-z
"
$tagCommit
"
]
;
then
if
[
$(
echo
$tagCommit
|
cut
-d
" "
-f1
)
-le
$mrLine
]
;
then
echo
echo
"## Release "
$(
echo
$tagCommit
|
cut
-d
" "
-f3
)
echo
tagCommit
=
$(
cat
.tagscombined |
head
-n1
)
cp
.tagscombined .tagscombined.old
tail
-n
+2 .tagscombined.old
>
.tagscombined
fi
fi
#Guess the start and end lines of this block
let
startLine
=
mrLine-3
let
endLine
=
mrLine-2
while
[
1
]
do
#Check if startLine is like "Merge branch xxxx into yyyy"
echo
"
${
LOG
}
"
|
sed
"
${
startLine
}
q;d"
|
grep
-q
-e
"Merge branch"
-e
"into"
#Check if startLine is like "Merge branch xxxx into yyyy"
echo
"
${
LOG
}
"
|
sed
"
${
startLine
}
q;d"
|
grep
-q
-e
"Merge branch"
-e
"into"
if
[[
$?
-eq
0
]]
;
then
#Cut from the next line
...
...
@@ -32,6 +72,6 @@ do
mrNum
=
$(
echo
"
${
LOG
}
"
|
sed
"
${
mrLine
}
q;d"
|
cut
-d
!
-f2
)
#Dump output
echo
"* [!"
${
mrNum
}
"]"
$
{
mrMsg
}
echo
"* [!"
${
mrNum
}
"]"
$
(
echo
${
mrMsg
}
|
cut
-d
"@"
-f1
)
done
This diff is collapsed.
Click to expand it.
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment