nhgitset: Deprecate PRE and POST hooks.
nhgitset version 6 prepare for future phases to get rid of those hooks fix some minor bugs
This commit is contained in:
+5
-4
@@ -1,4 +1,5 @@
|
|||||||
5
|
6
|
||||||
Please see "git log DEVEL" for previous changes.
|
PRE and POST hooks will be dropped at some future date -
|
||||||
Make documentation of nhgitset.pl easier to find and
|
see https://www.nethack.org/devel/deprecation.html for details.
|
||||||
find out about.
|
|
||||||
|
See "git log DEVEL" for previous changes.
|
||||||
|
|||||||
@@ -109,7 +109,7 @@ sub version_in_devel {
|
|||||||
|
|
||||||
my $version;
|
my $version;
|
||||||
my $verfile = "$path${PDS}DEVEL${PDS}VERSION";
|
my $verfile = "$path${PDS}DEVEL${PDS}VERSION";
|
||||||
open VERFH,"<",$verfile or die "xCan't open $verfile: $!";
|
open VERFH,"<",$verfile or die "Can't open $verfile: $!";
|
||||||
$version = 0+<VERFH>;
|
$version = 0+<VERFH>;
|
||||||
my $message = join('',<VERFH>);
|
my $message = join('',<VERFH>);
|
||||||
close VERFH;
|
close VERFH;
|
||||||
@@ -250,7 +250,17 @@ sub do_hook {
|
|||||||
my($p) = @_;
|
my($p) = @_;
|
||||||
my $hname = $0;
|
my $hname = $0;
|
||||||
$hname =~ s!^((.*$DS)|())(.*)!$1$p-$4!;
|
$hname =~ s!^((.*$DS)|())(.*)!$1$p-$4!;
|
||||||
|
my $vig = version_in_git;
|
||||||
if(-x $hname){
|
if(-x $hname){
|
||||||
|
if(`git config --bool nethack.NoDepWarn` ne "true\n"){
|
||||||
|
print STDERR <<~E_O_M;
|
||||||
|
WARNING: $p hooks will be going away. See
|
||||||
|
https://www.nethack.org/devel/deprecation.html
|
||||||
|
To stop seeing this message, run
|
||||||
|
git config --bool nethack.NoDepWarn true
|
||||||
|
E_O_M
|
||||||
|
}
|
||||||
|
|
||||||
print TRACE "START $p: $hname\n" if($trace);
|
print TRACE "START $p: $hname\n" if($trace);
|
||||||
|
|
||||||
open TOHOOK, "|-", $hname or die "open $hname: $!";
|
open TOHOOK, "|-", $hname or die "open $hname: $!";
|
||||||
@@ -370,6 +380,17 @@ Perl module for infrastructure of NetHack Git hooks.
|
|||||||
Buffers call information so multiple independent actions may be coded for
|
Buffers call information so multiple independent actions may be coded for
|
||||||
Git hooks and similar Git callouts.
|
Git hooks and similar Git callouts.
|
||||||
|
|
||||||
|
=over 4
|
||||||
|
|
||||||
|
=item ==>
|
||||||
|
|
||||||
|
As of Git 2.54, multiple actions may be specified for each hook
|
||||||
|
event - that makes this redundant for hooks and will be removed at
|
||||||
|
some future time when Git 2.54 (or later) is better distributed.
|
||||||
|
This should speed up hook processing.
|
||||||
|
|
||||||
|
=back 4
|
||||||
|
|
||||||
Maintains C<dat/gitinfo.txt>.
|
Maintains C<dat/gitinfo.txt>.
|
||||||
|
|
||||||
Common routines for dealing with nethack.setupversion git config variable.
|
Common routines for dealing with nethack.setupversion git config variable.
|
||||||
|
|||||||
+11
-1
@@ -93,6 +93,16 @@ if($version_old > 0){
|
|||||||
if(length $message_new){
|
if(length $message_new){
|
||||||
print STDERR "Additional information:\n$message_new\n";
|
print STDERR "Additional information:\n$message_new\n";
|
||||||
}
|
}
|
||||||
|
# This list and the code below will need to be updated if other changes occur
|
||||||
|
# before this progression is finished.
|
||||||
|
# 6 announce eventual deprecation of PRE and POST hooks
|
||||||
|
# 6->7 unset nethack.NoDepWarn, change message, docs in NHgithook.pm
|
||||||
|
# 7 deprecation of PRE and POST hooks
|
||||||
|
# 7->8 unset nethack.NoDepWarn, change message, docs in NHgithook.pm and make fail
|
||||||
|
# 8 PRE and POST throw errors
|
||||||
|
# 8->9 unset nethack.NoDepWarn, remove code, docs
|
||||||
|
# 9 removal of PRE and POST code
|
||||||
|
system('git','config','--unset','nethack.NoDepWarn') unless($opt_n);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -358,7 +368,7 @@ sub do_file_nhgitset {
|
|||||||
open IN, "<", $infile or die "Can't open $infile:$!";
|
open IN, "<", $infile or die "Can't open $infile:$!";
|
||||||
open OUT, ">", $outfile or die "Can't open $outfile:$!";
|
open OUT, ">", $outfile or die "Can't open $outfile:$!";
|
||||||
my $started;
|
my $started;
|
||||||
print IN "die \"DO NOT RUN THIS FILE\n\"";
|
print OUT "=pod\n";
|
||||||
while(<IN>){
|
while(<IN>){
|
||||||
m/^__END__/ && do {$started =1; next};
|
m/^__END__/ && do {$started =1; next};
|
||||||
print OUT if($started);
|
print OUT if($started);
|
||||||
|
|||||||
Reference in New Issue
Block a user