From fe68fed77dfeef5014c3c9445b109020d4c39f13 Mon Sep 17 00:00:00 2001 From: Thomas Berezansky Date: Wed, 18 May 2011 08:21:53 -0400 Subject: [PATCH] More make-db-patch goodness: wrap existing --wrap option will take an existing file and wrap it properly. When --wrap is specified --from is ignored. Signed-off-by: Thomas Berezansky Signed-off-by: Galen Charlton --- Open-ILS/src/sql/Pg/make-db-patch.pl | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/Open-ILS/src/sql/Pg/make-db-patch.pl b/Open-ILS/src/sql/Pg/make-db-patch.pl index 663b90135c..505dd4aaf7 100755 --- a/Open-ILS/src/sql/Pg/make-db-patch.pl +++ b/Open-ILS/src/sql/Pg/make-db-patch.pl @@ -23,6 +23,7 @@ use Getopt::Long; my $db_patch_num; my $patch_name; my $patch_from; +my $patch_wrap; my @deprecates; my @supersedes; @@ -31,6 +32,7 @@ GetOptions( 'num=i' => \$db_patch_num, 'name=s' => \$patch_name, 'from=s' => \$patch_from, + 'wrap=s' => \$patch_wrap, 'deprecates=i' => \@deprecates, 'supersedes=i' => \@supersedes, ) or exit_usage(); @@ -97,7 +99,8 @@ if (@deprecates or @supersedes) { } my $patch_init_contents; -$patch_init_contents = `git diff $patch_from -- ./[0-9][0-9][0-9].*.sql | sed -e '/^[^+\@-]/d' -e '/^\\(--- a\\|+++ b\\)/d' -e 's/^+//'` if ($patch_from ne ''); +$patch_init_contents = `git diff $patch_from -- ./[0-9][0-9][0-9].*.sql | sed -e '/^[^+\@-]/d' -e '/^\\(--- a\\|+++ b\\)/d' -e 's/^+//'` if ($patch_from ne '' && ! defined $patch_wrap); +$patch_init_contents = `cat $patch_wrap` if (defined $patch_wrap && $patch_wrap ne ''); print OUT <<_FOOTER_; @@ -126,6 +129,7 @@ Make template for a DB patch SQL file. --deprecates patch(es) deprecated by this update --supersedes patch(es) superseded by this update --from git refspec to compare against + --wrap existing file to wrap (overrides --from) _HELP_ exit 0; } -- 2.43.2