From: Thomas Berezansky Date: Wed, 18 May 2011 12:21:53 +0000 (-0400) Subject: More make-db-patch goodness: wrap existing X-Git-Url: http://git.equinoxoli.org/?p=evergreen-equinox.git;a=commitdiff_plain;h=fe68fed77dfeef5014c3c9445b109020d4c39f13 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 --- diff --git a/Open-ILS/src/sql/Pg/make-db-patch.pl b/Open-ILS/src/sql/Pg/make-db-patch.pl index 663b901..505dd4a 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; }