[svk-commit] r2431 - in branches/i18n-fixes: . lib/SVK pkg/win32 t t/api

nobody at bestpractical.com nobody at bestpractical.com
Sat Jul 14 05:42:56 EDT 2007


Author: clkao
Date: Sat Jul 14 05:42:53 2007
New Revision: 2431

Added:
   branches/i18n-fixes/pkg/win32/builddist.bat   (contents, props changed)
   branches/i18n-fixes/pkg/win32/paroptions.txt
   branches/i18n-fixes/pkg/win32/setenv.bat   (contents, props changed)
   branches/i18n-fixes/t/05svm-branches.t
   branches/i18n-fixes/t/api/root.t
Modified:
   branches/i18n-fixes/   (props changed)
   branches/i18n-fixes/MANIFEST
   branches/i18n-fixes/lib/SVK/Command/Commit.pm
   branches/i18n-fixes/lib/SVK/Command/Pull.pm
   branches/i18n-fixes/lib/SVK/Merge.pm
   branches/i18n-fixes/lib/SVK/Path.pm
   branches/i18n-fixes/lib/SVK/Util.pm
   branches/i18n-fixes/pkg/win32/Path.nsh
   branches/i18n-fixes/pkg/win32/svk.nsi

Log:
merge down for i18n fixes branch.

Modified: branches/i18n-fixes/MANIFEST
==============================================================================
--- branches/i18n-fixes/MANIFEST	(original)
+++ branches/i18n-fixes/MANIFEST	Sat Jul 14 05:42:53 2007
@@ -282,6 +282,7 @@
 t/76ignore.t
 t/77floating.t
 t/api/mirror.t
+t/api/root.t
 t/copy-escape.t
 t/copy-replace.t
 t/diff/mixed-checkout.t

Modified: branches/i18n-fixes/lib/SVK/Command/Commit.pm
==============================================================================
--- branches/i18n-fixes/lib/SVK/Command/Commit.pm	(original)
+++ branches/i18n-fixes/lib/SVK/Command/Commit.pm	Sat Jul 14 05:42:53 2007
@@ -70,15 +70,15 @@
 use Class::Autouse qw( SVK::Editor::Rename SVK::Editor::Merge );
 
 sub options {
-    ('m|message=s'  => 'message',
-     'F|file=s'     => 'message_file',
-     'C|check-only' => 'check_only',
-     'S|sign'       => 'sign',
-     'P|patch=s'    => 'patch',
-     'import'       => 'import',
-     'direct'       => 'direct',
-     'template'     => 'template',
-     'interactive'  => 'interactive',
+    ('m|message=s'    => 'message',
+     'F|file=s'       => 'message_file',
+     'C|check-only'   => 'check_only',
+     'S|sign'         => 'sign',
+     'P|patch=s'      => 'patch',
+     'import'         => 'import',
+     'direct'         => 'direct',
+     'template'       => 'template',
+     'i|interactive'  => 'interactive',
      'set-revprop=s@' => 'setrevprop',
     );
 }

Modified: branches/i18n-fixes/lib/SVK/Command/Pull.pm
==============================================================================
--- branches/i18n-fixes/lib/SVK/Command/Pull.pm	(original)
+++ branches/i18n-fixes/lib/SVK/Command/Pull.pm	Sat Jul 14 05:42:53 2007
@@ -50,6 +50,8 @@
 # END BPS TAGGED BLOCK }}}
 package SVK::Command::Pull;
 use strict;
+use warnings;
+
 use SVK::Version;  our $VERSION = $SVK::VERSION;
 
 use base qw( SVK::Command::Update );
@@ -58,6 +60,7 @@
 sub options {
    ('a|all'		=> 'all',
     'force-incremental' => 'force_incremental',
+    'no-sync'       => 'no_sync',
     'l|lump'		=> 'lump');
 }
 
@@ -90,7 +93,7 @@
     }
 
 
-    $self->{sync}++;
+    $self->{sync}++ unless $self->{'no_sync'};
     $self->{merge}++;
 
     $self->SUPER::parse_arg (@arg);

Modified: branches/i18n-fixes/lib/SVK/Merge.pm
==============================================================================
--- branches/i18n-fixes/lib/SVK/Merge.pm	(original)
+++ branches/i18n-fixes/lib/SVK/Merge.pm	Sat Jul 14 05:42:53 2007
@@ -678,9 +678,9 @@
     # now the hard part, reoslve the revision
     my $usrc = $src->universal;
     my $srckey = join(':', $usrc->{uuid}, $usrc->{path});
+    my $udst = $self->{dst}->universal;
+    my $dstkey = join(':', $udst->{uuid}, $udst->{path});
     unless ($dstinfo->{$srckey}) {
-	my $udst = $self->{dst}->universal;
-	my $dstkey = join(':', $udst->{uuid}, $udst->{path});
 	return $srcinfo->{$dstkey}{rev} ?
 	    ($path, $srcinfo->{$dstkey}->local($self->{dst}->depot)->revision) : ();
     }
@@ -688,9 +688,15 @@
 	# same as re-base in editor::copy
 	my $rev = $self->{src}->merged_from
 	    ($self->{base}, $self, $self->{base}->path_anchor);
-	# XXX: compare rev and cp_rev
-	return ($path, $rev) if defined $rev;
-	return;
+
+	return unless defined $rev;
+	$rev = $self->merge_info_with_copy(
+	  $self->{src}->mclone(revision => $rev)
+        )->{$dstkey}
+         ->local($self->{dst}->depot)
+         ->revision;
+
+	return ($path, $rev);
     }
     # XXX: get rid of the merge context needed for
     # merged_from(); actually what the function needs is

Modified: branches/i18n-fixes/lib/SVK/Path.pm
==============================================================================
--- branches/i18n-fixes/lib/SVK/Path.pm	(original)
+++ branches/i18n-fixes/lib/SVK/Path.pm	Sat Jul 14 05:42:53 2007
@@ -539,7 +539,7 @@
 
 sub copy_ancestors {
     my $self = shift;
-    @{ $self->{copy_ancesotrs}{$self->path}{$self->revision} ||=
+    @{ $self->{copy_ancestors}{$self->path}{$self->revision} ||=
 	   [$self->_copy_ancestors] };
 }
 

Modified: branches/i18n-fixes/lib/SVK/Util.pm
==============================================================================
--- branches/i18n-fixes/lib/SVK/Util.pm	(original)
+++ branches/i18n-fixes/lib/SVK/Util.pm	Sat Jul 14 05:42:53 2007
@@ -476,23 +476,26 @@
 
 =cut
 
+{ my $mm; # C<state $mm>, yuck
+
 sub mimetype {
     my ($filename) = @_;
-    my $mm if 0;  # C<state $mm>, yuck
 
     # find an implementation module if necessary
-    if ( !$mm ) {
+    $mm ||= do {
         my $module = $ENV{SVKMIME} || 'Internal';
         $module =~ s/:://;
         $module = "SVK::MimeDetect::$module";
         eval "require $module";
         die $@ if $@;
-        $mm = $module->new();
-    }
+        $module->new();
+    };
 
     return $mm->checktype_filename($filename);
 }
 
+}
+
 =head3 mimetype_is_text ($mimetype)
 
 Return whether a MIME type string looks like a text file.

Modified: branches/i18n-fixes/pkg/win32/Path.nsh
==============================================================================
--- branches/i18n-fixes/pkg/win32/Path.nsh	(original)
+++ branches/i18n-fixes/pkg/win32/Path.nsh	Sat Jul 14 05:42:53 2007
@@ -1,3 +1,4 @@
+
 ;----------------------------------------
 ; based upon a script of "Written by KiCHiK 2003-01-18 05:57:02"
 ;----------------------------------------
@@ -68,7 +69,7 @@
       FileOpen $1 "$1\autoexec.bat" a
       FileSeek $1 0 END
       GetFullPathName /SHORT $0 $0
-      FileWrite $1 "$\r$\nSET PATH=$0;%PATH%$\r$\n"
+      FileWrite $1 "$\r$\nSET PATH=%PATH%;$0$\r$\n"
       FileClose $1
       Goto AddToPath_done
 
@@ -85,7 +86,7 @@
          ReadRegStr $1 ${NT_current_env} "PATH"
       read_path_NT_resume:
       StrCmp $1 "" AddToPath_NTdoIt
-         StrCpy $2 "$0;$1"
+         StrCpy $2 "$1;$0"
          Goto AddToPath_NTdoIt
       AddToPath_NTdoIt:
          StrCmp $4 "current" write_path_NT_current
@@ -116,6 +117,92 @@
 FunctionEnd
 
 ;====================================================
+; RemoveFromPath - Remove a given dir from the path
+;     Input: head of the stack
+;====================================================
+Function un.RemoveFromPath
+   Exch $0
+   Push $1
+   Push $2
+   Push $3
+   Push $4
+   
+   Call un.IsNT
+   Pop $1
+   StrCmp $1 1 unRemoveFromPath_NT
+      ; Not on NT
+      StrCpy $1 $WINDIR 2
+      FileOpen $1 "$1\autoexec.bat" r
+      GetTempFileName $4
+      FileOpen $2 $4 w
+      GetFullPathName /SHORT $0 $0
+      StrCpy $0 "SET PATH=%PATH%;$0"
+      SetRebootFlag true
+      Goto unRemoveFromPath_dosLoop
+     
+      unRemoveFromPath_dosLoop:
+         FileRead $1 $3
+         StrCmp $3 "$0$\r$\n" unRemoveFromPath_dosLoop
+         StrCmp $3 "$0$\n" unRemoveFromPath_dosLoop
+         StrCmp $3 "$0" unRemoveFromPath_dosLoop
+         StrCmp $3 "" unRemoveFromPath_dosLoopEnd
+         FileWrite $2 $3
+         Goto unRemoveFromPath_dosLoop
+
+      unRemoveFromPath_dosLoopEnd:
+         FileClose $2
+         FileClose $1
+         StrCpy $1 $WINDIR 2
+         Delete "$1\autoexec.bat"
+         CopyFiles /SILENT $4 "$1\autoexec.bat"
+         Delete $4
+         Goto unRemoveFromPath_done
+ 
+   unRemoveFromPath_NT:
+      StrLen $2 $0
+      Call un.select_NT_profile
+      Pop  $4
+
+      StrCmp $4 "current" un_read_path_NT_current
+         ReadRegStr $1 ${NT_all_env} "PATH"
+         Goto un_read_path_NT_resume
+      un_read_path_NT_current:
+         ReadRegStr $1 ${NT_current_env} "PATH"
+      un_read_path_NT_resume:
+
+      Push $1
+      Push $0
+      Call un.StrStr ; Find $0 in $1
+      Pop $0 ; pos of our dir
+      IntCmp $0 -1 unRemoveFromPath_done
+         ; else, it is in path
+         StrCpy $3 $1 $0 ; $3 now has the part of the path before our dir
+         IntOp $2 $2 + $0 ; $2 now contains the pos after our dir in the path (';')
+         IntOp $2 $2 + 1 ; $2 now containts the pos after our dir and the semicolon.
+         StrLen $0 $1
+         StrCpy $1 $1 $0 $2
+         StrCpy $3 "$3$1"
+
+         StrCmp $4 "current" un_write_path_NT_current
+            WriteRegExpandStr ${NT_all_env} "PATH" $3
+            Goto un_write_path_NT_resume
+         un_write_path_NT_current:
+            WriteRegExpandStr ${NT_current_env} "PATH" $3
+         un_write_path_NT_resume:
+         SendMessage ${HWND_BROADCAST} ${WM_WININICHANGE} 0 "STR:Environment" /TIMEOUT=5000
+   unRemoveFromPath_done:
+   Pop $4
+   Pop $3
+   Pop $2
+   Pop $1
+   Pop $0
+FunctionEnd
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+; Uninstall sutff
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+
+
+;====================================================
 ; StrStr - Finds a given string in another given string.
 ;               Returns -1 if not found and the pos if found.
 ;          Input: head of the stack - string to find

Added: branches/i18n-fixes/pkg/win32/builddist.bat
==============================================================================
--- (empty file)
+++ branches/i18n-fixes/pkg/win32/builddist.bat	Sat Jul 14 05:42:53 2007
@@ -0,0 +1,89 @@
+REM This script builds a SVK installation package
+REM The environment (IE:system path) must be configured properly before
+REM    running this script! (see setenv.bat)
+REM After this script finishes, compile the NSIS script (svk.nsi) 
+REM    located in the build\win32\ folder.
+REM 
+REM This script requires:
+REM    That SVK be built
+REM    That pp is installed
+REM    That a zip/unzip program is available (Info-Zip)
+REM
+REM If mtee is available, a logfile can be created with a command line like:
+REM builddist 2>&1 | mtee /d/t log.txt
+REM
+REM Adjust the following to your needs!
+SET SVNHOME=C:/strawberry-perl/svn-win32-1.4.4
+SET SVKSOURCE=c:/strawberry-perl/src/SVK-v2.0.1
+SET PERLHOME=C:/strawberry-perl/perl
+SET PPSOURCESCRIPT=c:/strawberry-perl/src/SVK-v2.0.1/blib/script/SVK
+SET FIXZIP=c:\utils\zip -d build\SVK.par lib\SVK.
+SET UNZIPPER=c:\utils\unzip -o -d build build\SVK.par
+REM SET UNZIPPER="c:\program files\7-Zip\7z" x -y -obuild
+REM
+SET PAR_VERBATIM=1
+REM
+REM Remove and remnants of the previous build
+rd /s /q build
+
+REM create the working folders
+mkdir build
+
+REM Create a new set of path specific PAR (pp) options
+REM Copy the original parameter file to make run-time appends
+copy paroptions.txt parsvkfixups.txt
+REM This is done here because we cannot do variable subs in the parmater file
+REM do this to bring in the help pod's
+echo -a "%SVKSOURCE%/blib/lib/SVK/Help;lib/SVK/Help" >> parsvkfixups.txt
+REM # do this to bring in the I18N
+echo -a "%SVKSOURCE%/blib/lib/SVK/I18N;lib/SVK/I18N" >> parsvkfixups.txt
+REM # do this to fix the missing POSIX files
+echo -a "%PERLHOME%/lib/auto/POSIX;lib/auto/POSIX" >> parsvkfixups.txt
+REM Add the SVK source path to the build
+echo -I %SVKSOURCE%/blib/lib >> parsvkfixups.txt
+
+REM Move the built and Win32 specific files into the par
+echo -a "%PERLHOME%/bin/perl.exe;bin/perl.exe" >> parsvkfixups.txt
+echo -a "%PERLHOME%/bin/perl58.dll;bin/perl58.dll" >> parsvkfixups.txt
+echo -a "%PERLHOME%/bin/prove.bat;bin/prove.bat" >> parsvkfixups.txt
+echo -a "%SVNHOME%/bin/intl3_svn.dll;bin/intl3_svn.dll" >> parsvkfixups.txt
+echo -a "%SVNHOME%/bin/libapr.dll;bin/libapr.dll" >> parsvkfixups.txt
+echo -a "%SVNHOME%/bin/libapriconv.dll;bin/libapriconv.dll" >> parsvkfixups.txt
+echo -a "%SVNHOME%/bin/libaprutil.dll;bin/libaprutil.dll" >> parsvkfixups.txt
+echo -a "%SVNHOME%/bin/libdb44.dll;bin/libdb44.dll" >> parsvkfixups.txt
+echo -a "%SVNHOME%/bin/libeay32.dll;bin/libeay32.dll" >> parsvkfixups.txt
+echo -a "%SVNHOME%/bin/ssleay32.dll;bin/ssleay32.dll" >> parsvkfixups.txt
+echo -a "%SVKSOURCE%/blib/script/svk;bin/svk" >> parsvkfixups.txt
+echo -a "%SVKSOURCE%/blib/script/svk.bat;bin/svk.bat" >> parsvkfixups.txt
+echo -a "%SVKSOURCE%/pkg/win32/maketest.bat;win32/maketest.bat" >> parsvkfixups.txt
+echo -a "%SVKSOURCE%/pkg/win32/svk.ico;win32/svk.ico" >> parsvkfixups.txt
+echo -a "%SVKSOURCE%/pkg/win32/svk-uninstall.ico;win32/svk-uninstall.ico" >> parsvkfixups.txt
+echo -a "%SVKSOURCE%/pkg/win32/svk.nsi;win32/svk.nsi" >> parsvkfixups.txt
+echo -a "%SVKSOURCE%/pkg/win32/Path.nsh;win32/Path.nsh" >> parsvkfixups.txt
+echo -a "%SVKSOURCE%/contrib;site/contrib" >> parsvkfixups.txt
+echo -a "%SVKSOURCE%/utils;site/utils" >> parsvkfixups.txt
+echo -a "%SVKSOURCE%/t;site/t" >> parsvkfixups.txt
+echo -a "%SVKSOURCE%/README;README" >> parsvkfixups.txt
+echo -a "%SVKSOURCE%/CHANGES;CHANGES" >> parsvkfixups.txt
+echo -a "%SVKSOURCE%/ARTISTIC;ARTISTIC" >> parsvkfixups.txt
+echo -a "%SVKSOURCE%/COPYING;COPYING" >> parsvkfixups.txt
+
+REM using par, build the compressed output
+call pp @parsvkfixups.txt %PPSOURCESCRIPT%
+
+REM Must do a fixup before the .par can be un-packed
+REM Remove the lib\SVK. file as it conflicts with the lib\SVK folder on CIFS
+call %FIXZIP%
+REM extract the par THIS USES Info-Zip unzip but could use 7z.exe
+call %UNZIPPER% 
+
+REM remove the dynamicically created par options
+del /F/Q parsvkfixups.txt
+
+REM remove the .par after it is built
+del /F/Q build\SVK.par
+
+REM remove the script folder because we do not need it
+rd /S/Q build\script
+
+:exit

Added: branches/i18n-fixes/pkg/win32/paroptions.txt
==============================================================================
--- (empty file)
+++ branches/i18n-fixes/pkg/win32/paroptions.txt	Sat Jul 14 05:42:53 2007
@@ -0,0 +1,38 @@
+# ask for verboseness
+-vvv
+# don't build the .exe, stop at the par
+-o build/SVK.par 
+-B 
+-p
+# include the svk build library
+# NOTE: This is done on the pp command line
+#-I ../../blib/lib
+# add in the icon
+-i svk.ico
+# create a log
+-L pp.log
+# include some missed modules
+-M Encode::TW
+-M POSIX
+# exclude some not-needed dependencies
+-X ExtUtils::CBuilder
+-X LWP::Authen::Ntlm
+-X LWP::Protocol::GHTTP
+-X LWP::Protocol::mailto
+-X LWP::Protocol::https
+-X LWP::Protocol::https10
+-X Module::Build::Cookbook
+-X SVN::Mirror::VCP
+-X URI::urn::isbn
+-X Net::FTP
+-X CPAN
+-X Thread
+# The following actions are now done as a secondary option file to pp
+# See the builddist.bat file for details
+# do this to bring in the help pod's
+#-a "../../blib/lib/SVK/Help;lib/SVK/Help"
+# do this to bring in the I18N
+#-a "../../blib/lib/SVK/I18N;lib/SVK/I18N"
+# do this to fix the missing POSIX files
+#-a "../../../../perl/lib/auto/POSIX;lib/auto/POSIX"
+

Added: branches/i18n-fixes/pkg/win32/setenv.bat
==============================================================================
--- (empty file)
+++ branches/i18n-fixes/pkg/win32/setenv.bat	Sat Jul 14 05:42:53 2007
@@ -0,0 +1,10 @@
+REM Change the path to only include what is needed to build SVK
+REM Set the path to all of the Strawberry-Perl places
+set path=c:\strawberry-perl\perl\bin;c:\strawberry-perl\dmake\bin;c:\strawberry-perl\mingw\bin;c:\strawberry-perl\mingw\mingw32\bin
+REM Set the path to the location of cmd.exe (OS SPECIFIC!)
+set path=%path%;%WINDIR%\system32
+REM Set the location of the SVN binaries and dll's
+set path=%path%;C:\strawberry-perl\svn-win32-1.4.4\bin
+REM Finally set the mingw compiler include and lib locations
+set include=c:\strawberry-perl\mingw\include;
+set lib=c:\strawberry-perl\mingw\lib;
\ No newline at end of file

Modified: branches/i18n-fixes/pkg/win32/svk.nsi
==============================================================================
--- branches/i18n-fixes/pkg/win32/svk.nsi	(original)
+++ branches/i18n-fixes/pkg/win32/svk.nsi	Sat Jul 14 05:42:53 2007
@@ -1,21 +1,23 @@
 SetCompressor bzip2
 
-!define MUI_COMPANY "OurInternet"
+!define MUI_COMPANY "Best Practical Solutions, LLC"
 !define MUI_PRODUCT "SVK"
-!define MUI_VERSION "0.26-1"
+!define MUI_VERSION "2.0.1-1"
 !define MUI_NAME    "svk"
 !define MUI_ICON "${MUI_NAME}.ico"
 !define MUI_UNICON "${MUI_NAME}-uninstall.ico"
 
 !include "MUI.nsh"
 !include "Path.nsh"
+!include "Library.nsh"
 
 XPStyle On
 Name "${MUI_PRODUCT}"
-OutFile "${MUI_NAME}-${MUI_VERSION}.exe"
-InstallDir "C:\Program Files\${MUI_NAME}"
+OutFile "..\${MUI_NAME}-${MUI_VERSION}.exe"
+InstallDir "$PROGRAMFILES\${MUI_NAME}"
 ShowInstDetails hide
 InstProgressFlags smooth
+Var ALREADY_INSTALLED
 
   !define MUI_ABORTWARNING
 
@@ -35,10 +37,9 @@
 		"SOFTWARE\${MUI_COMPANY}\${MUI_PRODUCT}" "" "$INSTDIR"
     SetOverwrite on
     SetOutPath $INSTDIR
-    File /r ..\svk.bat
     File /r ..\bin
     File /r ..\lib
-    File /r ..\site
+    File /r /x checkout ..\site
     File /r ..\win32
 
     Delete "$INSTDIR\svk.bat"
@@ -47,15 +48,22 @@
     FileOpen $1 "$INSTDIR\bin\svk.bat" w
     FileWrite $1 "@echo off$\n"
     FileWrite $1 "if $\"%OS%$\" == $\"Windows_NT$\" goto WinNT$\n"
-    FileWrite $1 "$\"$INSTDIR\bin\perl.exe$\" $\"$INSTDIR\site\bin\svk$\" %1 %2 %3 %4 %5 %6 %7 %8 %9$\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 ":WinNT$\n"
-    FileWrite $1 "$\"%~dp0perl.exe$\" $\"%~dp0..\site\bin\svk$\" %*$\n"
-    FileWrite $1 ":endofsvk\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 1 goto script_failed_so_exit_with_non_zero_val 2>nul$\n"
+    FileWrite $1 ":endofperl$\n"
     FileClose $1
 
     WriteUninstaller "$INSTDIR\Uninstall.exe"
 
+new_installation:
+
+	!insertmacro InstallLib DLL $ALREADY_INSTALLED REBOOT_NOTPROTECTED "shared\msvcr71.dll" "$SYSDIR\msvcr71.dll" $SYSDIR
+
 Libeay32:
     IfFileExists "$SYSDIR\libeay32.dll" RenameLibeay32 SSLeay32
 RenameLibeay32:
@@ -66,6 +74,7 @@
 RenameSSLeay32:
     Rename "$SYSDIR\ssleay32.dll" "$SYSDIR\ssleay32.dll.old"
 
+
 Done:
     ; Add \bin directory to the PATH for svk.bat and DLLs
     Push "$INSTDIR\bin"

Added: branches/i18n-fixes/t/05svm-branches.t
==============================================================================
--- (empty file)
+++ branches/i18n-fixes/t/05svm-branches.t	Sat Jul 14 05:42:53 2007
@@ -0,0 +1,54 @@
+#!/usr/bin/perl -w
+use strict;
+use Test::More;
+use SVK::Test;
+plan tests => 4;
+
+our ($output, $answer);
+
+# build another tree to be mirrored ourself
+my ($xd, $svk) = build_test('remote');
+
+diag "create branches 1.0, 2.0 (copy of 1.0) on remote" if $ENV{'TEST_VERBOSE'};
+{
+    $svk->mkdir ('-m', '1.0', '/remote/1.0');
+    $svk->copy ('-m', '2.0', '/remote/1.0' => '/remote/2.0');
+    is_output ($svk, 'info', ['/remote/2.0'],
+        ['Depot Path: /remote/2.0',
+        'Revision: 2',
+        'Last Changed Rev.: 2',
+        qr'Last Changed Date: .*',
+        'Copied From: /1.0, Rev. 1',
+        'Merged From: /1.0, Rev. 1',
+        '',]
+    ) or diag $output;
+}
+
+diag "create mirror of 1.0 in //" if $ENV{'TEST_VERBOSE'};
+{
+    my ($srepospath, $spath, $srepos) = $xd->find_repos ('/remote/1.0', 1);
+    my $uri = uri($srepospath);
+    is_output ($svk, 'mirror', ['//1.0', $uri.($spath eq '/' ? '' : $spath)],
+           ['Mirror initialized.  Run svk sync //1.0 to start mirroring.']);
+}
+
+diag "create mirror of 2.0 in //" if $ENV{'TEST_VERBOSE'};
+{
+    my ($srepospath, $spath, $srepos) = $xd->find_repos ('/remote/2.0', 2);
+    my $uri = uri($srepospath);
+    is_output ($svk, 'mirror', ['//2.0', $uri.($spath eq '/' ? '' : $spath)],
+           ['Mirror initialized.  Run svk sync //2.0 to start mirroring.']);
+}
+$svk->sync ('-a', '//');
+
+is_output ($svk, 'info', ['//2.0'],
+    ['Depot Path: //2.0',
+    'Revision: 4',
+    'Last Changed Rev.: 4',
+    qr'Last Changed Date: .*',
+    qr'Mirrored From: .*',
+    'Copied From: /1.0, Rev. 3',
+    'Merged From: /1.0, Rev. 3',
+    '',]
+) or diag $output;
+

Added: branches/i18n-fixes/t/api/root.t
==============================================================================
--- (empty file)
+++ branches/i18n-fixes/t/api/root.t	Sat Jul 14 05:42:53 2007
@@ -0,0 +1,334 @@
+#!/usr/bin/perl -w
+use strict;
+use SVK::Test;
+plan tests => 39;
+our $output;
+
+
+use Scalar::Util qw(reftype blessed);
+use Digest::MD5 qw(md5_hex);
+use Class::ISA;    # diags only
+use Data::Dumper;  # diags only
+
+
+# setup the test
+my ($xd, $svk) = build_test();
+$svk->mkdir('-m' => 'trunk', '//trunk');
+my $tree = create_basic_tree ($xd, '//trunk');
+my ($copath, $corpath) = get_copath ('root');
+$svk->checkout ('//', $copath);
+
+
+# get a handle on it
+my $depot = $xd->find_depot('');
+my $repos = $depot->repos;
+my $path = SVK::Path->real_new({ depot => $depot,
+				 path => "/trunk",
+				 revision => $repos->fs->youngest_rev });
+
+# fetch the bit we want to test
+my $root = $path->root;
+
+
+# revision basics - committed revisions
+ok($root->is_revision_root, "we're a revision root");
+ok(!$root->is_txn_root, "we're not a transaction root");
+my $youngest_rev = $root->revision_root_revision;
+ok($youngest_rev, "we have a revision ($youngest_rev)");
+
+
+# revision basics - file/dir lookup
+ok($root->check_path("/trunk"), "/trunk checks out OK");
+ok($root->is_dir("/trunk"), "//trunk is a directory");
+ok(!$root->is_file("/trunk"), "/trunk is not a file");
+ok($root->check_path("/trunk/me"), "/trunk/me exists");
+ok(!$root->is_dir("/trunk/me"), "//trunk is not a directory");
+ok($root->is_file("/trunk/me"), "/trunk is a file");
+
+
+ok(!$root->check_path("/trunk/junk"), "/trunk/junk doesn't exist");
+
+
+# reading directories
+my $dir_entries = $root->dir_entries("/trunk");
+is(reftype $dir_entries, "HASH", "dir_entries is a hash");
+is(keys %$dir_entries, 5, "5 files in /trunk");
+my $me = $dir_entries->{me};
+is($me->name, "me", "meesa me");
+is($me->kind, $SVN::Node::file, "meesa file");
+my $A = $dir_entries->{A};
+is($A->name, "A", "found A, correct name");
+is($A->kind, $SVN::Node::dir, "A is a directory");
+
+
+# reading files
+my $expected = "first line in me$/2nd line in me - mod$/";
+is($root->file_length("/trunk/me"), length($expected),
+   "meesa right length");
+is($root->file_md5_checksum("/trunk/me"),
+   md5_hex($expected), "->file_md5_checksum");
+
+
+
+# IO::Handle interface
+my $contents = $root->file_contents("/trunk/me");
+isa_ok($contents, "IO::Handle", "contents are IO::Handle objects");
+
+{
+local $/;
+my $buffer = <$contents>;
+is($buffer, $expected, "can get files out OK");
+
+}
+#show_tree($root, "/");
+
+
+# file and directory properties
+is_deeply($root->node_proplist("/trunk/me"), {}, "meesa no properties");
+is_deeply($root->node_proplist("/trunk/A/be"),
+  { 'svn:keywords' => 'Rev URL Revision FileRev' },
+  "A/be (file) has props");
+is($root->node_prop("/trunk/A/be", 'svn:keywords'),
+   "Rev URL Revision FileRev",
+   "we can fetch a prop");
+my $pl = $root->node_proplist("/trunk/A/Q");
+is_deeply($pl, { 'foo' => 'prop on A/Q' }, "A/Q (dir) has props");
+
+
+# history-related commands; check behaviour of node_created_rev
+is($root->node_created_rev("/trunk/B/S"), $youngest_rev,
+   "node_created_rev(changed node)");
+is($root->node_created_rev("/trunk/B"), $youngest_rev,
+   "node_created_rev(parent of changed node)");
+is($root->node_created_rev("/"), $youngest_rev,
+   "node_created_rev(root node)");
+
+
+# this node was not changed in this revision; it was made by the
+# previous one.
+my $trunk_C_R_rev = $root->node_created_rev("/trunk/C/R");
+isnt($trunk_C_R_rev, $youngest_rev, "node_created_rev(unchanged node)");
+
+
+# we don't check that the revision ids are integers, but we should
+# still be able to compare them if one is a predecessor or successor
+# of the other.
+cmp_ok($trunk_C_R_rev, "<", $youngest_rev, "revisions have order");
+
+
+# hmm will locale ruin our day with this sort()?
+is_deeply([ sort keys %{ $root->paths_changed } ],
+  [qw[ /trunk/A/P /trunk/B/S /trunk/B/fe
+      /trunk/D /trunk/D/de /trunk/me ]],
+  "paths_changed");
+
+
+# svn's history->prev returns useless intermediate locations, so
+# suppress duplicates in this test so we don't have to emulate this
+# model-specific behaviour
+my $history = $root->node_history("/trunk/B/S");
+my @history;
+do {
+    my @location = $history->location;
+    if ( !@history or
+scalar(grep { $history[$#history][$_] ne $location[$_] }
+(0,1)) ) {
+push @history, \@location;
+    }
+} while ( $history = $history->prev(1) );
+
+
+is_deeply(\@history,
+  [ [ '/trunk/B/S', $youngest_rev, ],
+    [ '/trunk/A',   $trunk_C_R_rev ],
+  ],
+  "we can fetch node history");
+
+
+# for git we will probably need to store and parse special
+# copied-from: fields in the commit message.
+my @copied_from = $root->copied_from("/trunk/B/S");
+is_deeply(\@copied_from,
+  # odd, in the other order to the above...
+  [ $trunk_C_R_rev, '/trunk/A' ],
+  "->copied_from");
+
+
+# revision properties.
+my $rp = $root->fs->revision_proplist($youngest_rev);
+is($rp->{'svn:log'}, "test init tree", "revprop - log");
+is($rp->{'svn:author'}, "svk", "revprop - author");
+like($rp->{"svn:date"}, qr/\d+-\d+-\d+T\d+:\d+:\d+\.\d+Z/,
+     'revprop - date (in UTC)');
+
+
+# changing revision properties ... do we need to?  I hope not...
+
+
+# editing commands.
+
+
+# first we make a memory allocation pool.  other back-ends can
+# probably ignore this, or it can be factored into a common interface
+# later.
+my $pool = SVN::Pool->new;
+
+
+# info_on($root->fs, "root->fs");
+
+
+# first, get a 'transaction'
+my $txn = $root->txn_root;
+
+ok(!$txn->is_revision_root, "->txn_root is not a revision root");
+ok($txn->is_txn_root, "->txn_root is a transaction root");
+
+
+# show_tree($txn, "/");
+
+
+$txn->delete("/trunk/A/Q");
+ok(!$txn->check_path("/trunk/A/Q"),
+   "deletes to open txn are effective");
+
+
+#info_on($repos, "repository");
+# info_on($txn->fs, "fs");
+#info_on($_txn, "txn");
+#system("find /tmp/svk* | sed 's/^/# /'");
+$repos->fs_commit_txn($txn->txn); $txn->txn(undef);
+#$txn->close_root;
+#$_txn->commit;
+#$txn->commit;
+#$txn->txn_commit;
+
+
+isnt($repos->fs->youngest_rev, $youngest_rev, "made a new revision");
+# nope, this doesn't happen...
+# ok($txn->is_revision_root, "TXN object got assigned a revision number");
+
+
+# is there a shortcut to this?
+#$root = SVK::Path->real_new({ depot => $depot,
+#      path => "/trunk",
+#      revision => $repos->fs->youngest_rev
+#    })->root;
+
+
+# the following SVK::Root methods (via ::_p_svn_fs_root_t) still need
+# testing.
+
+
+#   copy( from_root, from_path, to_root, to_path )
+#   revision_link (from, to)
+#   make_dir
+#   make_file
+#   change_node_prop
+
+
+# what do these use?  SVN::Editor-style events or a
+# Parse::SVNDiff-type stream?  or something else?
+#   apply_textdelta
+#   apply_text
+
+
+# we didn't test this history function above, because there were no
+# objects which had a copy then a change.
+
+
+#  closest_copy
+
+
+# ignored (in %_p_svn_fs_root_t::):
+#   close_root
+#   methods
+
+
+# other objects we might need to emulate;
+#  FS (_p_svn_fs_t):
+
+
+#   begin_txn           - might be only one per-checkout
+#   open_txn
+#   list_transactions
+
+
+#   revision_root       - should be easy enough...
+#   youngest_rev
+
+
+#   revision_proplist   - probably shove these in the commit message
+#   revision_prop
+#   change_rev_prop     - do we desperately need this?
+
+
+#   get_uuid            - not needed for content-hashed repos...
+#   set_uuid
+
+
+#   get_lock            - not sure what to test here...
+#   get_locks
+#   generate_lock_token
+#   lock
+#   unlock
+
+
+#   get_access          - only for remote repos...
+#   set_access
+
+
+
+
+sub show_tree {
+    my $root = shift;
+    my $start = shift;
+
+
+    my @seen = ($start);
+
+
+    while ( my $path = pop @seen ) {
+my $pl = $root->node_proplist($path);
+my $crev = $root->node_created_rev($path);
+my $p = " ";
+if ( keys %$pl ) {
+    $p = "+";
+}
+if ( $root->is_dir( $path ) ) {
+    diag "$crev d $p $path";
+    push @seen, map { $path eq "/" ? "/$_" : "$path/$_" }
+reverse sort keys %{ $root->dir_entries($path) };
+}
+else {
+    diag "$crev f $p $path";
+}
+    }
+}
+
+
+sub show_isa {
+    my $class = ref $_[0] || $_[0];
+
+
+    diag "$class ISA : ".join(" ", Class::ISA::super_path($class));
+}
+
+
+sub info_on {
+    no strict;
+
+
+    my $what = shift;
+    my $name = shift || "thingy";
+    if ( ref($what) ) {
+diag("$name is: ".Dumper($what));
+if ( blessed($what) ) {
+    diag "methods in ".ref($what).":";
+    diag "  $_" for sort keys(%{ref($what)."::"});
+    show_isa($what);
+}
+    }
+    else {
+diag("$name is: ".Dumper($what));
+    }
+}


More information about the svk-commit mailing list