2011-07-12 06:58:34 -04:00
|
|
|
#!/usr/bin/perl
|
|
|
|
#
|
|
|
|
# This script can be used to fix up paths that were moved as a result
|
|
|
|
# of the structural changes committed as part of SOLR-2452.
|
|
|
|
#
|
|
|
|
# Input is on STDIN, output is to STDOUT
|
|
|
|
#
|
|
|
|
# Example use:
|
|
|
|
#
|
|
|
|
# perl SOLR-2452.patch.hack.pl <my.pre-SOLR-2452.patch >my.post-SOLR-2452.patch
|
|
|
|
#
|
|
|
|
#
|
|
|
|
# Licensed to the Apache Software Foundation (ASF) under one or more
|
|
|
|
# contributor license agreements. See the NOTICE file distributed with
|
|
|
|
# this work for additional information regarding copyright ownership.
|
|
|
|
# The ASF licenses this file to You under the Apache License, Version 2.0
|
|
|
|
# (the "License"); you may not use this file except in compliance with
|
|
|
|
# the License. You may obtain a copy of the License at
|
|
|
|
#
|
|
|
|
# http://www.apache.org/licenses/LICENSE-2.0
|
|
|
|
#
|
|
|
|
# Unless required by applicable law or agreed to in writing, software
|
|
|
|
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
|
|
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
|
|
# See the License for the specific language governing permissions and
|
|
|
|
# limitations under the License.
|
|
|
|
#
|
|
|
|
|
|
|
|
use strict;
|
|
|
|
use warnings;
|
|
|
|
|
|
|
|
my @moves = (
|
2011-07-22 09:24:17 -04:00
|
|
|
'solr/contrib/analysis-extras/src/test-files/solr-analysis-extras'
|
|
|
|
=> 'solr/contrib/analysis-extras/src/test-files/analysis-extras/solr',
|
|
|
|
|
|
|
|
'solr/contrib/analysis-extras/src/test-files'
|
|
|
|
=> 'solr/contrib/analysis-extras/src/test-files/analysis-extras',
|
|
|
|
|
2011-07-12 06:58:34 -04:00
|
|
|
'solr/contrib/clustering/src/test/java'
|
|
|
|
=> 'solr/contrib/clustering/src/test',
|
|
|
|
|
2011-07-22 09:24:17 -04:00
|
|
|
'solr/contrib/clustering/src/test/resources/solr-clustering'
|
|
|
|
=> 'solr/contrib/clustering/src/test-files/clustering/solr',
|
|
|
|
|
2011-07-12 06:58:34 -04:00
|
|
|
'solr/contrib/clustering/src/test/resources'
|
2011-07-22 09:24:17 -04:00
|
|
|
=> 'solr/contrib/clustering/src/test-files/clustering',
|
2011-07-12 06:58:34 -04:00
|
|
|
|
|
|
|
'solr/contrib/clustering/src/main/java'
|
|
|
|
=> 'solr/contrib/clustering/src/java',
|
|
|
|
|
2011-07-12 07:13:25 -04:00
|
|
|
'solr/contrib/dataimporthandler/src/test/java'
|
|
|
|
=> 'solr/contrib/dataimporthandler/src/test',
|
|
|
|
|
2011-07-22 09:24:17 -04:00
|
|
|
'solr/contrib/dataimporthandler/src/test/resources/solr-dih'
|
|
|
|
=> 'solr/contrib/dataimporthandler/src/test-files/dih/solr',
|
|
|
|
|
2011-07-12 07:13:25 -04:00
|
|
|
'solr/contrib/dataimporthandler/src/test/resources'
|
2011-07-22 09:24:17 -04:00
|
|
|
=> 'solr/contrib/dataimporthandler/src/test-files/dih',
|
2011-07-12 07:13:25 -04:00
|
|
|
|
|
|
|
'solr/contrib/dataimporthandler/src/main/java'
|
|
|
|
=> 'solr/contrib/dataimporthandler/src/java',
|
|
|
|
|
|
|
|
'solr/contrib/dataimporthandler/src/main/webapp'
|
|
|
|
=> 'solr/contrib/dataimporthandler/src/webapp',
|
|
|
|
|
|
|
|
'solr/contrib/dataimporthandler/src/extras/test/java'
|
|
|
|
=> 'solr/contrib/dataimporthandler-extras/src/test',
|
|
|
|
|
2011-07-22 09:24:17 -04:00
|
|
|
'solr/contrib/dataimporthandler/src/extras/test/resources/solr-dihextras'
|
|
|
|
=> 'solr/contrib/dataimporthandler-extras/src/test-files/dihextras/solr',
|
|
|
|
|
2011-07-12 07:13:25 -04:00
|
|
|
'solr/contrib/dataimporthandler/src/extras/test/resources'
|
2011-07-22 09:24:17 -04:00
|
|
|
=> 'solr/contrib/dataimporthandler-extras/src/test-files/dihextras',
|
2011-07-12 07:13:25 -04:00
|
|
|
|
|
|
|
'solr/contrib/dataimporthandler/src/extras/main/java'
|
|
|
|
=> 'solr/contrib/dataimporthandler-extras/src/java',
|
|
|
|
|
2011-07-12 06:58:34 -04:00
|
|
|
'solr/contrib/extraction/src/test/java'
|
|
|
|
=> 'solr/contrib/extraction/src/test',
|
|
|
|
|
2011-07-22 09:24:17 -04:00
|
|
|
'solr/contrib/extraction/src/test/resources/solr-extraction'
|
|
|
|
=> 'solr/contrib/extraction/src/test-files/extraction/solr',
|
|
|
|
|
2011-07-12 06:58:34 -04:00
|
|
|
'solr/contrib/extraction/src/test/resources'
|
2011-07-22 09:24:17 -04:00
|
|
|
=> 'solr/contrib/extraction/src/test-files/extraction',
|
2011-07-12 06:58:34 -04:00
|
|
|
|
|
|
|
'solr/contrib/extraction/src/main/java'
|
|
|
|
=> 'solr/contrib/extraction/src/java',
|
|
|
|
|
|
|
|
'solr/contrib/uima/src/test/java'
|
|
|
|
=> 'solr/contrib/uima/src/test',
|
|
|
|
|
2011-07-22 09:24:17 -04:00
|
|
|
'solr/contrib/uima/src/test/resources/solr-uima'
|
|
|
|
=> 'solr/contrib/uima/src/test-files/uima/solr',
|
|
|
|
|
2011-07-12 06:58:34 -04:00
|
|
|
'solr/contrib/uima/src/test/resources'
|
2011-07-22 09:24:17 -04:00
|
|
|
=> 'solr/contrib/uima/src/test-files/uima',
|
2011-07-12 06:58:34 -04:00
|
|
|
|
|
|
|
'solr/contrib/uima/src/main/java'
|
|
|
|
=> 'solr/contrib/uima/src/java',
|
|
|
|
|
|
|
|
'solr/contrib/uima/src/main/resources'
|
|
|
|
=> 'solr/contrib/uima/src/resources',
|
|
|
|
|
|
|
|
'solr/src/test-files/books.csv'
|
2011-07-22 09:24:17 -04:00
|
|
|
=> 'solr/solrj/src/test-files/solrj/books.csv',
|
2011-07-12 06:58:34 -04:00
|
|
|
|
|
|
|
'solr/src/test-files/sampleDateFacetResponse.xml'
|
2011-07-22 09:24:17 -04:00
|
|
|
=> 'solr/solrj/src/test-files/solrj/sampleDateFacetResponse.xml',
|
2011-07-12 06:58:34 -04:00
|
|
|
|
|
|
|
'solr/src/test-files/solr/shared'
|
2011-07-22 09:24:17 -04:00
|
|
|
=> 'solr/solrj/src/test-files/solrj/solr/shared',
|
2011-07-12 06:58:34 -04:00
|
|
|
|
2011-07-12 16:43:36 -04:00
|
|
|
'solr/src/solrj'
|
2011-07-12 06:58:34 -04:00
|
|
|
=> 'solr/solrj/src/java',
|
|
|
|
|
2011-07-12 16:43:36 -04:00
|
|
|
'solr/src/common'
|
|
|
|
=> 'solr/solrj/src/java',
|
2011-07-12 06:58:34 -04:00
|
|
|
|
|
|
|
'solr/src/test/org/apache/solr/common'
|
2011-07-12 16:43:36 -04:00
|
|
|
=> 'solr/solrj/src/test/org/apache/solr/common',
|
2011-07-12 06:58:34 -04:00
|
|
|
|
|
|
|
'solr/src/test/org/apache/solr/client/solrj/SolrJettyTestBase.java'
|
|
|
|
=> 'solr/test-framework/src/java/org/apache/solr/SolrJettyTestBase.java',
|
|
|
|
|
|
|
|
'solr/src/test/org/apache/solr/client/solrj'
|
|
|
|
=> 'solr/solrj/src/test/org/apache/solr/client/solrj',
|
|
|
|
|
|
|
|
'solr/src/test-framework'
|
|
|
|
=> 'solr/test-framework/src/java',
|
|
|
|
|
|
|
|
'solr/src/test/org/apache/solr/util/ExternalPaths.java'
|
|
|
|
=> 'solr/test-framework/src/java/org/apache/solr/util/ExternalPaths.java',
|
|
|
|
|
|
|
|
'solr/src/java'
|
|
|
|
=> 'solr/core/src/java',
|
|
|
|
|
|
|
|
'solr/src/test'
|
|
|
|
=> 'solr/core/src/test',
|
|
|
|
|
|
|
|
'solr/src/test-files'
|
|
|
|
=> 'solr/core/src/test-files',
|
|
|
|
|
|
|
|
'solr/src/webapp/src'
|
|
|
|
=> 'solr/core/src/java',
|
|
|
|
|
|
|
|
'solr/src/webapp/web'
|
|
|
|
=> 'solr/webapp/web',
|
|
|
|
|
|
|
|
'solr/src/scripts'
|
|
|
|
=> 'solr/scripts',
|
|
|
|
|
|
|
|
'solr/src/dev-tools'
|
|
|
|
=> 'solr/dev-tools',
|
|
|
|
|
|
|
|
'solr/src/site'
|
|
|
|
=> 'solr/site-src',
|
|
|
|
|
|
|
|
'dev-tools/maven/solr/src/pom.xml.template'
|
|
|
|
=> 'dev-tools/maven/solr/core/pom.xml.template',
|
|
|
|
|
|
|
|
'dev-tools/maven/solr/src/test-framework/pom.xml.template'
|
|
|
|
=> 'dev-tools/maven/solr/test-framework/pom.xml.template',
|
|
|
|
|
|
|
|
'dev-tools/maven/solr/src/solrj/pom.xml.template'
|
|
|
|
=> 'dev-tools/maven/solr/solrj/pom.xml.template',
|
|
|
|
|
|
|
|
'dev-tools/maven/solr/src/webapp/pom.xml.template'
|
|
|
|
=> 'dev-tools/maven/solr/webapp/pom.xml.template',
|
|
|
|
);
|
|
|
|
|
|
|
|
my @copies = (
|
|
|
|
'solr/core/src/test-files/README'
|
2011-07-22 09:24:17 -04:00
|
|
|
=> 'solr/solrj/src/test-files/solrj/README',
|
2011-07-12 06:58:34 -04:00
|
|
|
|
|
|
|
'solr/core/src/test-files/solr/crazy-path-to-schema.xml'
|
2011-07-22 09:24:17 -04:00
|
|
|
=> 'solr/solrj/src/test-files/solrj/solr/crazy-path-to-schema.xml',
|
2011-07-12 06:58:34 -04:00
|
|
|
|
|
|
|
'solr/core/src/test-files/solr/conf/schema.xml'
|
2011-07-22 09:24:17 -04:00
|
|
|
=> 'solr/solrj/src/test-files/solrj/solr/conf/schema.xml',
|
2011-07-12 06:58:34 -04:00
|
|
|
|
|
|
|
'solr/core/src/test-files/solr/conf/schema-replication1.xml'
|
2011-07-22 09:24:17 -04:00
|
|
|
=> 'solr/solrj/src/test-files/solrj/solr/conf/schema-replication1.xml',
|
2011-07-12 06:58:34 -04:00
|
|
|
|
|
|
|
'solr/core/src/test-files/solr/conf/solrconfig-slave1.xml'
|
2011-07-22 09:24:17 -04:00
|
|
|
=> 'solr/solrj/src/test-files/solrj/solr/conf/solrconfig-slave1.xml',
|
2011-07-12 06:58:34 -04:00
|
|
|
);
|
|
|
|
|
|
|
|
my $diff;
|
|
|
|
|
|
|
|
while (<>) {
|
|
|
|
if (/^Index/) {
|
|
|
|
my $next_diff = $_;
|
|
|
|
&fixup_paths if ($diff);
|
|
|
|
$diff = $next_diff;
|
|
|
|
} else {
|
|
|
|
$diff .= $_;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
&fixup_paths; # Handle the final diff
|
|
|
|
|
|
|
|
sub fixup_paths {
|
|
|
|
for (my $move_pos = 0 ; $move_pos < $#moves ; $move_pos += 2) {
|
|
|
|
my $source = $moves[$move_pos];
|
|
|
|
my $target = $moves[$move_pos + 1];
|
|
|
|
if ($diff =~ /^Index: \Q$source\E/) {
|
|
|
|
$diff =~ s/^Index: \Q$source\E/Index: $target/;
|
|
|
|
$diff =~ s/\n--- \Q$source\E/\n--- $target/;
|
|
|
|
$diff =~ s/\n\+\+\+ \Q$source\E/\n+++ $target/;
|
|
|
|
$diff =~ s/\nProperty changes on: \Q$source\E/\nProperty changes on: $target/;
|
|
|
|
last;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
print $diff;
|
|
|
|
|
|
|
|
for (my $copy_pos = 0 ; $copy_pos < $#copies ; $copy_pos += 2) {
|
|
|
|
my $source = $copies[$copy_pos];
|
|
|
|
my $target = $copies[$copy_pos + 1];
|
|
|
|
if ($diff =~ /^Index: \Q$source\E/) {
|
|
|
|
my $new_diff = $diff;
|
|
|
|
$new_diff =~ s/^Index: \Q$source\E/Index: $target/;
|
|
|
|
$new_diff =~ s/\n--- \Q$source\E/\n--- $target/;
|
|
|
|
$new_diff =~ s/\n\+\+\+ \Q$source\E/\n+++ $target/;
|
|
|
|
$new_diff =~ s/\nProperty changes on: \Q$source\E/\nProperty changes on: $target/;
|
|
|
|
print $new_diff;
|
|
|
|
last;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|