Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
P
postgres-lambda-diff
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Jakob Huber
postgres-lambda-diff
Commits
993ce4e6
Commit
993ce4e6
authored
13 years ago
by
Bruce Momjian
Browse files
Options
Downloads
Patches
Plain Diff
Add options to git_changelog for use in major release note creation:
--details-after --master-only --oldest-first
parent
537b2669
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/tools/git_changelog
+53
-15
53 additions, 15 deletions
src/tools/git_changelog
with
53 additions
and
15 deletions
src/tools/git_changelog
+
53
−
15
View file @
993ce4e6
...
@@ -40,10 +40,19 @@ my @BRANCHES = qw(master
...
@@ -40,10 +40,19 @@ my @BRANCHES = qw(master
# Might want to make this parameter user-settable.
# Might want to make this parameter user-settable.
my
$timestamp_slop
=
600
;
my
$timestamp_slop
=
600
;
my
$details_after
=
0
;
my
$post_date
=
0
;
my
$post_date
=
0
;
my
$master_only
=
0
;
my
$oldest_first
=
0
;
my
$since
;
my
$since
;
Getopt::Long::
GetOptions
('
post-date
'
=>
\
$post_date
,
my
@output_buffer
;
'
since=s
'
=>
\
$since
)
||
usage
();
my
$output_line
=
'';
Getopt::Long::
GetOptions
('
details-after
'
=>
\
$details_after
,
'
master-only
'
=>
\
$master_only
,
'
post-date
'
=>
\
$post_date
,
'
oldest-first
'
=>
\
$oldest_first
,
'
since=s
'
=>
\
$since
)
||
usage
();
usage
()
if
@ARGV
;
usage
()
if
@ARGV
;
my
@git
=
qw(git log --format=fuller --date=iso)
;
my
@git
=
qw(git log --format=fuller --date=iso)
;
...
@@ -179,17 +188,17 @@ while (1) {
...
@@ -179,17 +188,17 @@ while (1) {
last
if
!
defined
$best_branch
;
last
if
!
defined
$best_branch
;
my
$winner
=
my
$winner
=
$all_commits_by_branch
{
$best_branch
}
->
[
$position
{
$best_branch
}];
$all_commits_by_branch
{
$best_branch
}
->
[
$position
{
$best_branch
}];
printf
"
Author: %s
\n
",
$winner
->
{'
author
'};
foreach
my
$c
(
@
{
$winner
->
{'
commits
'}})
{
# check for master-only
printf
"
Branch: %s
",
$c
->
{'
branch
'};
if
(
!
$master_only
||
(
$winner
->
{'
commits
'}[
0
]
->
{'
branch
'}
eq
'
master
'
&&
if
(
defined
$c
->
{'
last_tag
'})
{
@
{
$winner
->
{'
commits
'}}
==
1
))
{
printf
"
Release: %s
",
$c
->
{'
last_tag
'};
output_details
(
$winner
)
if
(
!
$details_after
);
}
output_str
("
%s
",
$winner
->
{'
message
'}
.
"
\n
");
printf
"
[%s] %s
\n
",
substr
(
$c
->
{'
commit
'},
0
,
9
),
$c
->
{'
date
'};
output_details
(
$winner
)
if
(
$details_after
);
unshift
(
@output_buffer
,
$output_line
)
if
(
$oldest_first
);
$output_line
=
'';
}
}
print
"
\n
";
print
$winner
->
{'
message
'};
print
"
\n
";
$winner
->
{'
done
'}
=
1
;
$winner
->
{'
done
'}
=
1
;
for
my
$branch
(
@BRANCHES
)
{
for
my
$branch
(
@BRANCHES
)
{
my
$leader
=
$all_commits_by_branch
{
$branch
}
->
[
$position
{
$branch
}];
my
$leader
=
$all_commits_by_branch
{
$branch
}
->
[
$position
{
$branch
}];
...
@@ -200,6 +209,8 @@ while (1) {
...
@@ -200,6 +209,8 @@ while (1) {
}
}
}
}
print
@output_buffer
if
(
$oldest_first
);
sub
push_commit
{
sub
push_commit
{
my
(
$c
)
=
@_
;
my
(
$c
)
=
@_
;
my
$ht
=
hash_commit
(
$c
);
my
$ht
=
hash_commit
(
$c
);
...
@@ -258,11 +269,38 @@ sub parse_datetime {
...
@@ -258,11 +269,38 @@ sub parse_datetime {
return
$gm
-
$tzoffset
;
return
$gm
-
$tzoffset
;
}
}
sub
output_str
{
(
$oldest_first
)
?
(
$output_line
.=
sprintf
(
shift
,
@
_
))
:
printf
(
@
_
);
}
sub
output_details
{
my
$item
=
shift
;
if
(
$details_after
)
{
$item
->
{'
author
'}
=~
m{^(.*?)\s*<[^>]*>$}
;
# output only author name, not email address
output_str
("
(%s)
\n
",
$
1
);
}
else
{
output_str
("
Author: %s
\n
",
$item
->
{'
author
'});
}
foreach
my
$c
(
@
{
$item
->
{'
commits
'}})
{
output_str
("
Branch: %s
",
$c
->
{'
branch
'})
if
(
!
$master_only
);
if
(
defined
$c
->
{'
last_tag
'})
{
output_str
("
Release: %s
",
$c
->
{'
last_tag
'});
}
output_str
("
[%s] %s
\n
",
substr
(
$c
->
{'
commit
'},
0
,
9
),
$c
->
{'
date
'});
}
output_str
("
\n
");
}
sub
usage
{
sub
usage
{
print
STDERR
<<EOM;
print
STDERR
<<EOM;
Usage: git_changelog [--post-date/-p] [--since=SINCE]
Usage: git_changelog [--details-after/-d] [--master-only/-m] [--oldest-first/-o] [--post-date/-p] [--since=SINCE]
--post-date Show branches made after a commit occurred
--details-after Show branch and author info after the commit description
--since Print only commits dated since SINCE
--master-only Show commits made exclusively to the master branch
--oldest-first Show oldest commits first
--post-date Show branches made after a commit occurred
--since Print only commits dated since SINCE
EOM
EOM
exit
1
;
exit
1
;
}
}
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment