r70878 - in /trunk/libsvn-dump-perl: ./ debian/ debian/source/ eg/ lib/SVN/ lib/SVN/Dump/ t/ t/dump/fail/ t/dump/full/ t/dump/gzip/
jawnsy-guest at users.alioth.debian.org
jawnsy-guest at users.alioth.debian.org
Tue Mar 8 12:18:59 UTC 2011
Author: jawnsy-guest
Date: Tue Mar 8 12:18:38 2011
New Revision: 70878
URL: http://svn.debian.org/wsvn/pkg-perl/?sc=1&rev=70878
Log:
* New upstream release
* Rewrite control description
* Add myself to Uploaders and Copyright
* Bump to debhelper compat 8
* Use new 3.0 (quilt) source format
* Standards-Version 3.9.1 (no changes)
* Refresh copyright information
* Use short debhelper rules format
Added:
trunk/libsvn-dump-perl/debian/source/
trunk/libsvn-dump-perl/debian/source/format
trunk/libsvn-dump-perl/t/26dump_gz.t
- copied unchanged from r70854, branches/upstream/libsvn-dump-perl/current/t/26dump_gz.t
trunk/libsvn-dump-perl/t/27transform.t
- copied unchanged from r70854, branches/upstream/libsvn-dump-perl/current/t/27transform.t
trunk/libsvn-dump-perl/t/README.txt
- copied unchanged from r70854, branches/upstream/libsvn-dump-perl/current/t/README.txt
trunk/libsvn-dump-perl/t/dump/fail/r_badsize.svn
- copied unchanged from r70854, branches/upstream/libsvn-dump-perl/current/t/dump/fail/r_badsize.svn
trunk/libsvn-dump-perl/t/dump/full/test123-r0-r10-v16.svn
- copied unchanged from r70854, branches/upstream/libsvn-dump-perl/current/t/dump/full/test123-r0-r10-v16.svn
trunk/libsvn-dump-perl/t/dump/full/test456-replace.svn
- copied unchanged from r70854, branches/upstream/libsvn-dump-perl/current/t/dump/full/test456-replace.svn
trunk/libsvn-dump-perl/t/dump/gzip/
- copied from r70854, branches/upstream/libsvn-dump-perl/current/t/dump/gzip/
Removed:
trunk/libsvn-dump-perl/t/dump/fail/h_blank.svn
trunk/libsvn-dump-perl/t/dump/fail/h_empty.svn
Modified:
trunk/libsvn-dump-perl/Build.PL
trunk/libsvn-dump-perl/Changes
trunk/libsvn-dump-perl/MANIFEST
trunk/libsvn-dump-perl/META.yml
trunk/libsvn-dump-perl/Makefile.PL
trunk/libsvn-dump-perl/README
trunk/libsvn-dump-perl/debian/changelog
trunk/libsvn-dump-perl/debian/compat
trunk/libsvn-dump-perl/debian/control
trunk/libsvn-dump-perl/debian/copyright
trunk/libsvn-dump-perl/debian/rules
trunk/libsvn-dump-perl/eg/svndump_stats.pl
trunk/libsvn-dump-perl/lib/SVN/Dump.pm
trunk/libsvn-dump-perl/lib/SVN/Dump/Headers.pm
trunk/libsvn-dump-perl/lib/SVN/Dump/Reader.pm
trunk/libsvn-dump-perl/lib/SVN/Dump/Record.pm
trunk/libsvn-dump-perl/lib/SVN/Dump/Text.pm
trunk/libsvn-dump-perl/t/13record.t
trunk/libsvn-dump-perl/t/23record.t
trunk/libsvn-dump-perl/t/25dump.t
trunk/libsvn-dump-perl/t/29fail.t
trunk/libsvn-dump-perl/t/dump/fail/r_badsum.svn
Modified: trunk/libsvn-dump-perl/Build.PL
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libsvn-dump-perl/Build.PL?rev=70878&op=diff
==============================================================================
--- trunk/libsvn-dump-perl/Build.PL (original)
+++ trunk/libsvn-dump-perl/Build.PL Tue Mar 8 12:18:38 2011
@@ -11,6 +11,12 @@
'Test::More' => 0,
},
add_to_cleanup => [ 'SVN-Dump-*' ],
+ meta_merge => {
+ resources => {
+ repository => 'http://github.com/book/SVN-Dump',
+ },
+ },
+ license => 'perl',
);
$builder->create_build_script();
Modified: trunk/libsvn-dump-perl/Changes
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libsvn-dump-perl/Changes?rev=70878&op=diff
==============================================================================
--- trunk/libsvn-dump-perl/Changes (original)
+++ trunk/libsvn-dump-perl/Changes Tue Mar 8 12:18:38 2011
@@ -1,4 +1,17 @@
Revision history for SVN-Dump
+
+0.05 Sat Feb 19 03:51:57 CET 2011
+ [ENHANCEMENTS]
+ - Add support for Text-content-sha1 node property
+ - Don't create text or property blocks if they don't exist in
+ a dump. (Rocco Caputo)
+ - Add a digest() method to SVN::Dump::Text
+ (Inspired by a patch by Scott MacPhee, RT #56868)
+ - Add support for Text-content-sha1 / Text-copy-source-sha1
+ (RT #60207)
+ - New option check_digest that will, when reading a non-delta
+ dump, ensure that the content digest are valid
+ - Properly ignore blank lines between records (RT #25467, #28645)
0.04 Thu Jun 12 16:48:23 CEST 2008
[ENHANCEMENTS]
Modified: trunk/libsvn-dump-perl/MANIFEST
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libsvn-dump-perl/MANIFEST?rev=70878&op=diff
==============================================================================
--- trunk/libsvn-dump-perl/MANIFEST (original)
+++ trunk/libsvn-dump-perl/MANIFEST Tue Mar 8 12:18:38 2011
@@ -25,17 +25,19 @@
t/23record.t
t/24reader.t
t/25dump.t
+t/26dump_gz.t
+t/27transform.t
t/29fail.t
-t/dump/fail/h_blank.svn
-t/dump/fail/h_empty.svn
t/dump/fail/h_noblank.svn
t/dump/fail/p_empty.svn
t/dump/fail/p_eof.svn
t/dump/fail/p_eofval.svn
t/dump/fail/p_noend.svn
t/dump/fail/p_noval.svn
+t/dump/fail/r_badsize.svn
t/dump/fail/r_badsum.svn
t/dump/fail/t_eof.svn
+t/dump/full/test123-r0-r10-v16.svn
t/dump/full/test123-r0-r10.svn
t/dump/full/test123-r0-r3.svn
t/dump/full/test123-r0-r4.svn
@@ -43,6 +45,8 @@
t/dump/full/test123-r0.svn
t/dump/full/test123-r11-r14-v3.svn
t/dump/full/test123-v3.svn
+t/dump/full/test456-replace.svn
+t/dump/gzip/test123-r0-r4.svn.gz
t/dump/headers/dir-node.svn
t/dump/headers/file-node.svn
t/dump/headers/format-record.svn
@@ -62,4 +66,5 @@
t/dump/records/uuid-record.svn
t/pod-coverage.t
t/pod.t
+t/README.txt
t/Utils.pm
Modified: trunk/libsvn-dump-perl/META.yml
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libsvn-dump-perl/META.yml?rev=70878&op=diff
==============================================================================
--- trunk/libsvn-dump-perl/META.yml (original)
+++ trunk/libsvn-dump-perl/META.yml Tue Mar 8 12:18:38 2011
@@ -1,18 +1,19 @@
---
+abstract: 'A Perl interface to Subversion dumps'
+author:
+ - "Philippe \"BooK\" Bruhat <book at cpan.org>"
+configure_requires:
+ Module::Build: 0.36
+generated_by: 'Module::Build version 0.3607'
+license: perl
+meta-spec:
+ url: http://module-build.sourceforge.net/META-spec-v1.4.html
+ version: 1.4
name: SVN-Dump
-version: 0.04
-author:
- - 'Philippe "BooK" Bruhat <book at cpan.org>'
-abstract: A Perl interface to Subversion dumps
-license: perl
-resources:
- license: http://dev.perl.org/licenses/
-requires:
- Test::More: 0
provides:
SVN::Dump:
file: lib/SVN/Dump.pm
- version: 0.04
+ version: 0.05
SVN::Dump::Headers:
file: lib/SVN/Dump/Headers.pm
SVN::Dump::Property:
@@ -23,7 +24,9 @@
file: lib/SVN/Dump/Record.pm
SVN::Dump::Text:
file: lib/SVN/Dump/Text.pm
-generated_by: Module::Build version 0.2808
-meta-spec:
- url: http://module-build.sourceforge.net/META-spec-v1.2.html
- version: 1.2
+requires:
+ Test::More: 0
+resources:
+ license: http://dev.perl.org/licenses/
+ repository: http://github.com/book/SVN-Dump
+version: 0.05
Modified: trunk/libsvn-dump-perl/Makefile.PL
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libsvn-dump-perl/Makefile.PL?rev=70878&op=diff
==============================================================================
--- trunk/libsvn-dump-perl/Makefile.PL (original)
+++ trunk/libsvn-dump-perl/Makefile.PL Tue Mar 8 12:18:38 2011
@@ -9,4 +9,10 @@
PL_FILES => {},
ABSTRACT_FROM => 'lib/SVN/Dump.pm',
AUTHOR => 'Philippe "BooK" Bruhat <book at cpan.org>',
+ META_MERGE => {
+ resources => {
+ repository => 'http://github.com/book/SVN-Dump',
+ },
+ },
+ LICENSE => 'perl',
);
Modified: trunk/libsvn-dump-perl/README
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libsvn-dump-perl/README?rev=70878&op=diff
==============================================================================
--- trunk/libsvn-dump-perl/README (original)
+++ trunk/libsvn-dump-perl/README Tue Mar 8 12:18:38 2011
@@ -4,7 +4,7 @@
This module lets you manage SVN dumps with Perl.
The reference document for Subversion dumpfiles is at:
-http://svn.collab.net/viewvc/svn/trunk/notes/fs_dumprestore.txt?revision=HEAD
+http://svn.apache.org/repos/asf/subversion/trunk/notes/dump-load-format.txt
PLEASE NOTE THAT THIS CODE IS OF IN ALPHA QUALITY. I DO NOT MASTER YET
ALL THE CONCEPTS BEHIND THE SUBVERSION FILESYSTEM, BUT WILL EVENTUALLY LEARN.
Modified: trunk/libsvn-dump-perl/debian/changelog
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libsvn-dump-perl/debian/changelog?rev=70878&op=diff
==============================================================================
--- trunk/libsvn-dump-perl/debian/changelog (original)
+++ trunk/libsvn-dump-perl/debian/changelog Tue Mar 8 12:18:38 2011
@@ -1,4 +1,4 @@
-libsvn-dump-perl (0.04-2) UNRELEASED; urgency=low
+libsvn-dump-perl (0.05-1) UNRELEASED; urgency=low
[ gregor herrmann ]
* debian/control: Changed: Switched Vcs-Browser field to ViewSVN
@@ -7,7 +7,17 @@
[ Nathan Handler ]
* debian/watch: Update to ignore development releases.
- -- gregor herrmann <gregoa at debian.org> Sun, 16 Nov 2008 20:47:18 +0100
+ [ Jonathan Yu ]
+ * New upstream release
+ * Rewrite control description
+ * Add myself to Uploaders and Copyright
+ * Bump to debhelper compat 8
+ * Use new 3.0 (quilt) source format
+ * Standards-Version 3.9.1 (no changes)
+ * Refresh copyright information
+ * Use short debhelper rules format
+
+ -- Jonathan Yu <jawnsy at cpan.org> Tue, 08 Mar 2011 07:43:16 -0500
libsvn-dump-perl (0.04-1) unstable; urgency=low
Modified: trunk/libsvn-dump-perl/debian/compat
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libsvn-dump-perl/debian/compat?rev=70878&op=diff
==============================================================================
--- trunk/libsvn-dump-perl/debian/compat (original)
+++ trunk/libsvn-dump-perl/debian/compat Tue Mar 8 12:18:38 2011
@@ -1,1 +1,1 @@
-5
+8
Modified: trunk/libsvn-dump-perl/debian/control
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libsvn-dump-perl/debian/control?rev=70878&op=diff
==============================================================================
--- trunk/libsvn-dump-perl/debian/control (original)
+++ trunk/libsvn-dump-perl/debian/control Tue Mar 8 12:18:38 2011
@@ -1,11 +1,14 @@
Source: libsvn-dump-perl
Section: perl
Priority: optional
-Build-Depends: debhelper (>= 5), libmodule-build-perl
-Build-Depends-Indep: perl (>= 5.6.10-12), libtest-pod-perl, libtest-pod-coverage-perl
+Build-Depends: debhelper (>= 8)
+Build-Depends-Indep: perl,
+ libtest-pod-perl,
+ libtest-pod-coverage-perl
Maintainer: Debian Perl Group <pkg-perl-maintainers at lists.alioth.debian.org>
-Uploaders: Edi Stojicevic <estojicevic at debianworld.org>
-Standards-Version: 3.8.0
+Uploaders: Edi Stojicevic <estojicevic at debianworld.org>,
+ Jonathan Yu <jawnsy at cpan.org>
+Standards-Version: 3.9.1
Vcs-Svn: svn://svn.debian.org/pkg-perl/trunk/libsvn-dump-perl/
Vcs-Browser: http://svn.debian.org/viewsvn/pkg-perl/trunk/libsvn-dump-perl/
Homepage: http://search.cpan.org/dist/SVN-Dump/
@@ -13,20 +16,7 @@
Package: libsvn-dump-perl
Architecture: all
Depends: ${perl:Depends}, ${misc:Depends}
-Description: A Perl interface to Subversion dumps
- An SVN::Dump object represents a Subversion dump.
- .
- This module follow the semantics used in the reference document
- (the file notes/fs_dumprestore.txt in the Subversion source tree):
- .
- A dump is a collection of records (SVN::Dump::Record objects).
- .
- A record is composed of a set of headers (a SVN::Dump::Headers object),
- a set of properties (a SVN::Dump::Property object) and an optional
- bloc of text (a SVN::Dump::Text object).
- .
- Some special records (delete records with a Node-kind header)
- recursively contain included records.
- .
- This module is an alpha release. The interfaces will probably change
- in the future.
+Description: module for parsing Subversion dumps
+ SVN::Dump is a collection of Perl modules for loading a Subversion dump file
+ and representing its contents as a collection of node objects. It creates a
+ tree of records, headers, text blocks and other nodes.
Modified: trunk/libsvn-dump-perl/debian/copyright
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libsvn-dump-perl/debian/copyright?rev=70878&op=diff
==============================================================================
--- trunk/libsvn-dump-perl/debian/copyright (original)
+++ trunk/libsvn-dump-perl/debian/copyright Tue Mar 8 12:18:38 2011
@@ -1,20 +1,29 @@
-This is the debian package for the SVN-Dump module.
+Format-Specification: http://svn.debian.org/wsvn/dep/web/deps/dep5.mdwn?op=file&rev=135
+Maintainer: Philippe Bruhat <book at cpan.org>
+Source: http://search.cpan.org/dist/SVN-Dump/
+Name: SVN-Dump
-The upstream author is: Philippe Bruhat (Book) <book at cpan.org>.
+Files: *
+Copyright: 2006-2011, Philippe Bruhat <book at cpan.org>
+License: Artistic or GPL-1+
-Upstream source location: http://search.cpan.org/dist/SVN-Dump
+Files: debian/*
+Copyright: 2008, Edi Stojicevic <estojicevic at debianworld.org>
+ 2011, Jonathan Yu <jawnsy at cpan.org>
+License: Artistic or GPL-1+
-License and copyright:
+License: Artistic
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the Artistic License, which comes with Perl.
+ .
+ On Debian systems, the complete text of the Artistic License can be
+ found in `/usr/share/common-licenses/Artistic'.
-Copyright 2006 Philippe Bruhat (BooK), All Rights Reserved.
-
-This module is free software; you can redistribute it and/or
-modify it under the same terms as Perl itself.
-
-Perl is distributed under your choice of the GNU General Public License or
-the Artistic License. On Debian GNU/Linux systems, the complete text of the
-GNU General Public License can be found in `/usr/share/common-licenses/GPL'
-and the Artistic Licence in `/usr/share/common-licenses/Artistic'.
-
-The Debian packaging is (C) 2008, Edi Stojicevic <estojicevic at debianworld.org>
-and is licensed under the same terms as the software itself (see above).
+License: GPL-1+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 1, or (at your option)
+ any later version.
+ .
+ On Debian systems, the complete text of version 1 of the GNU General
+ Public License can be found in `/usr/share/common-licenses/GPL-1'.
Modified: trunk/libsvn-dump-perl/debian/rules
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libsvn-dump-perl/debian/rules?rev=70878&op=diff
==============================================================================
--- trunk/libsvn-dump-perl/debian/rules (original)
+++ trunk/libsvn-dump-perl/debian/rules Tue Mar 8 12:18:38 2011
@@ -1,64 +1,4 @@
#!/usr/bin/make -f
-# This debian/rules file is provided as a template for normal perl
-# packages. It was created by Marc Brockschmidt <marc at dch-faq.de> for
-# the Debian Perl Group (http://pkg-perl.alioth.debian.org/) but may
-# be used freely wherever it is useful.
-#
-# It was later modified by Jason Kohles <email at jasonkohles.com>
-# http://www.jasonkohles.com/ to support Module::Build installed modules
-# Uncomment this to turn on verbose mode.
-#export DH_VERBOSE=1
-
-# If set to a true value then MakeMaker's prompt function will
-# always return the default without waiting for user input.
-export PERL_MM_USE_DEFAULT=1
-
-PERL ?= /usr/bin/perl
-PACKAGE = $(shell dh_listpackages)
-TMP = $(CURDIR)/debian/$(PACKAGE)
-
-build: build-stamp
-build-stamp:
- dh_testdir
- # Add commands to compile the package here
- $(PERL) Build.PL installdirs=vendor
- $(PERL) Build
- $(PERL) Build test
- touch $@
-
-clean:
- dh_testdir
- dh_testroot
- dh_clean build-stamp install-stamp
- # Add commands to clean up after the build process here
- [ ! -f Build ] || $(PERL) Build --allow_mb_mismatch 1 distclean
-
-install: install-stamp
-install-stamp: build-stamp
- dh_testdir
- dh_testroot
- dh_clean -k
- # Add commands to install the package into $(TMP) here
- $(PERL) Build install destdir=$(TMP) create_packlist=0
- touch $@
-
-binary-arch:
-# We have nothing to do here for an architecture-independent package
-
-binary-indep: build install
- dh_testdir
- dh_testroot
- dh_installdocs README
- dh_installexamples eg/*
- dh_installchangelogs Changes
- dh_perl
- dh_compress
- dh_fixperms
- dh_installdeb
- dh_gencontrol
- dh_md5sums
- dh_builddeb
-
-binary: binary-indep binary-arch
-.PHONY: build clean binary-indep binary-arch binary install
+%:
+ dh $@
Added: trunk/libsvn-dump-perl/debian/source/format
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libsvn-dump-perl/debian/source/format?rev=70878&op=file
==============================================================================
--- trunk/libsvn-dump-perl/debian/source/format (added)
+++ trunk/libsvn-dump-perl/debian/source/format Tue Mar 8 12:18:38 2011
@@ -1,0 +1,1 @@
+3.0 (quilt)
Modified: trunk/libsvn-dump-perl/eg/svndump_stats.pl
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libsvn-dump-perl/eg/svndump_stats.pl?rev=70878&op=diff
==============================================================================
--- trunk/libsvn-dump-perl/eg/svndump_stats.pl (original)
+++ trunk/libsvn-dump-perl/eg/svndump_stats.pl Tue Mar 8 12:18:38 2011
@@ -11,7 +11,7 @@
my %kind;
while ( my $record = $dump->next_record() ) {
$type{ $record->type() }++;
- $kind{ $record->get_headers()->{'Node-action'} }++
+ $kind{ $record->get_header('Node-action') }++
if $record->type() eq 'node';
}
Modified: trunk/libsvn-dump-perl/lib/SVN/Dump.pm
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libsvn-dump-perl/lib/SVN/Dump.pm?rev=70878&op=diff
==============================================================================
--- trunk/libsvn-dump-perl/lib/SVN/Dump.pm (original)
+++ trunk/libsvn-dump-perl/lib/SVN/Dump.pm Tue Mar 8 12:18:38 2011
@@ -6,7 +6,7 @@
use SVN::Dump::Reader;
-our $VERSION = '0.04';
+our $VERSION = '0.05';
sub new {
my ( $class, $args ) = @_;
@@ -16,11 +16,11 @@
# we have a reader
if ( exists $args->{fh} || exists $args->{file} ) {
- my $fh = $args->{fh};
+ my ( $fh, $file ) = delete @{$args}{qw( fh file )};
if ( !$fh ) {
- open $fh, $args->{file} or croak "Can't open $args->{file}: $!";
- }
- $self->{reader} = SVN::Dump::Reader->new($fh);
+ open $fh, $file or croak "Can't open $file: $!";
+ }
+ $self->{reader} = SVN::Dump::Reader->new( $fh, $args );
}
# we don't have a reader
else {
@@ -96,7 +96,7 @@
my %kind;
while ( my $record = $dump->next_record() ) {
$type{ $record->type() }++;
- $kind{ $record->get_headers()->{'Node-action'} }++
+ $kind{ $record->get_header('Node-action') }++
if $record->type() eq 'node';
}
@@ -171,6 +171,9 @@
the arguments C<file> is used (as usal, C<-> means C<STDIN>);
if the dump is read from a filehandle, C<fh> is used.
+Extra options will be passed to the C<SVN::Dump::Reader> object
+that is created.
+
If the C<SVN::Dump> isn't used to read information, the parameters
C<version> and C<uuid> can be used to initialise the values
of the C<SVN-fs-dump-format-version> and C<UUID> headers.
@@ -203,9 +206,14 @@
C<SVN::Dump::Reader>, C<SVN::Dump::Record>.
-=head1 COPYRIGHT & LICENSE
-
-Copyright 2006 Philippe 'BooK' Bruhat, All Rights Reserved.
+The reference document for Subversion dumpfiles is at:
+L<http://svn.apache.org/repos/asf/subversion/trunk/notes/dump-load-format.txt>
+
+=head1 COPYRIGHT
+
+Copyright 2006-2011 Philippe Bruhat (BooK), All Rights Reserved.
+
+=head1 LICENSE
This program is free software; you can redistribute it and/or modify it
under the same terms as Perl itself.
Modified: trunk/libsvn-dump-perl/lib/SVN/Dump/Headers.pm
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libsvn-dump-perl/lib/SVN/Dump/Headers.pm?rev=70878&op=diff
==============================================================================
--- trunk/libsvn-dump-perl/lib/SVN/Dump/Headers.pm (original)
+++ trunk/libsvn-dump-perl/lib/SVN/Dump/Headers.pm Tue Mar 8 12:18:38 2011
@@ -36,9 +36,11 @@
Prop-delta
Prop-content-length
Text-copy-source-md5
+ Text-copy-source-sha1
Text-delta
Text-content-length
Text-content-md5
+ Text-content-sha1
Content-length
)
],
@@ -102,9 +104,12 @@
=head1 SYNOPSIS
+ # SVN::Dump::Headers objects are returned by the read_header_block()
+ # method of SVN::Dump::Reader
+
=head1 DESCRIPTION
-An C<SVN::Dump::Headers> object represents the headers of a
+A C<SVN::Dump::Headers> object represents the headers of a
SVN dump record.
=head1 METHODS
@@ -161,9 +166,11 @@
C<SVN::Dump::Record>.
-=head1 COPYRIGHT & LICENSE
+=head1 COPYRIGHT
-Copyright 2006 Philippe 'BooK' Bruhat, All Rights Reserved.
+Copyright 2006-2011 Philippe 'BooK' Bruhat, All Rights Reserved.
+
+=head1 LICENSE
This program is free software; you can redistribute it and/or modify it
under the same terms as Perl itself.
Modified: trunk/libsvn-dump-perl/lib/SVN/Dump/Reader.pm
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libsvn-dump-perl/lib/SVN/Dump/Reader.pm?rev=70878&op=diff
==============================================================================
--- trunk/libsvn-dump-perl/lib/SVN/Dump/Reader.pm (original)
+++ trunk/libsvn-dump-perl/lib/SVN/Dump/Reader.pm Tue Mar 8 12:18:38 2011
@@ -16,34 +16,58 @@
# some useful definitions
my $NL = "\012";
+# prepare the digest checkers
+my @digest = grep {
+ eval { require Digest; Digest->new(uc) }
+} qw( md5 sha1 );
+
# the object is a filehandle
sub new {
- my ($class, $fh) = @_;
+ my ($class, $fh, $args) = @_;
croak 'SVN::Dump::Reader parameter is not a filehandle'
if !( $fh && ref $fh && ref($fh) eq 'GLOB' );
+ %{*$fh} = %{ $args || {} };
return bless $fh, $class;
}
sub read_record {
my ($fh) = @_;
- # no more records?
- return if eof($fh);
-
my $record = SVN::Dump::Record->new();
# first get the headers
- my $headers = $fh->read_header_block();
+ my $headers = $fh->read_header_block() or return;
$record->set_headers_block( $headers );
# get the property block
$record->set_property_block( $fh->read_property_block() )
- if exists $headers->{'Prop-content-length'};
+ if (
+ exists $headers->{'Prop-content-length'} and
+ $headers->{'Prop-content-length'}
+ );
# get the text block
- $record->set_text_block(
- $fh->read_text_block( $headers->{'Text-content-length'} ) )
- if exists $headers->{'Text-content-length'};
+ if ( exists $headers->{'Text-content-length'}
+ and $headers->{'Text-content-length'} )
+ {
+ my $text = $fh->read_text_block( $headers->{'Text-content-length'} );
+
+ # verify checksums (but not in delta dumps)
+ if (${*$fh}{check_digest}
+ && ( !$headers->{'Text-delta'}
+ || $headers->{'Text-delta'} ne 'true' )
+ )
+ {
+ for my $algo ( grep { $headers->{"Text-content-$_"} } @digest ) {
+ my $digest = $text->digest($algo);
+ croak
+ qq{$algo checksum mismatch: got $digest, expected $headers->{"Text-content-$algo"}}
+ if $headers->{"Text-content-$algo"} ne $digest;
+ }
+ }
+
+ $record->set_text_block($text);
+ }
# some safety checks
croak "Inconsistent record size"
@@ -59,15 +83,7 @@
{
my $included = $fh->read_record();
$record->set_included_record( $included );
- <$fh>; # chop the empty line that follows
- }
-
- # chop empty line after the record
- my $type = $headers->type();
- <$fh> if $type !~ /\A(?:format|uuid)\z/;
-
- # chop another one after a node with only a prop block
- <$fh> if $type eq 'node' && $record->has_prop_only();
+ }
# uuid and format record only contain headers
return $record;
@@ -77,15 +93,25 @@
my ($fh) = @_;
local $/ = $NL;
+
+ # skip empty lines
+ my $line;
+ while(1) {
+ $line = <$fh>;
+ return if !defined $line;
+ chop $line;
+ last unless $line eq '';
+ }
+
my $headers = SVN::Dump::Headers->new();
while(1) {
- my $line = <$fh>;
+ my ($key, $value) = split /: /, $line, 2;
+ $headers->{$key} = $value;
+
+ $line = <$fh>;
croak _eof() if !defined $line;
chop $line;
last if $line eq ''; # stop on empty line
-
- my ($key, $value) = split /: /, $line, 2;
- $headers->{$key} = $value;
}
croak "Empty line found instead of a header block line $."
@@ -182,7 +208,7 @@
# !!! You should use SVN::Dump, not SVN::Dump::Reader !!!
use SVN::Dump::Reader;
- my $reader = SVN::Dump::Reader( $fh );
+ my $reader = SVN::Dump::Reader->new( $fh );
my $record = $reader->read_record();
=head1 DESCRIPTION
@@ -196,13 +222,22 @@
=over 4
-=item new( $fh )
+=item new( $fh, \%options )
Create a new C<SVN::Dump::Reader> attached to the C<$fh> filehandle.
+The only supported option is C<check_digest>, which is disabled
+by default.
+
=item read_record( )
Read and return a new S<SVN::Dump::Record> object from the dump filehandle.
+
+If the option C<check_digest> is enabled, this method will recompute
+the digests for a dump without deltas, based on the information in the
+C<Text-content-md5> and C<Text-content-sha1> headers (if the corresponding
+C<Digest::> module is availabled). In case of a mismatch, the routine
+will C<die()> with an exception complaining about a C<checksum mismatch>.
=item read_header_block( )
@@ -226,9 +261,11 @@
L<SVN::Dump>, L<SVN::Dump::Headers>, L<SVN::Dump::Property>,
L<SVN::Dump::Text>.
-=head1 COPYRIGHT & LICENSE
-
-Copyright 2006 Philippe 'BooK' Bruhat, All Rights Reserved.
+=head1 COPYRIGHT
+
+Copyright 2006-2011 Philippe 'BooK' Bruhat, All Rights Reserved.
+
+=head1 LICENSE
This program is free software; you can redistribute it and/or modify it
under the same terms as Perl itself.
Modified: trunk/libsvn-dump-perl/lib/SVN/Dump/Record.pm
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libsvn-dump-perl/lib/SVN/Dump/Record.pm?rev=70878&op=diff
==============================================================================
--- trunk/libsvn-dump-perl/lib/SVN/Dump/Record.pm (original)
+++ trunk/libsvn-dump-perl/lib/SVN/Dump/Record.pm Tue Mar 8 12:18:38 2011
@@ -87,7 +87,8 @@
$self->set_header( 'Text-content-length' => $textlen )
if defined $self->get_text_block();
- $self->set_header( 'Prop-content-length', $proplen );
+ $self->set_header( 'Prop-content-length', $proplen )
+ if $proplen;
$self->set_header( 'Content-length' => $proplen + $textlen );
}
@@ -153,7 +154,7 @@
=head1 SYNOPSIS
- # SVN::Dump::Record objects are returns by the next_record()
+ # SVN::Dump::Record objects are returned by the next_record()
# method of SVN::Dump
=head1 DESCRIPTION
@@ -343,9 +344,11 @@
C<SVN::Dump::Headers>, C<SVN::Dump::Property>, C<SVN::Dump::Text>.
-=head1 COPYRIGHT & LICENSE
-
-Copyright 2006 Philippe 'BooK' Bruhat, All Rights Reserved.
+=head1 COPYRIGHT
+
+Copyright 2006-2011 Philippe 'BooK' Bruhat, All Rights Reserved.
+
+=head1 LICENSE
This program is free software; you can redistribute it and/or modify it
under the same terms as Perl itself.
Modified: trunk/libsvn-dump-perl/lib/SVN/Dump/Text.pm
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libsvn-dump-perl/lib/SVN/Dump/Text.pm?rev=70878&op=diff
==============================================================================
--- trunk/libsvn-dump-perl/lib/SVN/Dump/Text.pm (original)
+++ trunk/libsvn-dump-perl/lib/SVN/Dump/Text.pm Tue Mar 8 12:18:38 2011
@@ -18,6 +18,14 @@
sub get { ${ $_[0] } }
*as_string = \&get;
+sub digest {
+ my ( $self, $algo ) = @_;
+ return eval {
+ require Digest;
+ Digest->new( uc $algo )->add($$self)->hexdigest;
+ };
+}
+
1;
__END__
@@ -28,7 +36,13 @@
=head1 SYNOPSIS
+ # SVN::Dump::Text objects are returned by the read_text_block()
+ # method of SVN::Dump::Reader
+
=head1 DESCRIPTION
+
+A C<SVN::Dump::Text> object represents the text of a
+SVN dump record.
=head1 METHODS
@@ -52,13 +66,20 @@
Return a string representation of the text block.
+=item digest( $algo )
+
+Return a digest of the text computed with the C<$algo> algorithm in
+hexadecimal form. See the C<Digest> module for valid values of C<$algo>.
+
+Return C<undef> if the digest algorithm is not supported.
+
=back
=head1 SEE ALSO
=head1 COPYRIGHT & LICENSE
-Copyright 2006 Philippe 'BooK' Bruhat, All Rights Reserved.
+Copyright 2006-2010 Philippe 'BooK' Bruhat, All Rights Reserved.
This program is free software; you can redistribute it and/or modify it
under the same terms as Perl itself.
Modified: trunk/libsvn-dump-perl/t/13record.t
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libsvn-dump-perl/t/13record.t?rev=70878&op=diff
==============================================================================
--- trunk/libsvn-dump-perl/t/13record.t (original)
+++ trunk/libsvn-dump-perl/t/13record.t Tue Mar 8 12:18:38 2011
@@ -5,7 +5,7 @@
use SVN::Dump::Record;
-plan tests => 29;
+plan tests => 30;
# the record object
my $rec = SVN::Dump::Record->new();
@@ -92,3 +92,12 @@
my @array = $rec->delete_property(qw(foo bar baz));
is_deeply( \@array, [ undef, undef, 33 ], '@array is (undef, undef,33)' );
+# test a record without properties
+$rec = SVN::Dump::Record->new;
+$rec->set_header( "Node-path", "trunk/fubar.txt" );
+$rec->set_header( "Node-kind", "file" );
+$rec->set_header( "Node-action", "change" );
+$rec->set_text("some text");
+ok( $rec->as_string !~ /^Prop-content-length: 0$/m,
+ "No Prop-content-length: 0" );
+
Modified: trunk/libsvn-dump-perl/t/23record.t
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libsvn-dump-perl/t/23record.t?rev=70878&op=diff
==============================================================================
--- trunk/libsvn-dump-perl/t/23record.t (original)
+++ trunk/libsvn-dump-perl/t/23record.t Tue Mar 8 12:18:38 2011
@@ -19,6 +19,7 @@
my $dump = SVN::Dump::Reader->new($fh);
my $r = $dump->read_record();
is_same_string( $r->as_string(), $expected, "Read $f record" );
- is( tell($fh), -s $f, "Read all of $f" );
+ $r = $dump->read_record();
+ ok( !$r && tell($fh) == -s $f, "Read all of $f" );
}
Modified: trunk/libsvn-dump-perl/t/25dump.t
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libsvn-dump-perl/t/25dump.t?rev=70878&op=diff
==============================================================================
--- trunk/libsvn-dump-perl/t/25dump.t (original)
+++ trunk/libsvn-dump-perl/t/25dump.t Tue Mar 8 12:18:38 2011
@@ -24,7 +24,7 @@
next;
};
- $dump = SVN::Dump->new( { fh => $fh } );
+ $dump = SVN::Dump->new( { fh => $fh, check_digest => 1 } );
}
# once with a filename
else {
Modified: trunk/libsvn-dump-perl/t/29fail.t
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libsvn-dump-perl/t/29fail.t?rev=70878&op=diff
==============================================================================
--- trunk/libsvn-dump-perl/t/29fail.t (original)
+++ trunk/libsvn-dump-perl/t/29fail.t Tue Mar 8 12:18:38 2011
@@ -19,7 +19,7 @@
chop for ($err, $func);
($func, my @args) = split / /, $func;
- my $r = SVN::Dump::Reader->new($fh);
+ my $r = SVN::Dump::Reader->new( $fh, { check_digest => 1 } );
eval { $r->$func(@args); };
ok( $@, "$func(@{[join',', at args]}) failed for $f" );
like( $@, qr/$err/, " with the expected error ($err)" );
Modified: trunk/libsvn-dump-perl/t/dump/fail/r_badsum.svn
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libsvn-dump-perl/t/dump/fail/r_badsum.svn?rev=70878&op=diff
==============================================================================
--- trunk/libsvn-dump-perl/t/dump/fail/r_badsum.svn (original)
+++ trunk/libsvn-dump-perl/t/dump/fail/r_badsum.svn Tue Mar 8 12:18:38 2011
@@ -1,11 +1,11 @@
read_record
-^Inconsistent record size
+^md5 checksum mismatch: got 60262fd14bd1b59416820cc37e4ee982, expected 6772871c2cf5bcf281c5ee148135a2db
Node-path: trunk/loremipsum.txt
Node-kind: file
Node-action: add
Prop-content-length: 40
-Text-content-length: 1000
-Text-content-md5: 60262fd14bd1b59416820cc37e4ee982
+Text-content-length: 1090
+Text-content-md5: 6772871c2cf5bcf281c5ee148135a2db
Content-length: 1130
K 13
More information about the Pkg-perl-cvs-commits
mailing list