summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2020-02-27 22:08:39 +0000
committerKarl Berry <karl@freefriends.org>2020-02-27 22:08:39 +0000
commit24fb93d21a9eed45ac085a4d4f4711b28840f70e (patch)
tree27235bcbd6e3c49e4793d486e5169836bc179c52
parent2c9de92aba142ec2e77ebc32d13efda669546395 (diff)
latex-git-log (27feb20)
git-svn-id: svn://tug.org/texlive/trunk@53942 c570f23f-e606-0410-a88d-b1316a301751
-rwxr-xr-xBuild/source/texk/texlive/linked_scripts/latex-git-log/latex-git-log82
-rw-r--r--Master/texmf-dist/doc/support/latex-git-log/README.md (renamed from Master/texmf-dist/doc/support/latex-git-log/README)19
-rw-r--r--Master/texmf-dist/doc/support/latex-git-log/po/de.po4
-rwxr-xr-xMaster/texmf-dist/scripts/latex-git-log/latex-git-log82
-rwxr-xr-xMaster/tlpkg/libexec/ctan2tds2
5 files changed, 106 insertions, 83 deletions
diff --git a/Build/source/texk/texlive/linked_scripts/latex-git-log/latex-git-log b/Build/source/texk/texlive/linked_scripts/latex-git-log/latex-git-log
index e074d05a5ce..35d831b6eb6 100755
--- a/Build/source/texk/texlive/linked_scripts/latex-git-log/latex-git-log
+++ b/Build/source/texk/texlive/linked_scripts/latex-git-log/latex-git-log
@@ -1,6 +1,5 @@
#!/usr/bin/env perl
-# @author Robin Schneider <ypid23@aol.de>
-# @licence GPLv3+ <http://www.gnu.org/licenses/gpl.html>
+# SPDX-License-Identifier: GPL-3.0-or-later
# Modules and pragmas {{{
use strict;
@@ -23,6 +22,7 @@ BEGIN {
$dirpath = ( fileparse( abs_path($0) ) )[1];
}
# }}}
+
use Locale::Maketext::Simple (
Path => $dirpath . 'po/',
Decode => 1,
@@ -30,13 +30,14 @@ use Locale::Maketext::Simple (
# }}}
# Optional parameters {{{
-my $print_author = 0;
-my $commit_count = 1;
-my $width = 0;
-my $lang = undef;
-my $version = 0;
-my $help = 0;
-my $man = 0;
+my $print_author = 0;
+my $commit_count = 1;
+my $width = 0;
+my $lang = undef;
+my $version = 0;
+my $help = 0;
+my $man = 0;
+my $revision_range = 0;
my ( $git_user, $git_repo, $git_commit_address );
GetOptions(
'author' => \$print_author,
@@ -49,24 +50,17 @@ GetOptions(
'version' => \$version,
'help|?' => \$help,
'man' => \$man,
+ 'range=s' => \$revision_range,
);
-pod2usage(1) if $help;
-pod2usage( -verbose => 2, -exitstatus => 0, ) if $man;
-pod2usage( -verbose => 99, -sections => 'Version' ) if $version;
+pod2usage( -verbose => 99, -sections => [ qw(Synopsis Options) ] ) if $help;
+pod2usage( -verbose => 2, -exitstatus => 0, ) if $man;
+pod2usage( -verbose => 99, -sections => 'Version' ) if $version;
my $git_remote = ( split /\n/xms, capturex(qw(git remote -v)) )[0];
loc_lang($lang) if ( defined $lang );
-if ( not defined $git_user
- and not defined $git_repo
- and defined $git_remote
- and $git_remote =~ m#\s.*?:(?<user>\w+?)/(?<repo>.*?)\.git\ \(fetch\)\Z#xms )
-{
- $git_user = $+{user};
- $git_repo = $+{repo};
-}
say '%% This file was generated by the script latex-git-log';
my $git_command_commit_msg = '%s';
-if ( defined $git_user and defined $git_repo ) {
+if ( (defined $git_user and defined $git_repo) or $git_commit_address ) {
unless ( defined $git_commit_address ) {
$git_commit_address = "https://github.com/$+{user}/$+{repo}/commit";
}
@@ -133,15 +127,21 @@ if ($print_author) {
else {
push( @git_command, qq(--pretty=format:%H %ad & $git_command_commit_msg) );
}
+if ($revision_range) {
+ push( @git_command, qq($revision_range) );
+}
@lines = reverse capturex(@git_command);
# }}}
# Get tags {{{
-my @tags_commits = capturex( 'git', 'for-each-ref', '--format=%(refname:short) %(objectname)', 'refs/tags' );
+my @tags_commits = capturex( 'git', 'log', '--tags', '--no-walk', '--pretty=\'%H %d\'' );
my %commit_tags; # The key will be a SHA1 commit hash and the value a comma separated list of all tags.
for (@tags_commits) {
- my ( $tag, $c_hash ) = split /\s/xms, $_;
- chomp($c_hash);
+ chomp;
+ m/\A'([^ ]+)\s*\(([^)]+)\)'\z/xms;
+ my $c_hash = $1;
+ my $tag = $2;
+ $tag =~ s/tag: //g;
if ( defined $commit_tags{$c_hash} ) {
$commit_tags{$c_hash} .= ", $tag";
}
@@ -185,11 +185,15 @@ my @changes;
for (@lines) {
next if /\A\Z/xms;
chomp;
+ if ( m/^([0-9a-f]{40})\s/g and !$which_line) {
+ $which_line ^= 1; ## additional toggle for merge commits
+ @changes = ( "-", "-", "-" );
+ }
if ($which_line) {
s/\A([0-9a-f]{40})\s//xms or die "Did not match the commit hash\n";
my $tags = exists $commit_tags{$1} ? $commit_tags{$1} : q();
my $date_author = '';
- my $c_msg;
+ my $c_msg = '';
if ($print_author) {
/(?:& )(.*?)NoTinAuthorFiled(& .*? &) (.*)/;
$date_author = latex_escape($1) . $2;
@@ -200,7 +204,7 @@ for (@lines) {
$date_author = $1;
$c_msg = $2;
}
- if ( defined $git_user and defined $git_repo ) {
+ if ( defined $git_commit_address ) {
$c_msg =~ /(.*?) & (.*)/;
$c_msg = sprintf '\\href{%s/%s}{%s}', $git_commit_address, $1, latex_escape($2);
}
@@ -224,11 +228,12 @@ say '\end{longtable}';
__END__
# Documentation {{{
+=encoding UTF-8
=head1 NAME
latex-git-log - Generates the version history of a git project as LaTeX source code.
-=head1 SYNOPSIS
+=head1 Synopsis
latex-git-log [options]
@@ -244,8 +249,9 @@ Options:
--version, -v print version of this script
--help brief help message
--man full documentation
+ --range specify a git revision range
-=head1 OPTIONS
+=head1 Options
=over 8
@@ -266,7 +272,7 @@ This script will automatically try to use the base URL for github.
=item B<--lang>
-Set the language of the legend and all strings in the output. Be default the
+Set the language of the legend and all strings in the output. By default the
language of your system is used but you can overwrite this with this parameter.
Currently this script only supports English and German. If you need a translation
@@ -281,7 +287,7 @@ You can use it like this:
latex-git-log --width=6 --lang=en > example-output.tex
-=head1 DEPENDENCIES
+=head1 Dependencies
=head2 Of this script
@@ -303,34 +309,36 @@ expanded on the bottom of every page if the table will be continued on the next
page. You can defined it to a localized message to inform the reader that this
table is not complete and will be continued.
-=head1 DESCRIPTION
+=head1 Description
B<This program> will output the entire version history as table written in
LaTeX if it is executed within a git repository.
It is intended that you redirect the standard output of this script to a file
-which can then be included from your main TeX document.
+which can then be included from your main LaTeX document.
Because the table can be very large you might want to put the thing on a
landscape page.
=head1 Version
-0.9
+1.0.0
-=head1 AUTHOR
+=head1 Author
-Robin Schneider <ypid23@aol.de>
+Robin Schneider <ypid@riseup.net>
=head1 Development
+CTAN: https://ctan.org/pkg/latex-git-log
+
Source code repository: https://github.com/ypid/typesetting/tree/master/scripts/latex-git-log
Please report bugs and feature requests at https://github.com/ypid/typesetting/issues
-=head1 LICENSE AND COPYRIGHT
+=head1 License and Copyright
-Copyright (C) 2012-2013 by Robin Schneider
+Copyright (C) 2012-2013,2017,2019 Robin Schneider <ypid@riseup.net>
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/Master/texmf-dist/doc/support/latex-git-log/README b/Master/texmf-dist/doc/support/latex-git-log/README.md
index aaaae180109..f3d5f15f2c2 100644
--- a/Master/texmf-dist/doc/support/latex-git-log/README
+++ b/Master/texmf-dist/doc/support/latex-git-log/README.md
@@ -1,15 +1,17 @@
# latex-git-log
+
This program will output the entire version history as table written in LaTeX
if it is executed within a git repository.
-It is intended that you redirect the standard output of this script to a file
-which can then be included from your main TeX document.
+It is intended that you redirect the standard output of this script to a file which can then be included from your main LaTeX document.
Because the table can be very large you might want to put the thing on a
landscape page.
## Dependencies
+
### Of this script
+
This module requires these other modules and libraries:
IPC::System::Simple
@@ -18,6 +20,7 @@ This module requires these other modules and libraries:
Everything else should already be installed.
### To compile the output
+
The table is using the *longtable* package and the links to a web resource for
each commit use the `\href` macro from *hyperref*. So these two packages have
to be loaded.
@@ -28,9 +31,12 @@ page. You can defined it to a localized message to inform the reader that this
table is not complete and will be continued.
## License and development
-Copyright (C) by Robin Schneider <ypid23@aol.de> <br />
-Source code repository: https://github.com/ypid/typesetting/tree/master/scripts/latex-git-log <br />
-Please report bugs and feature requests at https://github.com/ypid/typesetting/issues <br />
+
+Copyright (C) 2012-2013,2017,2019-2020 Robin Schneider <ypid@riseup.net> <br/>
+SPDX-License-Identifier: GPL-3.0-or-later <br/>
+CTAN: https://ctan.org/pkg/latex-git-log <br/>
+Source code repository: https://github.com/ypid/typesetting/tree/master/scripts/latex-git-log <br/>
+Please report bugs and feature requests at https://github.com/ypid/typesetting/issues
## Usage
@@ -48,6 +54,7 @@ Please report bugs and feature requests at https://github.com/ypid/typesetting/i
--version, -v print version of this script
--help brief help message
--man full documentation
+ --range specify a git revision range
### Description of some options
@@ -65,7 +72,7 @@ Please report bugs and feature requests at https://github.com/ypid/typesetting/i
Set an base URL to link to a commit. This script will
automatically try to use the base URL for github.
- --lang Set the language of the legend and all strings in the output. Be
+ --lang Set the language of the legend and all strings in the output. By
default the language of your system is used but you can
overwrite this with this parameter.
diff --git a/Master/texmf-dist/doc/support/latex-git-log/po/de.po b/Master/texmf-dist/doc/support/latex-git-log/po/de.po
index c5ecd8937aa..401e7fe172c 100644
--- a/Master/texmf-dist/doc/support/latex-git-log/po/de.po
+++ b/Master/texmf-dist/doc/support/latex-git-log/po/de.po
@@ -1,10 +1,10 @@
msgid ""
msgstr ""
"Project-Id-Version: latex-git-log\n"
-"Report-Msgid-Bugs-To: ypid23@aol.de\n"
+"Report-Msgid-Bugs-To: ypid@riseup.net\n"
"POT-Creation-Date: 2013-06-15 18:43+0200\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
-"Last-Translator: Robin Scheider <ypid23@aol.de>\n"
+"Last-Translator: Robin Scheider <ypid@riseup.net>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
"Language: DE\n"
"MIME-Version: 1.0\n"
diff --git a/Master/texmf-dist/scripts/latex-git-log/latex-git-log b/Master/texmf-dist/scripts/latex-git-log/latex-git-log
index e074d05a5ce..35d831b6eb6 100755
--- a/Master/texmf-dist/scripts/latex-git-log/latex-git-log
+++ b/Master/texmf-dist/scripts/latex-git-log/latex-git-log
@@ -1,6 +1,5 @@
#!/usr/bin/env perl
-# @author Robin Schneider <ypid23@aol.de>
-# @licence GPLv3+ <http://www.gnu.org/licenses/gpl.html>
+# SPDX-License-Identifier: GPL-3.0-or-later
# Modules and pragmas {{{
use strict;
@@ -23,6 +22,7 @@ BEGIN {
$dirpath = ( fileparse( abs_path($0) ) )[1];
}
# }}}
+
use Locale::Maketext::Simple (
Path => $dirpath . 'po/',
Decode => 1,
@@ -30,13 +30,14 @@ use Locale::Maketext::Simple (
# }}}
# Optional parameters {{{
-my $print_author = 0;
-my $commit_count = 1;
-my $width = 0;
-my $lang = undef;
-my $version = 0;
-my $help = 0;
-my $man = 0;
+my $print_author = 0;
+my $commit_count = 1;
+my $width = 0;
+my $lang = undef;
+my $version = 0;
+my $help = 0;
+my $man = 0;
+my $revision_range = 0;
my ( $git_user, $git_repo, $git_commit_address );
GetOptions(
'author' => \$print_author,
@@ -49,24 +50,17 @@ GetOptions(
'version' => \$version,
'help|?' => \$help,
'man' => \$man,
+ 'range=s' => \$revision_range,
);
-pod2usage(1) if $help;
-pod2usage( -verbose => 2, -exitstatus => 0, ) if $man;
-pod2usage( -verbose => 99, -sections => 'Version' ) if $version;
+pod2usage( -verbose => 99, -sections => [ qw(Synopsis Options) ] ) if $help;
+pod2usage( -verbose => 2, -exitstatus => 0, ) if $man;
+pod2usage( -verbose => 99, -sections => 'Version' ) if $version;
my $git_remote = ( split /\n/xms, capturex(qw(git remote -v)) )[0];
loc_lang($lang) if ( defined $lang );
-if ( not defined $git_user
- and not defined $git_repo
- and defined $git_remote
- and $git_remote =~ m#\s.*?:(?<user>\w+?)/(?<repo>.*?)\.git\ \(fetch\)\Z#xms )
-{
- $git_user = $+{user};
- $git_repo = $+{repo};
-}
say '%% This file was generated by the script latex-git-log';
my $git_command_commit_msg = '%s';
-if ( defined $git_user and defined $git_repo ) {
+if ( (defined $git_user and defined $git_repo) or $git_commit_address ) {
unless ( defined $git_commit_address ) {
$git_commit_address = "https://github.com/$+{user}/$+{repo}/commit";
}
@@ -133,15 +127,21 @@ if ($print_author) {
else {
push( @git_command, qq(--pretty=format:%H %ad & $git_command_commit_msg) );
}
+if ($revision_range) {
+ push( @git_command, qq($revision_range) );
+}
@lines = reverse capturex(@git_command);
# }}}
# Get tags {{{
-my @tags_commits = capturex( 'git', 'for-each-ref', '--format=%(refname:short) %(objectname)', 'refs/tags' );
+my @tags_commits = capturex( 'git', 'log', '--tags', '--no-walk', '--pretty=\'%H %d\'' );
my %commit_tags; # The key will be a SHA1 commit hash and the value a comma separated list of all tags.
for (@tags_commits) {
- my ( $tag, $c_hash ) = split /\s/xms, $_;
- chomp($c_hash);
+ chomp;
+ m/\A'([^ ]+)\s*\(([^)]+)\)'\z/xms;
+ my $c_hash = $1;
+ my $tag = $2;
+ $tag =~ s/tag: //g;
if ( defined $commit_tags{$c_hash} ) {
$commit_tags{$c_hash} .= ", $tag";
}
@@ -185,11 +185,15 @@ my @changes;
for (@lines) {
next if /\A\Z/xms;
chomp;
+ if ( m/^([0-9a-f]{40})\s/g and !$which_line) {
+ $which_line ^= 1; ## additional toggle for merge commits
+ @changes = ( "-", "-", "-" );
+ }
if ($which_line) {
s/\A([0-9a-f]{40})\s//xms or die "Did not match the commit hash\n";
my $tags = exists $commit_tags{$1} ? $commit_tags{$1} : q();
my $date_author = '';
- my $c_msg;
+ my $c_msg = '';
if ($print_author) {
/(?:& )(.*?)NoTinAuthorFiled(& .*? &) (.*)/;
$date_author = latex_escape($1) . $2;
@@ -200,7 +204,7 @@ for (@lines) {
$date_author = $1;
$c_msg = $2;
}
- if ( defined $git_user and defined $git_repo ) {
+ if ( defined $git_commit_address ) {
$c_msg =~ /(.*?) & (.*)/;
$c_msg = sprintf '\\href{%s/%s}{%s}', $git_commit_address, $1, latex_escape($2);
}
@@ -224,11 +228,12 @@ say '\end{longtable}';
__END__
# Documentation {{{
+=encoding UTF-8
=head1 NAME
latex-git-log - Generates the version history of a git project as LaTeX source code.
-=head1 SYNOPSIS
+=head1 Synopsis
latex-git-log [options]
@@ -244,8 +249,9 @@ Options:
--version, -v print version of this script
--help brief help message
--man full documentation
+ --range specify a git revision range
-=head1 OPTIONS
+=head1 Options
=over 8
@@ -266,7 +272,7 @@ This script will automatically try to use the base URL for github.
=item B<--lang>
-Set the language of the legend and all strings in the output. Be default the
+Set the language of the legend and all strings in the output. By default the
language of your system is used but you can overwrite this with this parameter.
Currently this script only supports English and German. If you need a translation
@@ -281,7 +287,7 @@ You can use it like this:
latex-git-log --width=6 --lang=en > example-output.tex
-=head1 DEPENDENCIES
+=head1 Dependencies
=head2 Of this script
@@ -303,34 +309,36 @@ expanded on the bottom of every page if the table will be continued on the next
page. You can defined it to a localized message to inform the reader that this
table is not complete and will be continued.
-=head1 DESCRIPTION
+=head1 Description
B<This program> will output the entire version history as table written in
LaTeX if it is executed within a git repository.
It is intended that you redirect the standard output of this script to a file
-which can then be included from your main TeX document.
+which can then be included from your main LaTeX document.
Because the table can be very large you might want to put the thing on a
landscape page.
=head1 Version
-0.9
+1.0.0
-=head1 AUTHOR
+=head1 Author
-Robin Schneider <ypid23@aol.de>
+Robin Schneider <ypid@riseup.net>
=head1 Development
+CTAN: https://ctan.org/pkg/latex-git-log
+
Source code repository: https://github.com/ypid/typesetting/tree/master/scripts/latex-git-log
Please report bugs and feature requests at https://github.com/ypid/typesetting/issues
-=head1 LICENSE AND COPYRIGHT
+=head1 License and Copyright
-Copyright (C) 2012-2013 by Robin Schneider
+Copyright (C) 2012-2013,2017,2019 Robin Schneider <ypid@riseup.net>
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/Master/tlpkg/libexec/ctan2tds b/Master/tlpkg/libexec/ctan2tds
index 8cb4210ffdd..ff3169a8c1f 100755
--- a/Master/tlpkg/libexec/ctan2tds
+++ b/Master/tlpkg/libexec/ctan2tds
@@ -1415,7 +1415,6 @@ chomp (my $ctan_root = `tlpkginfo --ctan-root`);
'iodhbwm' => '&PREHOOK_flatten1',
'knuth-local' => '&PREHOOK_knuth_local',
'ktv-texdata' => '&PREHOOK_ktv_texdata',
- 'latex-git-log' => '&PREHOOK_latex_git_log',
'latexdiff' => '&PREHOOK_latexdiff',
'latexindent' => '&PREHOOK_latexindent',
'lilyglyphs' => '&PREHOOK_lilyglyphs',
@@ -1512,6 +1511,7 @@ chomp (my $ctan_root = `tlpkginfo --ctan-root`);
'kotex-utf' => '&POSTkotex_utf',
'l3build' => '&POST_do_man',
'latex-base-dev' => '&POSTlatex_base_dev',
+ 'latex-git-log' => '&POST_preserve_man',
'latex2e-help-texinfo' => '&POSTlatex2e_help_texinfo',
'lhcyr' => '&POSTlhcyr',
'lilyglyphs' => '&POSTlilyglyphs',