From 24fb93d21a9eed45ac085a4d4f4711b28840f70e Mon Sep 17 00:00:00 2001 From: Karl Berry Date: Thu, 27 Feb 2020 22:08:39 +0000 Subject: latex-git-log (27feb20) git-svn-id: svn://tug.org/texlive/trunk@53942 c570f23f-e606-0410-a88d-b1316a301751 --- .../linked_scripts/latex-git-log/latex-git-log | 82 ++++++++++++---------- Master/texmf-dist/doc/support/latex-git-log/README | 75 -------------------- .../texmf-dist/doc/support/latex-git-log/README.md | 82 ++++++++++++++++++++++ .../texmf-dist/doc/support/latex-git-log/po/de.po | 4 +- .../texmf-dist/scripts/latex-git-log/latex-git-log | 82 ++++++++++++---------- Master/tlpkg/libexec/ctan2tds | 2 +- 6 files changed, 175 insertions(+), 152 deletions(-) delete mode 100644 Master/texmf-dist/doc/support/latex-git-log/README create mode 100644 Master/texmf-dist/doc/support/latex-git-log/README.md 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 -# @licence GPLv3+ +# 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.*?:(?\w+?)/(?.*?)\.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 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 +Robin Schneider =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 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 deleted file mode 100644 index aaaae180109..00000000000 --- a/Master/texmf-dist/doc/support/latex-git-log/README +++ /dev/null @@ -1,75 +0,0 @@ -# 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. - -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 - Locale::Maketext::Simple - -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. - -Furthermore you need to defined the macro `\longtableendfoot` which will be -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. - -## License and development -Copyright (C) by Robin Schneider
-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
- -## Usage - - latex-git-log [options] - - Options: - - --author set this if you want the author included - --startcommit set the start value of count commit - --width set the width in cm of the commit message field in the LaTeX table - --git-c-add set an base URL to link to a commit - --user set a github user to derive the base URL - --repo set a github repository to derive the base URL - --lang language of the legend and all strings in the output - --version, -v print version of this script - --help brief help message - --man full documentation - -### Description of some options - - --width Set the width in cm of the commit message field in the LaTeX - table. If this parameter is not set then the table is not - vertically limited. That means that if you have a very long - commit message then the table will probably not fit on the page - and you will get a "Overfull" error message from TeX. - - In this case you should specify the width of the column - containing the commit messages. I normally use something like - --width=14 for DIN A4 in landscape. - - --git-c-add - 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 - 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 to another language then you can either - create a .po file or I can register this project on one of those - websites for online translation. diff --git a/Master/texmf-dist/doc/support/latex-git-log/README.md b/Master/texmf-dist/doc/support/latex-git-log/README.md new file mode 100644 index 00000000000..f3d5f15f2c2 --- /dev/null +++ b/Master/texmf-dist/doc/support/latex-git-log/README.md @@ -0,0 +1,82 @@ +# 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 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 + Locale::Maketext::Simple + +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. + +Furthermore you need to defined the macro `\longtableendfoot` which will be +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. + +## License and development + +Copyright (C) 2012-2013,2017,2019-2020 Robin Schneider
+SPDX-License-Identifier: GPL-3.0-or-later
+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 + +## Usage + + latex-git-log [options] + + Options: + + --author set this if you want the author included + --startcommit set the start value of count commit + --width set the width in cm of the commit message field in the LaTeX table + --git-c-add set an base URL to link to a commit + --user set a github user to derive the base URL + --repo set a github repository to derive the base URL + --lang language of the legend and all strings in the output + --version, -v print version of this script + --help brief help message + --man full documentation + --range specify a git revision range + +### Description of some options + + --width Set the width in cm of the commit message field in the LaTeX + table. If this parameter is not set then the table is not + vertically limited. That means that if you have a very long + commit message then the table will probably not fit on the page + and you will get a "Overfull" error message from TeX. + + In this case you should specify the width of the column + containing the commit messages. I normally use something like + --width=14 for DIN A4 in landscape. + + --git-c-add + 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. 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 to another language then you can either + create a .po file or I can register this project on one of those + websites for online translation. 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 \n" +"Last-Translator: Robin Scheider \n" "Language-Team: LANGUAGE \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 -# @licence GPLv3+ +# 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.*?:(?\w+?)/(?.*?)\.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 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 +Robin Schneider =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 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', -- cgit v1.2.3