[svk-commit] r2503 - in branches/2.0-releng: lib/SVK/Editor lib/SVK/Root pkg pkg/win32 t t/i18n

nobody at bestpractical.com nobody at bestpractical.com
Tue Jul 17 12:36:05 EDT 2007


Author: clkao
Date: Tue Jul 17 12:36:05 2007
New Revision: 2503

Added:
   branches/2.0-releng/t/i18n/
   branches/2.0-releng/t/i18n/big5dirname.t
   branches/2.0-releng/t/i18n/checkout.t
   branches/2.0-releng/t/i18n/win32filename.t
Modified:
   branches/2.0-releng/MANIFEST
   branches/2.0-releng/MANIFEST.SKIP
   branches/2.0-releng/lib/SVK/Editor/Composite.pm
   branches/2.0-releng/lib/SVK/Editor/Diff.pm
   branches/2.0-releng/lib/SVK/Root/Checkout.pm
   branches/2.0-releng/pkg/buildsvk.pl   (contents, props changed)
   branches/2.0-releng/pkg/win32/svk.nsi
   branches/2.0-releng/t/23commit-inter-nav.t   (contents, props changed)
   branches/2.0-releng/t/32list.t

Log:
Merge from trunk:
 r2474 at trunk:  clkao | 2007-07-17 12:45:00 +0100
 push i18n-fixes branch back to trunk
 r2502 at trunk:  clkao | 2007-07-17 17:34:24 +0100
 Make i18n tests quiet.


Modified: branches/2.0-releng/MANIFEST
==============================================================================
--- branches/2.0-releng/MANIFEST	(original)
+++ branches/2.0-releng/MANIFEST	Tue Jul 17 12:36:05 2007
@@ -160,10 +160,15 @@
 MANIFEST
 MANIFEST.SKIP
 META.yml			Module meta-data (added by MakeMaker)
+pkg/maketest
+pkg/svk-wrapper
+pkg/win32/builddist.bat
 pkg/win32/LICENSE.txt
 pkg/win32/maketest.bat
 pkg/win32/MANIFEST
+pkg/win32/paroptions.txt
 pkg/win32/Path.nsh
+pkg/win32/setenv.bat
 pkg/win32/svk-uninstall.ico
 pkg/win32/svk.ico
 pkg/win32/svk.nsi
@@ -183,6 +188,7 @@
 t/04merge-rename.t
 t/04merge.t
 t/05svm-all.t
+t/05svm-branches.t
 t/05svm-copy.t
 t/05svm-empty.t
 t/05svm-head.t
@@ -198,8 +204,8 @@
 t/07smerge-bidi-inc.t
 t/07smerge-branch-renamed.t
 t/07smerge-copy-co.t
-t/07smerge-copy.t
 t/07smerge-copy-outside.t
+t/07smerge-copy.t
 t/07smerge-copy2.t
 t/07smerge-cpdelete.t
 t/07smerge-delete.t
@@ -214,10 +220,10 @@
 t/07smerge-multi.t
 t/07smerge-prop.t
 t/07smerge-relayed.t
+t/07smerge-rename-dest.t
 t/07smerge-rename.t
 t/07smerge-rename2.t
 t/07smerge-rename3.t
-t/07smerge-rename-dest.t
 t/07smerge-tags.t
 t/07smerge-to-from.t
 t/07smerge-tree.t
@@ -283,6 +289,10 @@
 t/copy-escape.t
 t/copy-replace.t
 t/diff/mixed-checkout.t
+t/i18n/big5dirname.t
+t/i18n/checkout.t
+t/i18n/win32filename.t
+t/mirror/commit-copy.t
 t/mirror/dav-authz.t
 t/mirror/relocate.t
 t/mirror/sync-crazy-replace.t
@@ -293,9 +303,9 @@
 t/mirror/sync-replaced.t
 t/mirror/sync-replicate.t
 t/mirror/sync-revhole.t
-t/update-gone.t
 t/svk-sec.gpg
 t/svk.gpg
+t/update-gone.t
 utils/extract-docs
 utils/extract-message-catalog
 utils/license_tag
@@ -303,4 +313,3 @@
 utils/svk-ediff.el
 utils/vc-svk.el
 utils/verify-mirror
-

Modified: branches/2.0-releng/MANIFEST.SKIP
==============================================================================
--- branches/2.0-releng/MANIFEST.SKIP	(original)
+++ branches/2.0-releng/MANIFEST.SKIP	Tue Jul 17 12:36:05 2007
@@ -1,5 +1,7 @@
 ~$
 .gz$
+.zip$
+.exe$
 .bak$
 Makefile$
 MANIFEST.perl$
@@ -12,7 +14,11 @@
 var/*
 t/*/var/*
 doc/talks/*
+doc/relnotes*
 doc/user_stories/*
+pkg/src
+pkg/build
+pkg/build/*
 ^\.
 /\._
 \.orig$

Modified: branches/2.0-releng/lib/SVK/Editor/Composite.pm
==============================================================================
--- branches/2.0-releng/lib/SVK/Editor/Composite.pm	(original)
+++ branches/2.0-releng/lib/SVK/Editor/Composite.pm	Tue Jul 17 12:36:05 2007
@@ -83,7 +83,8 @@
     }
     elsif ($func =~ m/^close_(?:file|directory)/) {
 	if (defined $arg[0]) {
-	    return if $arg[0] eq $self->{anchor_baton};
+	    return if defined $self->{anchor_baton} &&
+		$arg[0] eq $self->{anchor_baton};
 	    return if defined $self->{target_baton} &&
 		$arg[0] eq $self->{target_baton};
 	}

Modified: branches/2.0-releng/lib/SVK/Editor/Diff.pm
==============================================================================
--- branches/2.0-releng/lib/SVK/Editor/Diff.pm	(original)
+++ branches/2.0-releng/lib/SVK/Editor/Diff.pm	Tue Jul 17 12:36:05 2007
@@ -56,7 +56,7 @@
 use base 'SVK::Editor';
 
 use SVK::I18N;
-use autouse 'SVK::Util' => qw( slurp_fh tmpfile mimetype_is_text catfile abs2rel );
+use autouse 'SVK::Util' => qw( slurp_fh tmpfile mimetype_is_text catfile abs2rel from_native);
 
 =head1 NAME
 
@@ -211,8 +211,10 @@
 sub _report_path {
     my ($self, $path) = @_;
 
-    return (defined $self->{report} && length $self->{report})
-	? catfile($self->{report}, $path) : $path;
+    return $path if !(defined $self->{report} && length $self->{report});
+    my $report = $self->{report}; $report = "$report";
+    from_native($report);
+    return catfile($report, $path);
 }
 
 sub close_file {

Modified: branches/2.0-releng/lib/SVK/Root/Checkout.pm
==============================================================================
--- branches/2.0-releng/lib/SVK/Root/Checkout.pm	(original)
+++ branches/2.0-releng/lib/SVK/Root/Checkout.pm	Tue Jul 17 12:36:05 2007
@@ -50,7 +50,7 @@
 # END BPS TAGGED BLOCK }}}
 package SVK::Root::Checkout;
 use strict;
-use SVK::Util qw(abs2rel md5_fh is_symlink);
+use SVK::Util qw(abs2rel md5_fh is_symlink from_native to_native );
 
 use base qw{ Class::Accessor::Fast };
 
@@ -180,7 +180,10 @@
 sub _get_copath {
     my ($self, $path, $pool) = @_;
     # XXX: copath shouldn't be copath_anchor!
-    my $copath = abs2rel($path, $self->path->path_anchor => $self->path->copath);
+    my $copath = $self->path->copath; $copath = "$copath";
+    from_native($copath);
+    $copath = abs2rel($path, $self->path->path_anchor => $copath);
+    to_native($copath);
     my $root;
     ($root, $_[1]) = $self->path->source->root->get_revision_root
 	($path, $self->path->xd->{checkout}->get($copath, 1)->{revision}, $pool);

Modified: branches/2.0-releng/pkg/buildsvk.pl
==============================================================================
--- branches/2.0-releng/pkg/buildsvk.pl	(original)
+++ branches/2.0-releng/pkg/buildsvk.pl	Tue Jul 17 12:36:05 2007
@@ -14,12 +14,38 @@
 
 =head1 SYNOPSIS
 
+  buildsvk.pl    # build svk from src/SVK-version.tar.gz dist file
+  buildsvk.pl .. # build svk from the toplevel tree of current checkout
 
 
 =head1 DESCRIPTION
 
-Put the dist files under src and C<buildsvk.pl> will create a build
-directory with everything installed under it.
+Put the CPAN dist files under src and C<buildsvk.pl> will create a build tarball
+which bundles the svn libraries.  To use, just untar and symlink C<svk> under it
+to a bin path.  There will also be a maketest script for you to run the included
+tests.
+
+If you are on win32, This will build a bundled installer for you including svn
+libraries and all necessary perl core modules.  you need the strawberry-perl.zip
+and svn-win*{,_pl}.zip under current directory before you run buildsvk.pl.
+strawberry-perl.zip can be obtained by zipping the freshly installed
+strawberry-perl for the moment.  You will also need NSIS installed under
+$PATH or C:\program files\nsis.
+
+=head1 TODO
+
+=over 4
+
+=item *
+
+README file in the build.
+
+=item *
+
+cleanup win32 build code to be more like unix build.
+
+=back
+
 
 =cut
 
@@ -104,9 +130,10 @@
 
 sub extract {
     my $self = shift;
-    my $ae = Archive::Extract->new( archive => shift );
+    my ($arc, $to) = @_;
+    my $ae = Archive::Extract->new( archive => $arc );
 
-    $ae->extract( to => $self->build_base )
+    $ae->extract( to => $to || $self->build_base )
 	or die $ae->error;
 }
 
@@ -153,17 +180,28 @@
     $self->build_dir.'/perl';
 }
 
-sub prepare_dist {
+sub test_files {
     my $self = shift;
     my $toplevel = shift;
-    copy('svk-wrapper' => $self->build_dir."/svk");
-    chmod 0755, $self->build_dir."/svk";
+    my @tests;
 
     open my $fh, "$toplevel/MANIFEST" or die "Could not create $toplevel/MANIFEST: ".$!;
     while (<$fh>) {
 	chomp;
 	next unless m{^t/};
-	my $file = $_;
+        push @tests, $_;
+    }
+    return @tests;
+}
+
+sub prepare_dist {
+    my $self = shift;
+    my $toplevel = shift;
+    copy('svk-wrapper' => $self->build_dir."/svk");
+    chmod 0755, $self->build_dir."/svk";
+
+
+    for my $file ($self->test_files($toplevel)) {
 	my (undef, $dir, undef) = File::Spec->splitpath($file);
 	mkpath [ $self->build_dir."/$dir" ];
 	copy($toplevel.'/'.$file => $self->build_dir."/$file");
@@ -272,6 +310,8 @@
 
     move($_ => File::Spec->catfile($self->build_dir, 'strawberry-perl', 'perl', 'bin'))
 	for glob($self->build_dir."/svn-win32-1.4.4/bin/*.dll");
+
+    move($self->build_dir."/svn-win32-1.4.4/iconv" => File::Spec->catfile($self->build_dir, 'strawberry-perl', 'iconv'))
 }
 
 sub prepare_dist {
@@ -281,6 +321,7 @@
     open my $fh, 'win32/paroptions.txt' or die $!;
     while (<$fh>) { next if m/^#/; chomp; push @paroptions, split(/ /,$_) };
     push @paroptions,
+         -o => $self->build_dir."/SVK.par",
          -a => "$toplevel/lib/SVK/Help;lib/SVK/Help",
          -a => "$toplevel/lib/SVK/I18N;lib/SVK/I18N",
          -a => $self->perldest."/auto/POSIX;lib/auto/POSIX",
@@ -289,38 +330,45 @@
          (map { (-a => File::Spec->catfile($self->build_dir, 'strawberry-perl', 'perl', 'bin', $_).";bin/$_") }
               qw(perl.exe perl58.dll prove.bat intl3_svn.dll libapr.dll libapriconv.dll libaprutil.dll libdb44.dll libeay32.dll ssleay32.dll) ),
          -a => "$toplevel/blib/script/svk;bin/svk",
-         -a => "$toplevel/blib/script/svk.bat;bin/svk.bat",
          -a => "$toplevel/pkg/win32/maketest.bat;win32/maketest.bat",
          -a => "$toplevel/pkg/win32/svk.ico;win32/svk.ico",
          -a => "$toplevel/pkg/win32/svk-uninstall.ico;win32/svk-uninstall.ico",
          -a => "$toplevel/pkg/win32/svk.nsi;win32/svk.nsi",
          -a => "$toplevel/pkg/win32/Path.nsh;win32/Path.nsh",
+         -a => File::Spec->catfile($self->build_dir, 'strawberry-perl', 'iconv').";iconv",
          -a => "$toplevel/contrib;site/contrib",
          -a => "$toplevel/utils;site/utils",
-         -a => "$toplevel/t;site/t",
          -a => "$toplevel/README;README",
          -a => "$toplevel/CHANGES;CHANGES",
          -a => "$toplevel/ARTISTIC;ARTISTIC",
-         -a => "$toplevel/COPYING;COPYING";
+         -a => "$toplevel/COPYING;COPYING",
+         map { -a => "$toplevel/$_;site/$_" } $self->test_files($toplevel);
 
 
 
     rmtree ['build'] if -d 'build';
     mkdir('build');
+    $ENV{PAR_VERBATIM} = 1; # dynloader gets upset and gives warnings if it has #line
     system('pp', @paroptions, "$toplevel/blib/script/svk");
 
-    system('zip', qw(-d build\SVK.par lib\SVK));
-    system('zip', qw(-d build\t\checkout lib\SVK));
-    system('unzip', qw(-o -d build build/SVK.par));
-    $self->build_archive($self->get_svk_version($toplevel));
+    $self->extract( $self->build_dir."/SVK.par" => $self->build_dir."/build" );
+    $self->build_archive( $self->build_dir."/build", $self->get_svk_version($toplevel));
 }
 
 sub build_archive {
-    my ($self, $version) = @_;
+    my ($self, $dir, $version) = @_;
     Env::Path->PATH->Prepend("C:/Program Files/NSIS");
-    system('makensis', "/X !define MUI_VERSION $version", 'build/win32/svk.nsi');
-}
+    system('makensis', "/X !define MUI_VERSION $version", "$dir/win32/svk.nsi");
+    my ($file) = glob($self->build_dir."/build/*.exe");
+    if ($file) {
+        my (undef, $dir, $name) = File::Spec->splitpath($file);
+        rename($file => $name);
 
+        print "Congratulations! You have a new build.\n";
+    } else { 
+        warn "Couldn't build installer.\n";
+    }
+}
 
 package SVK::Build::Darwin;
 use base 'SVK::Build';

Modified: branches/2.0-releng/pkg/win32/svk.nsi
==============================================================================
--- branches/2.0-releng/pkg/win32/svk.nsi	(original)
+++ branches/2.0-releng/pkg/win32/svk.nsi	Tue Jul 17 12:36:05 2007
@@ -41,24 +41,48 @@
     SetOutPath $INSTDIR
     File /r ..\bin
     File /r ..\lib
-    File /r /x checkout ..\site
+    File /r ..\iconv
+    File /r /x t\checkout ..\site
     File /r ..\win32
-
+
 
+    ; in case of old installation
+    Delete "$INSTDIR\bin\svk.bat"
     Delete "$INSTDIR\svk.bat"
 
     ; Generate bootstrap batch file on the fly using $INSTDIR
-    FileOpen $1 "$INSTDIR\bin\svk.bat" w
+    FileOpen $1 "$INSTDIR\svk.bat" w
+    FileWrite $1 "@echo off$\n"
+    FileWrite $1 "set APR_ICONV_PATH=$INSTDIR\iconv$\n"
+    FileWrite $1 "set OLDPATH=%PATH%$\n"
+    FileWrite $1 "set PATH=$INSTDIR\bin;%PATH%$\n"
+    FileWrite $1 "if $\"%OS%$\" == $\"Windows_NT$\" goto WinNT$\n"
+    FileWrite $1 "$\"$INSTDIR\bin\perl$\" $\"$INSTDIR\bin\svk$\" %1 %2 %3 %4 %5 %6 %7 %8 %9$\n"
+    FileWrite $1 "goto endofperl$\n"
+    FileWrite $1 ":WinNT$\n"
+    FileWrite $1 "$\"$INSTDIR\bin\perl$\" $\"$INSTDIR\bin\svk$\" %*$\n"
+    FileWrite $1 "if NOT $\"%COMSPEC%$\" == $\"%SystemRoot%\system32\cmd.exe$\" goto endofperl$\n"
+    FileWrite $1 "if %errorlevel% == 9009 echo You do not have SVK installed correctly.$\n"
+    FileWrite $1 "if errorlevel 1 goto script_failed_so_exit_with_non_zero_val 2>nul$\n"
+    FileWrite $1 "set PATH=%OLDPATH%$\n"
+    FileWrite $1 "set APR_ICONV_PATH=$\n"
+    FileClose $1
+
+    ; Generate bootstrap batch file on the fly using $INSTDIR
+    FileOpen $1 "$INSTDIR\site\maketest.bat" w
     FileWrite $1 "@echo off$\n"
+    FileWrite $1 "set APR_ICONV_PATH=$INSTDIR\iconv$\n"
+    FileWrite $1 "cd $\"$INSTDIR\bin$\"$\n"
     FileWrite $1 "if $\"%OS%$\" == $\"Windows_NT$\" goto WinNT$\n"
-    FileWrite $1 "$\"$INSTDIR\bin\perl.exe$\" $\"$INSTDIR\bin\svk$\" %1 %2 %3 %4 %5 %6 %7 %8 %9$\n"
-    FileWrite $1 "goto endofsvk$\n"
+    FileWrite $1 "goto endofperl$\n"
     FileWrite $1 ":WinNT$\n"
-    FileWrite $1 "$\"%~dp0perl.exe$\" $\"%~dp0svk$\" %*$\n"
     FileWrite $1 "if NOT $\"%COMSPEC%$\" == $\"%SystemRoot%\system32\cmd.exe$\" goto endofperl$\n"
-    FileWrite $1 "if %errorlevel% == 9009 echo You do not have Perl in your PATH.$\n"
+    FileWrite $1 "if %errorlevel% == 9009 echo You do not have SVK installed correctly.$\n"
     FileWrite $1 "if errorlevel 1 goto script_failed_so_exit_with_non_zero_val 2>nul$\n"
-    FileWrite $1 ":endofperl$\n"
+    FileWrite $1 ".\perl -I..\site prove.bat -r ..\site\t$\n"
+    FileWrite $1 "set APR_ICONV_PATH=$\n"
     FileClose $1
+    ; XXX: try to cd back to where we are please
+
 
     WriteUninstaller "$INSTDIR\Uninstall.exe"
 
@@ -74,8 +98,8 @@
 
 
 Done:
-    ; Add \bin directory to the PATH for svk.bat and DLLs
-    Push "$INSTDIR\bin"
+    ; Add  directory to the PATH for svk.bat and DLLs
+    Push $INSTDIR
     Call AddToPath
 SectionEnd
  

Modified: branches/2.0-releng/t/23commit-inter-nav.t
==============================================================================
--- branches/2.0-releng/t/23commit-inter-nav.t	(original)
+++ branches/2.0-releng/t/23commit-inter-nav.t	Tue Jul 17 12:36:05 2007
@@ -14,10 +14,10 @@
 mkdir ('A');
 mkdir ('A/deep');
 mkdir ('A/deep/la');
-overwrite_file ("A/foo", "foobar\ngrab\n");
-overwrite_file ("A/deep/baz", "makar");
-overwrite_file ("A/deep/la/no", "foobar");
-overwrite_file ("A/deep/mas", "po\nkra\nczny");
+overwrite_file_raw ("A/foo", "foobar\ngrab\n");
+overwrite_file_raw ("A/deep/baz", "makar");
+overwrite_file_raw ("A/deep/la/no", "foobar");
+overwrite_file_raw ("A/deep/mas", "po\nkra\nczny");
 
 $svk->add ('A');
 
@@ -261,7 +261,7 @@
     ' +wex',
     ''], 'skip all \'bata\' properties');
 
-overwrite_file ("A/deep/mas", "wy\nkra\nkal\n");
+overwrite_file_raw ("A/deep/mas", "wy\nkra\nkal\n");
 $svk->propset('parra', 'kok', 'A/deep/mas');
 $answer = [[qq{--- A/deep/mas\t(revision 6)
 +++ A/deep/mas\t(local)}.q{
@@ -494,8 +494,8 @@
     ' +wex',
     ''], 'commit only content changes');
 
-overwrite_file ("A/deep/mas", "wy\npstry\nkal\n");
-overwrite_file ("A/foo", "temp");
+overwrite_file_raw ("A/deep/mas", "wy\npstry\nkal\n");
+overwrite_file_raw ("A/foo", "temp");
 $answer = [[qq{--- A/deep/mas\t(revision 7)
 +++ A/deep/mas\t(local)}.q{
 @@ -0,2 +0,2 @@
@@ -617,7 +617,7 @@
 is_deeply($answer, ['stop'], 'all answers used');
 is_output ($svk, 'status', [], [], 'commit change to root directory');
 
-overwrite_file ("A/foo", "za\ngrab\nione\n");
+overwrite_file_raw ("A/foo", "za\ngrab\nione\n");
 $answer = [[qq{--- foo\t(revision 9)
 +++ foo\t(local)}.q{
 @@ -0,1 +0,1 @@
@@ -654,7 +654,7 @@
     '+ione'], 'skiped content change to directly passed file');
 
 $svk->propset('papa', 'mot', 'A/foo');
-overwrite_file ("A/foo", "za\ngrab\nione\n");
+overwrite_file_raw ("A/foo", "za\ngrab\nione\n");
 $answer = [[qq{--- foo\t(revision 9)
 +++ foo\t(local)}.q{
 @@ -0,1 +0,1 @@
@@ -730,7 +730,7 @@
 is_output($svk,'merge', ['-c1', '//A/foo', 'A/deep/mas'],
 [ __('C   A/deep/mas'), '1 conflict found.'], "Merge a conflict into the tree");
 
-overwrite_file ("A/foo", "za\npalny\n");
+overwrite_file_raw ("A/foo", "za\npalny\n");
 $answer = [[q{Conflict detected in:
   A/deep/mas
 file. Do you want to skip it and commit other changes? (y/n) }, 'n'],'stop'];
@@ -772,7 +772,7 @@
 [__('C   A/deep/baz'),
 '1 conflict found.'
 ], "create another conflict");
-overwrite_file ("A/foo", "");
+overwrite_file_raw ("A/foo", "");
 $answer = [[q{Conflict detected in:
   A/deep/baz
   A/deep/mas
@@ -812,7 +812,7 @@
 
 $svk->revert('A/deep/baz', 'A/deep/mas');
 $svk->propset('svn:mime-type', 'faked/type', 'A/deep/mas');
-overwrite_file ("A/deep/mas", "baran\nkoza\nowca\n");
+overwrite_file_raw ("A/deep/mas", "baran\nkoza\nowca\n");
 $show_prompt=1;
 $answer = [[q{
 [1/2] Modifications to binary file 'A/deep/mas':
@@ -829,7 +829,7 @@
 is_output ($svk, 'status', [], [], 'replace file with binary one');
 
 $svk->propset('svn:mime-type', 'text/plain', 'A/deep/mas');
-overwrite_file ("A/deep/mas", "krowa\nkoza\n");
+overwrite_file_raw ("A/deep/mas", "krowa\nkoza\n");
 $show_prompt=0;
 $answer = [[q{
 [1/2] Modifications to binary file 'A/deep/mas':
@@ -848,7 +848,7 @@
 is_deeply($answer, ['stop'], 'all answers used');
 is_output ($svk, 'status', [], [], 'replace binary file with text one');
 
-overwrite_file ("A/deep/mas", "byk\nkrowa\nbawol\nkoza\nkaczka\n");
+overwrite_file_raw ("A/deep/mas", "byk\nkrowa\nbawol\nkoza\nkaczka\n");
 $answer = [[qq{--- A/deep/mas\t(revision 15)
 +++ A/deep/mas\t(local)}.q{
 @@ -0,1 +0,1 @@
@@ -885,7 +885,7 @@
 
 #our $show_prompt_output=1;
 $svk->propset('kox', 'ob', 'A/deep');
-overwrite_file ("A/deep/mas", "mleczna\nkrowa\n");
+overwrite_file_raw ("A/deep/mas", "mleczna\nkrowa\n");
 $answer = [[qq{--- A/deep/mas\t(revision 16)
 +++ A/deep/mas\t(local)}.q{
 @@ -0,4 +0,4 @@

Modified: branches/2.0-releng/t/32list.t
==============================================================================
--- branches/2.0-releng/t/32list.t	(original)
+++ branches/2.0-releng/t/32list.t	Tue Jul 17 12:36:05 2007
@@ -2,6 +2,7 @@
 use Test::More tests => 69;
 use strict;
 use SVK::Test;
+use SVK::Util qw( time2str );
 our $output;
 
 my ($xd, $svk) = build_test('bob');
@@ -43,9 +44,11 @@
                ["/$depot/A/B/","/$depot/A/foo", '', 'Path /crap is not versioned.', '']);
     ok ($svk->ls ('-f', "/$depot/A", "/$depot/crap/") == 1, "ls -f /$depot/A /$depot/crap/ [exit status]");
 
-    use POSIX qw( strftime );
-    my $re_date = join '|', map { quotemeta strftime( "%b", 0, 0, 0, 1, $_, 96) } 0 .. 11;
-    $re_date = "(?:$re_date) \\d{2} \\d{2}:\\d{2}";
+    use POSIX qw( mktime );
+    my $re_date = join '|', map { 
+	quotemeta time2str( "%b", mktime(0, 0, 0, 1, $_, 96) ) 
+    } 0 .. 11;
+    $re_date = " ?(?:$re_date) \\d{2} \\d{2}:\\d{2}";
     my $re_user = "(?:\\S*\\s+)";
     is_output ($svk, 'ls', ['-v'],
                [qr"      2 $re_user          $re_date A/"]);

Added: branches/2.0-releng/t/i18n/big5dirname.t
==============================================================================
--- (empty file)
+++ branches/2.0-releng/t/i18n/big5dirname.t	Tue Jul 17 12:36:05 2007
@@ -0,0 +1,92 @@
+#!/usr/bin/perl -w
+use strict;
+use SVK::Util qw( to_native from_native);
+use SVK::Test;
+#plan skip_all => "Only needed to test on win32" unless IS_WIN32;
+
+use POSIX qw(setlocale LC_CTYPE);
+setlocale (LC_CTYPE, $ENV{LC_CTYPE} = 'zh_TW.Big5')
+    or plan skip_all => 'cannot set locale to zh_TW.Big5';
+
+plan tests => 10;
+our $output;
+
+my $big5dir = "\x{b7}\x{7c}\x{b1}\x{e0}"; # meeting , contains a '|' character
+my $file = "\x{a4}\x{a4}\x{a4}\x{e5}.txt"; # Chinese
+my $file2 = "\x{b6}\x{7d}\x{b7}\x{7c}.txt"; # meeting
+mkpath ["t/checkout/filenames/$big5dir"], 0, 0700 unless -d "t/checkout/filenames/$big5dir";
+
+my ($xd, $svk) = build_test('dirname_enc');
+my ($copath, $corpath) = get_copath ("filenames/$big5dir");
+my ($repospath, $path, $repos) = $xd->find_repos ('/dirname_enc/', 1);
+sub copath { SVK::Path::Checkout->copath($copath, @_) }
+
+$svk->checkout ('//', $copath);
+
+my $filename = $file;
+overwrite_file ("$copath/$file", "new file to add\n");
+overwrite_file ("$copath/$file2", "new file2 to add\n");
+chdir($copath);
+
+is_output ($svk, 'add', [ $file],
+           ['A   '.$file]);
+is_output ($svk, 'add', [ $file2],
+           ['A   '.$file2]);
+chdir('..');
+is_output($svk, 'ci', [-m => 'commit single checkout', $big5dir],
+          ['Committed revision 1.']);
+chdir($big5dir);
+append_file($file, "change single file\n");
+
+from_native($filename);
+append_file($file, "utf8 filename: $filename\n");
+is_output($svk, 'diff', [$file],
+          ['=== '.$filename,
+           '==================================================================',
+           "--- $file\t(revision 1)",
+           "+++ $file\t(local)",
+           '@@ -1 +1,3 @@',
+           ' new file to add',
+           '+change single file',
+           '+utf8 filename: '.$filename,
+          ]);
+is_output($svk, 'ci', [-m => 'commit single checkout', $file],
+          ['Committed revision 2.']);
+
+chdir ('../../../../');
+$svk->update ('-r', 1, $copath);
+chdir($copath);
+is_file_content ("$file", "new file to add\n");
+
+overwrite_file ("$file",
+                "hihi\n");
+our $answer = [ 'd', 'y' ];
+chdir ('../../../../');
+$svk->update ($copath); # XXX use is_ouptut to compare conflict diff header
+ok ($output =~ m/1 conflict found\./, 'conflict');
+
+$svk->revert ($copath);
+$svk->resolved ($copath);
+$svk->update ($copath); # XXX use is_ouptut to compare conflict diff header
+append_file("$copath/$file2", "big5 filename: $file2\n");
+chdir($copath);
+chdir('..');
+$filename = "$big5dir/$file2";
+from_native($filename);
+is_output($svk, 'diff', ["$big5dir/$file2"],
+          ['=== '.$filename,
+           '==================================================================',
+           "--- $big5dir/$file2\t(revision 2)",
+           "+++ $big5dir/$file2\t(local)",
+           '@@ -1 +1,2 @@',
+           ' new file2 to add',
+           '+big5 filename: '.$file2,
+          ]);
+is_output($svk, 'ci', [-m => 'commit diff checkout', $big5dir],
+          ['Committed revision 3.']);
+
+chdir('../../../');
+$svk->update ('-r', 2, $copath);
+append_file("$copath/$file2", "big5 filename: $file2\n");
+$svk->update ($copath); 
+ok ($output =~ m#g   t/checkout/filenames/$big5dir/$file2#, 'merged');

Added: branches/2.0-releng/t/i18n/checkout.t
==============================================================================
--- (empty file)
+++ branches/2.0-releng/t/i18n/checkout.t	Tue Jul 17 12:36:05 2007
@@ -0,0 +1,67 @@
+#!/usr/bin/perl -w
+use strict;
+use SVK::Util qw( is_executable to_native from_native);
+use SVK::Test;
+#plan skip_all => "Only needed to test on win32" unless IS_WIN32;
+
+use POSIX qw(setlocale LC_CTYPE);
+setlocale (LC_CTYPE, $ENV{LC_CTYPE} = 'zh_TW.Big5')
+    or plan skip_all => 'cannot set locale to zh_TW.Big5';
+
+plan tests => 7;
+our $output;
+
+mkpath ["t/checkout/filenames"], 0, 0700 unless -d "t/checkout/filenames";
+
+my ($xd, $svk) = build_test('filename_enc');
+my ($copath, $corpath) = get_copath ('filenames');
+my ($repospath, $path, $repos) = $xd->find_repos ('/filename_enc/', 1);
+sub copath { SVK::Path::Checkout->copath($copath, @_) }
+
+$svk->checkout ('//', $copath);
+
+my $file = "\x{a4}\x{a4}\x{a4}\x{e5}\x{c0}\x{c9}.txt";
+my $filename = $file;
+overwrite_file ("$copath/$file", "new file to add\n");
+chdir($copath);
+
+is_output ($svk, 'add', [$file],
+           ['A   '.$file]);
+is_output($svk, 'ci', [-m => 'commit single checkout', $file],
+          ['Committed revision 1.']);
+append_file($file, "change single file\n");
+
+from_native($filename);
+append_file($file, "utf8 filename: $filename\n");
+is_output($svk, 'diff', [$file],
+          ['=== '.$filename,
+           '==================================================================',
+           "--- $file\t(revision 1)",
+           "+++ $file\t(local)",
+           '@@ -1 +1,3 @@',
+           ' new file to add',
+           '+change single file',
+           '+utf8 filename: '.$filename,
+          ]);
+is_output($svk, 'ci', [-m => 'commit single checkout', $file],
+          ['Committed revision 2.']);
+
+chdir ('..');
+chdir ('..');
+chdir ('..');
+$svk->update ('-r', 1, $copath);
+is_file_content (copath("$file"), "new file to add\n");
+
+overwrite_file (copath("$file"),
+                "hihi\n");
+$svk->update ($copath); # XXX use is_ouptut to compare conflict diff header
+ok ($output =~ m/1 conflict found\./, 'conflict');
+
+$svk->update ('-r', 1, $copath);
+overwrite_file (copath("$file"),
+                "hihi\n");
+
+$ENV{SVKRESOLVE} = "";
+our $answer = [ 'd', 'y' ];
+$svk->update ($copath); # XXX use is_ouptut to compare conflict diff header
+ok ($output =~ m#G   t/checkout/filenames/$file#, 'diff');

Added: branches/2.0-releng/t/i18n/win32filename.t
==============================================================================
--- (empty file)
+++ branches/2.0-releng/t/i18n/win32filename.t	Tue Jul 17 12:36:05 2007
@@ -0,0 +1,58 @@
+#!/usr/bin/perl -w
+use strict;
+use SVK::Util qw( is_executable to_native from_native);
+use SVK::Test;
+plan skip_all => "Only needed to test on win32" unless IS_WIN32;
+plan tests => 6;
+our $output;
+
+mkpath ["t/checkout/filenames"], 0, 0700 unless -d "t/checkout/filenames";
+
+my ($xd, $svk) = build_test('filename_enc');
+my ($copath, $corpath) = get_copath ('filenames');
+my ($repospath, $path, $repos) = $xd->find_repos ('/filename_enc/', 1);
+sub copath { SVK::Path::Checkout->copath($copath, @_) }
+
+$svk->checkout ('//', $copath);
+
+my $file = "\x{a4}\x{a4}\x{a4}\x{e5}\x{c0}\x{c9}.txt";
+my $filename = $file;
+overwrite_file ("$copath/$file", "new file to add\n");
+chdir($copath);
+
+is_output ($svk, 'add', [$file],
+	   ['A   '.$file]);
+is_output($svk, 'ci', [-m => 'commit single checkout', $file],
+	  ['Committed revision 1.']);
+append_file($file, "change single file\n");
+
+from_native($filename);
+append_file($file, "utf8 filename: $filename\n");
+is_output($svk, 'diff', [$file],
+	  ['=== '.$filename,
+	   '==================================================================',
+	   "--- $file\t(revision 1)",
+	   "+++ $file\t(local)",
+	   '@@ -1 +1,3 @@',
+	   ' new file to add',
+	   '+change single file',
+	   '+utf8 filename: '.$filename,
+	  ]);
+is_output($svk, 'ci', [-m => 'commit single checkout', $file],
+	  ['Committed revision 2.']);
+
+chdir ('..');
+chdir ('..');
+chdir ('..');
+$svk->update ('-r', 1, $copath);
+is_file_content (copath("$file"), "new file to add\n");
+
+overwrite_file (copath("$file"),
+		"hihi\n");
+$svk->update ($copath);
+ok ($output =~ m/1 conflict found\./, 'conflict');
+
+$svk->revert ($copath);
+$svk->resolved ($copath);
+
+1;


More information about the svk-commit mailing list