Bug 579178 part D - When unifying as sorted-matching, keep version A as the unified version, not the sorted version, r=ted

This commit is contained in:
Benjamin Smedberg 2010-08-05 10:11:39 -04:00
parent c622433f07
commit a6c50c40f9
2 changed files with 3 additions and 19 deletions

View File

@ -186,7 +186,7 @@ check::
mkdir unify-sort-test unify-sort-test/a unify-sort-test/b
printf "lmn\nabc\nxyz\n" > unify-sort-test/a/file.foo
printf "xyz\nlmn\nabc" > unify-sort-test/b/file.foo
printf "abc\nlmn\nxyz\n" > unify-sort-test/expected-result
printf "lmn\nabc\nxyz\n" > unify-sort-test/expected-result
@if ! $(srcdir)/macosx/universal/unify --unify-with-sort "\.foo$$" \
./unify-sort-test/a ./unify-sort-test/b \
./unify-sort-test/c; then \

View File

@ -201,7 +201,6 @@ sub copyIfIdentical($$$);
sub slurp($);
sub get_sorted($);
sub compare_sorted($$);
sub copy_sorted($$);
sub copyIfIdenticalWhenSorted($$$);
sub createUniqueFile($$);
sub makeUniversal($$$);
@ -541,21 +540,6 @@ sub compare_sorted($$) {
return 0;
}
# copy_sorted($source, $destination)
#
# $source and $destination are filenames. Read the contents of $source
# into an array, sort it, and then write the sorted contents to $destination.
# Returns 1 on success, and undef on failure.
sub copy_sorted($$) {
my ($src, $dest) = @_;
my @lines = get_sorted($src);
return undef unless @lines;
open FILE, "> $dest" or return undef;
print FILE @lines;
close FILE;
return 1;
}
# copyIfIdenticalWhenSorted($source1, $source2, $target)
#
# $source1 and $source2 are FileAttrCache objects that are compared, and if
@ -605,8 +589,8 @@ sub copyIfIdenticalWhenSorted($$$) {
return 0;
}
if (!copy_sorted($source1->path(), $target)) {
complain(1, 'copyIfIdenticalWhenSorted: copy_sorted: '.$!
if (!copy($source1->path(), $target)) {
complain(1, 'copyIfIdenticalWhenSorted: copy: '.$!
.' while copying',
$source1->path(),
$target);