r22740 - in /branches/upstream/libgit-fastexport-perl: ./ current/ current/lib/ current/lib/Git/ current/script/ current/t/
efaistos-guest at users.alioth.debian.org
efaistos-guest at users.alioth.debian.org
Fri Jul 4 09:46:35 UTC 2008
Author: efaistos-guest
Date: Fri Jul 4 09:46:34 2008
New Revision: 22740
URL: http://svn.debian.org/wsvn/pkg-perl/?sc=1&rev=22740
Log:
[svn-inject] Installing original source of libgit-fastexport-perl
Added:
branches/upstream/libgit-fastexport-perl/
branches/upstream/libgit-fastexport-perl/current/
branches/upstream/libgit-fastexport-perl/current/Build.PL
branches/upstream/libgit-fastexport-perl/current/Changes
branches/upstream/libgit-fastexport-perl/current/MANIFEST
branches/upstream/libgit-fastexport-perl/current/META.yml
branches/upstream/libgit-fastexport-perl/current/Makefile.PL
branches/upstream/libgit-fastexport-perl/current/README
branches/upstream/libgit-fastexport-perl/current/lib/
branches/upstream/libgit-fastexport-perl/current/lib/Git/
branches/upstream/libgit-fastexport-perl/current/lib/Git/FastExport.pm
branches/upstream/libgit-fastexport-perl/current/script/
branches/upstream/libgit-fastexport-perl/current/script/git-stitch-repo (with props)
branches/upstream/libgit-fastexport-perl/current/t/
branches/upstream/libgit-fastexport-perl/current/t/00load.t
branches/upstream/libgit-fastexport-perl/current/t/01new.t
branches/upstream/libgit-fastexport-perl/current/t/fast-export
branches/upstream/libgit-fastexport-perl/current/t/git-fast-export.t
branches/upstream/libgit-fastexport-perl/current/t/pod-coverage.t
branches/upstream/libgit-fastexport-perl/current/t/pod.t
Added: branches/upstream/libgit-fastexport-perl/current/Build.PL
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libgit-fastexport-perl/current/Build.PL?rev=22740&op=file
==============================================================================
--- branches/upstream/libgit-fastexport-perl/current/Build.PL (added)
+++ branches/upstream/libgit-fastexport-perl/current/Build.PL Fri Jul 4 09:46:34 2008
@@ -1,0 +1,10 @@
+use Module::Build;
+my $build = Module::Build->new(
+ module_name => 'Git::FastExport',
+ license => 'perl',
+ requires => { 'Git' => 0.01, },
+ script_files => [ glob 'script/*' ],
+ add_to_cleanup => ['Git-FastExport-*'],
+);
+$build->create_build_script();
+
Added: branches/upstream/libgit-fastexport-perl/current/Changes
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libgit-fastexport-perl/current/Changes?rev=22740&op=file
==============================================================================
--- branches/upstream/libgit-fastexport-perl/current/Changes (added)
+++ branches/upstream/libgit-fastexport-perl/current/Changes Fri Jul 4 09:46:34 2008
@@ -1,0 +1,16 @@
+Revision history for Perl extension Git::FastExport
+
+0.02 Fri Jul 4 11:03:54 CEST 2008
+ [DOCUMENTATION]
+ - added a README file
+ - added documentation for git-stitch-repo
+ [TESTS]
+ - added t/00load.t and t/01new.t to increase test coverage
+
+0.01 Thu Jun 26 14:00:01 CEST 2008
+ [FEATURES]
+ - process git-fast-export output
+ - uses the Git.pm module provided with git
+ [SCRIPTS]
+ - git-stitch-repo can "stitch" together two unrelated repositories
+
Added: branches/upstream/libgit-fastexport-perl/current/MANIFEST
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libgit-fastexport-perl/current/MANIFEST?rev=22740&op=file
==============================================================================
--- branches/upstream/libgit-fastexport-perl/current/MANIFEST (added)
+++ branches/upstream/libgit-fastexport-perl/current/MANIFEST Fri Jul 4 09:46:34 2008
@@ -1,0 +1,14 @@
+Build.PL
+Changes
+lib/Git/FastExport.pm
+Makefile.PL
+MANIFEST This list of files
+META.yml
+README
+script/git-stitch-repo
+t/00load.t
+t/01new.t
+t/fast-export
+t/git-fast-export.t
+t/pod-coverage.t
+t/pod.t
Added: branches/upstream/libgit-fastexport-perl/current/META.yml
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libgit-fastexport-perl/current/META.yml?rev=22740&op=file
==============================================================================
--- branches/upstream/libgit-fastexport-perl/current/META.yml (added)
+++ branches/upstream/libgit-fastexport-perl/current/META.yml Fri Jul 4 09:46:34 2008
@@ -1,0 +1,20 @@
+---
+name: Git-FastExport
+version: 0.02
+author: []
+abstract: A module to parse the output of git-fast-export
+license: perl
+resources:
+ license: http://dev.perl.org/licenses/
+requires:
+ Git: 0.01
+provides:
+ Git::FastExport:
+ file: lib/Git/FastExport.pm
+ version: 0.02
+ Git::FastExport::Block:
+ file: lib/Git/FastExport.pm
+generated_by: Module::Build version 0.2808
+meta-spec:
+ url: http://module-build.sourceforge.net/META-spec-v1.2.html
+ version: 1.2
Added: branches/upstream/libgit-fastexport-perl/current/Makefile.PL
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libgit-fastexport-perl/current/Makefile.PL?rev=22740&op=file
==============================================================================
--- branches/upstream/libgit-fastexport-perl/current/Makefile.PL (added)
+++ branches/upstream/libgit-fastexport-perl/current/Makefile.PL Fri Jul 4 09:46:34 2008
@@ -1,0 +1,10 @@
+use ExtUtils::MakeMaker;
+WriteMakefile(
+ PL_FILES => {},
+ NAME => 'Git::FastExport',
+ EXE_FILES => [ glob 'script/*' ],
+ VERSION_FROM => 'lib/Git/FastExport.pm',
+ PREREQ_PM => { 'Git' => 0.01, },
+ LICENSE => 'perl',
+);
+
Added: branches/upstream/libgit-fastexport-perl/current/README
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libgit-fastexport-perl/current/README?rev=22740&op=file
==============================================================================
--- branches/upstream/libgit-fastexport-perl/current/README (added)
+++ branches/upstream/libgit-fastexport-perl/current/README Fri Jul 4 09:46:34 2008
@@ -1,0 +1,7 @@
+Git::FastExport
+---------------
+
+This module processes the output of git-fast-export and returns
+Perl data structures that can be inspected and modified to produce
+a slightly different stream, suitable to be passed to git-fast-import.
+
Added: branches/upstream/libgit-fastexport-perl/current/lib/Git/FastExport.pm
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libgit-fastexport-perl/current/lib/Git/FastExport.pm?rev=22740&op=file
==============================================================================
--- branches/upstream/libgit-fastexport-perl/current/lib/Git/FastExport.pm (added)
+++ branches/upstream/libgit-fastexport-perl/current/lib/Git/FastExport.pm Fri Jul 4 09:46:34 2008
@@ -1,0 +1,207 @@
+package Git::FastExport;
+use strict;
+use warnings;
+use Carp;
+use Cwd;
+use IPC::Open2;
+
+our $VERSION = '0.02';
+
+sub new {
+ my ( $class, $repo ) = @_;
+ my $self = bless { source => '' }, $class;
+
+ if ($repo) {
+ croak "$repo is not a Git object"
+ if !( ref $repo && $repo->isa('Git') );
+ $self->{git} = $repo;
+ }
+ return $self;
+}
+
+sub fast_export {
+ my ( $self, @args ) = @_;
+ my $repo = $self->{git};
+ $self->{source} = $repo->wc_path || $repo->repo_path;
+
+ # call the fast-export command (no default arguments)
+ ( $self->{export_fh}, $self->{ctx} )
+ = $repo->command_output_pipe( 'fast-export', @args );
+}
+
+sub next_block {
+ my ($self) = @_;
+ my $block = bless {}, 'Git::FastExport::Block';
+ my $fh = $self->{export_fh};
+
+ if ( eof $fh ) {
+ $self->{git}->command_close_pipe( $fh, $self->{ctx} )
+ if $self->{git} && $self->{ctx};
+ delete @{$self}{qw( export_fh ctx )};
+ return;
+ }
+
+ # use the header from last time, or read it (first time)
+ $block->{header} = $self->{header} ||= <$fh>;
+ chomp $block->{header};
+ ( $block->{type} ) = $block->{header} =~ /^(\w+)/g;
+
+ local $_;
+ while (<$fh>) {
+
+ # we've reached the beginning of the next block
+ if (/^(commit|tag|reset|blob|checkpoint|progress)\b/) {
+ s/^progress /progress [$self->{source}] /;
+ $self->{header} = $_;
+ last;
+ }
+
+ chomp;
+
+ # special case of data block
+ if (/^data (\d+)/) {
+ my $bytes= 0 + $1;
+ if ($bytes) {
+ local $/ = \$bytes;
+ $block->{data} = <$fh>;
+ } else {
+ $block->{data} = "";
+ }
+ }
+ elsif (/^(?:[MDRC] |deleteall)/) {
+ push @{ $block->{files} }, $_;
+ }
+ elsif (/^(\w+)/) {
+ push @{ $block->{$1} }, $_;
+ }
+ else {
+
+ # ignore empty lines, but choke on others
+ die "Unexpected line:\n$_\n" if !/^$/;
+ $block->{footer} .= "\012";
+ }
+ }
+
+ # post-processing
+ if ( $block->{type} eq 'commit' ) {
+ ( $block->{date} )
+ = $block->{committer}[0] =~ /^committer [^>]*> (\d+) [-+]\d+$/g;
+ }
+
+ return $block;
+}
+
+package Git::FastExport::Block;
+
+my $LF = "\012";
+
+my %fields = (
+ commit => [qw( mark author committer data from merge files )],
+ tag => [qw( from tagger data )],
+ reset => [qw( from )],
+ blob => [qw( mark data )],
+ checkpoint => [],
+ progress => [],
+);
+
+sub as_string {
+ my ($self) = @_;
+ my $string = $self->{header} . $LF;
+
+ for my $key ( @{ $fields{ $self->{type} } } ) {
+ next if !exists $self->{$key};
+ if ( $key eq 'data' ) {
+ $string
+ .= 'data ' . length( $self->{data} ) . $LF . $self->{data};
+ }
+ else {
+ $string .= "$_$LF" for @{ $self->{$key} };
+ }
+ }
+ return $string .= $self->{footer} || '';
+}
+
+1;
+
+__END__
+
+=head1 NAME
+
+Git::FastExport - A module to parse the output of git-fast-export
+
+=head1 SYNOPSIS
+
+ use Git;
+ use Git::FastExport;
+
+ my $repo = Git->repository( Repository => $path );
+ my $export = Git::FastExport->new($repo);
+
+ while ( my $block = $export->next_block() ) {
+
+ # do something with $block
+
+ }
+
+=head1 DESCRIPTION
+
+C<Git::FastExport> is a module that parses the output of
+B<git-fast-export> and returns C<Git::FastExport::Block> objects that
+can be inspected or modified before being eventually passed on as the
+input to B<git-fast-import>.
+
+=head1 METHODS
+
+This class provides the following methods:
+
+=over 4
+
+=item new( [ $repository ] )
+
+The constructor takes an optional C<Git> repository object, and returns
+a C<Git::FastExport> object attached to it.
+
+=item fast_export( @args )
+
+Initialize a B<git-fast-export> command on the repository, using the
+arguments given in C<@args>.
+
+=item next_block()
+
+Return the next block in the B<git-fast-export> stream as a
+C<Git::FastExport::Block> object.
+
+Return nothing at the end of stream.
+
+This methods reads from the C<export_fh> filehandle of the C<Git::FastExport>
+object. It is normally setup via the C<fast_export()> method, but it is
+possible to read from STDIN by doing:
+
+ $export->{export_fh} = \*STDIN;
+ while ( my $block = $export->next_block() ) {
+ ...
+ }
+
+=back
+
+=head1 AUTHOR
+
+Philippe Bruhat (BooK)
+
+=head1 ACKNOWLEDGEMENTS
+
+The original version of this module was created as part of my work
+for BOOKING.COM, which authorized its publication/distribution
+under the same terms as Perl itself.
+
+=head1 COPYRIGHT
+
+Copyright 2008 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.
+
+=cut
+
Added: branches/upstream/libgit-fastexport-perl/current/script/git-stitch-repo
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libgit-fastexport-perl/current/script/git-stitch-repo?rev=22740&op=file
==============================================================================
--- branches/upstream/libgit-fastexport-perl/current/script/git-stitch-repo (added)
+++ branches/upstream/libgit-fastexport-perl/current/script/git-stitch-repo Fri Jul 4 09:46:34 2008
@@ -1,0 +1,250 @@
+#!/usr/bin/env perl
+use strict;
+use warnings;
+use Git;
+use Git::FastExport;
+
+our $VERSION = 0.02;
+
+my %repo;
+
+# process command-line parameters
+while (@ARGV) {
+ my ( $repo, $dir ) = split /:/, shift @ARGV, 2;
+ $dir ||= '';
+
+ # create an export parser for each repo
+ my $parser
+ = Git::FastExport->new( Git->repository( Directory => $repo ) );
+ $parser->fast_export(qw( --progress=1 --all --date-order ));
+ $parser->{mapdir} = $dir;
+
+ # update the %repo hash
+ $repo = $parser->{source};
+ $repo{$repo}{repo} = $repo;
+ $repo{$repo}{dir} = $dir;
+ $repo{$repo}{parser} = $parser;
+}
+
+# repositories that we will process
+my @repos = values %repo;
+
+my $mark = 1_000_000; # mark counter in the new rpo
+my %mark_map; # map marks in source repos to marks in the new repo
+
+# get the first commits
+$_->{commit} = next_commit( $_->{parser} ) for @repos;
+
+# main loop
+use Data::Dumper;
+my $last;
+my %commits;
+while (@repos) {
+
+ # sort by date
+ @repos = sort { $a->{commit}{date} <=> $b->{commit}{date} } @repos;
+ my $repo = $repos[0];
+
+ # next commit to dump
+ my $commit = $repo->{commit};
+
+ # update marks & dir in files
+ for ( @{ $commit->{files} } ) {
+ s/^M (\d+) :(\d+)/M $1 :$mark_map{$repo->{repo}}{$2}/;
+ if ( my $dir = $repo->{dir} ) {
+ s!^(M \d+ :\d+) (.*)!$1 $dir/$2!; # filemodify
+ s!^D (.*)!D $dir/$1!; # filedelete
+
+ # /!\ quotes may happen - die and fix if needed
+ die "Choked on quoted paths in $repo->{repo}! Culprit:\n$_\n"
+ if /^[CR] \S+ \S+ /;
+
+ # filecopy | filerename
+ s!^([CR]) (\S+) (\S+)!$1 $dir/$2 $dir/$3!;
+ }
+ }
+
+ # first commit in the old repo linked to latest commit in new repo
+ if ( $last && !$commit->{from} ) {
+ $commit->{from} = ["from :$last"];
+ }
+
+ # update historical information
+ my ($id) = $commit->{mark}[0] =~ /:(\d+)/g;
+ $last = $id; # last commit applied
+ my $branch = ( split / /, $commit->{header} )[1];
+ my $node = $commits{$id} = {
+ name => $id,
+ repo => $repo->{repo},
+ branch => $branch,
+ children => [],
+ merge => exists $commit->{merge},
+ };
+
+ # this commit's parents
+ my @parents = map {/:(\d+)/g} @{ $commit->{from} || [] },
+ @{ $commit->{merge} || [] };
+
+ # map each parent to its last "alien" commit
+ my %parent_map = map {
+ $_ => last_alien_child( $commits{$_}, $repo->{repo}, $branch )->{name}
+ } @parents;
+
+ # map parent marks
+ for ( @{ $commit->{from} || [] }, @{ $commit->{merge} || [] } ) {
+ if (m/^(from|merge) /) {
+ s/:(\d+)/:$parent_map{$1}/g;
+ }
+ }
+
+ # update the parents information
+ for my $parent ( map { $parent_map{$_} } @parents ) {
+ push @{ $commits{$parent}{children} }, $node;
+ }
+
+ # dump the commit
+ print $commit->as_string;
+
+ # load next commit
+ $repo->{commit} = next_commit( $repo->{parser} )
+ or shift @repos; # no more blocks in this export
+}
+
+# return the next commit
+# - print out the intermediate blocks
+# - offset the old marks
+sub next_commit {
+ my ($parser) = @_;
+ my $block;
+
+ while ( $block = $parser->next_block() ) {
+
+ # map to the new mark
+ for ( @{ $block->{mark} || [] } ) {
+ s/:(\d+)/:$mark/
+ and $mark_map{ $parser->{source} }{$1} = $mark++;
+ }
+
+ # update marks in from & merge
+ for ( @{ $block->{from} || [] }, @{ $block->{merge} || [] } ) {
+ if (m/^(from|merge) /) {
+ s/:(\d+)/:$mark_map{$parser->{source}}{$1}/g;
+ }
+ }
+ last if $block->{type} eq 'commit';
+ print $block->as_string();
+ }
+ return $block;
+}
+
+# find the last child of this node
+# that has either no child
+# or a child in our repo
+sub last_alien_child {
+ my ( $node, $repo, $branch ) = @_;
+
+ while (1) {
+
+ # no children nodes
+ return $node if ( !@{ $node->{children} } );
+
+ # some children nodes are local
+ return $node if grep { $_->{repo} eq $repo } @{ $node->{children} };
+
+ # there's a child in the same branch
+ if ( my ($peer)
+ = grep { $_->{branch} eq $branch } @{ $node->{children} } )
+ {
+ # but don't go past another repo's merges
+ return $node if $peer->{merge};
+ $node = $peer;
+ }
+
+ # or pick the first child (as good as any)
+ else {
+
+ $node = $node->{children}[0];
+ }
+ }
+}
+
+__END__
+
+=head1 NAME
+
+git-stitch-repo - Stitch several git repositories into a git-fast-import stream
+
+=head1 SYNOPSIS
+
+git-stitch-repo repo1 repo2:dir2 ...
+
+=head1 DESCRIPTION
+
+B<git-stitch-repo> will process the output of C<git-fast-export --all
+--date-order> on the git repositories given on the command-line,
+and create a stream suitable for B<git-fast-import> that will create
+a new repository containing all the commits in a new commit tree
+that respects the history of all the source repositories.
+
+=head2 Example
+
+Imagine we have two repositories A and B that we want to stitch into
+a repository C so that all the files from A are in subdirectory F<A>
+and all the files from B are in subdirectory F<B>.
+
+Repository A:
+
+ topic
+ ' ,master
+ A3---A5
+ / /
+ A1---A2---A4
+
+Branch I<master> points to A5 and branch I<topic> points to A3.
+
+Repository B:
+ ,topic ,master
+ B3---B5---B7---B8
+ / /
+ B1---B2---B4---B6
+
+Branch I<master> points to B8 and branch I<topic> points to B5.
+
+The C repository should preserve chronology, commit relationships and
+branches as much as possible, while giving the impression that the
+directories F<A> & F<B> did live side-by-side all the time.
+
+Assuming additional timestamps not shown on the above graphs,
+B<git-stitch-repo> will produce a B<git-fast-import> stream that will
+create the following history:
+
+ ,topic ,master
+ A3---B3---A5---B5---B7---B8
+ / / /
+ A1---B1---A2---B2---A4---B4--------B6
+
+
+Note that the current result is slightly buggy, since A5 wasn't on the
+I<topic> branch in the original graph for A.
+
+=head1 AUTHOR
+
+Philippe Bruhat (BooK), C<< <book at cpan.org> >>.
+
+=head1 ACKNOWLEDGEMENTS
+
+The original version of this script was created as part of my work
+for BOOKING.COM, which authorized its publication/distribution
+under the same terms as Perl itself.
+
+=head1 COPYRIGHT
+
+Copyright 2008 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.
+
+=cut
+
Propchange: branches/upstream/libgit-fastexport-perl/current/script/git-stitch-repo
------------------------------------------------------------------------------
svn:executable =
Added: branches/upstream/libgit-fastexport-perl/current/t/00load.t
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libgit-fastexport-perl/current/t/00load.t?rev=22740&op=file
==============================================================================
--- branches/upstream/libgit-fastexport-perl/current/t/00load.t (added)
+++ branches/upstream/libgit-fastexport-perl/current/t/00load.t Fri Jul 4 09:46:34 2008
@@ -1,0 +1,10 @@
+use Test::More;
+
+my @modules = qw(
+ Git::FastExport
+);
+
+plan tests => scalar @modules;
+
+use_ok($_) for sort @modules;
+
Added: branches/upstream/libgit-fastexport-perl/current/t/01new.t
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libgit-fastexport-perl/current/t/01new.t?rev=22740&op=file
==============================================================================
--- branches/upstream/libgit-fastexport-perl/current/t/01new.t (added)
+++ branches/upstream/libgit-fastexport-perl/current/t/01new.t Fri Jul 4 09:46:34 2008
@@ -1,0 +1,50 @@
+use Test::More;
+use Git;
+use Git::FastExport;
+use File::Temp qw( tempdir );
+
+# setup a temporary git repo
+my $dir = tempdir( CLEANUP => 1 );
+
+# alas, this can't be done with Git.pm
+chdir $dir;
+`git-init`;
+
+my $git = Git->repository( Directory => $dir );
+
+my @tests = (
+
+ # desc, args
+ [''],
+ [ "Git->new( Directory => $dir )", $git ],
+);
+
+my @fails = (
+
+ # desc, error, regex, args
+ [ q('zlonk'), qr/^zlonk is not a Git object/, 'zlonk' ],
+ [ q('zlonk'), qr/^Zlonk=HASH\S+ is not a Git object/, bless {}, 'Zlonk' ],
+);
+
+plan tests => 3 * @tests + 3 * @fails;
+
+for my $t (@tests) {
+ my ( $desc, @args ) = @$t;
+ my $export;
+ ok( eval { $export = Git::FastExport->new(@args); 1 },
+ "Git::FastExport->new($desc)" );
+ is( $@, '', "No error calling Git::FastExport->new($desc)" );
+ isa_ok( $export, 'Git::FastExport' );
+
+}
+
+# some failure tests
+for my $t (@fails) {
+ my ( $desc, $regex, @args ) = @$t;
+ my $export;
+ ok( !eval { $export = Git::FastExport->new(@args); 1 },
+ "Git::FastExport->new($desc) failed" );
+ like( $@, $regex, 'Expected error message' );
+ is( $export, undef, 'No object created' );
+}
+
Added: branches/upstream/libgit-fastexport-perl/current/t/fast-export
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libgit-fastexport-perl/current/t/fast-export?rev=22740&op=file
==============================================================================
--- branches/upstream/libgit-fastexport-perl/current/t/fast-export (added)
+++ branches/upstream/libgit-fastexport-perl/current/t/fast-export Fri Jul 4 09:46:34 2008
@@ -1,0 +1,288 @@
+blob
+mark :1
+data 126
+perferendis
+sit
+praesentium
+doloribus
+itaque
+illum
+facere
+aliquip
+harum
+rerum
+magnam
+nam
+laboriosam
+tempora
+ullam
+odit
+quidem
+
+commit refs/heads/before
+mark :2
+author Philippe Bruhat (BooK) <book at cpan.org> 1213115458 +0200
+committer Philippe Bruhat (BooK) <book at cpan.org> 1213115458 +0200
+data 13
+first commit
+M 0100644 :1 loremipsum.txt
+
+blob
+mark :3
+data 154
+perferendis
+sit
+praesentium
+doloribus
+itaque
+illum
+facere
+aliquip
+harum
+rerum
+magnam
+nam
+laboriosam
+tempora
+ullam
+odit
+quidem
+blanditiis
+nulla
+laboriosam
+
+commit refs/heads/before
+mark :4
+author Philippe Bruhat (BooK) <book at cpan.org> 1213115469 +0200
+committer Philippe Bruhat (BooK) <book at cpan.org> 1213115469 +0200
+data 14
+second commit
+from :2
+M 0100644 :3 loremipsum.txt
+
+blob
+mark :5
+data 173
+perferendis
+sit
+praesentium
+doloribus
+itaque
+illum
+facere
+aliquip
+harum
+rerum
+magnam
+nam
+laboriosam
+tempora
+ullam
+odit
+quidem
+blanditiis
+nulla
+laboriosam
+vitae
+proident
+sit
+
+progress 5 objects
+commit refs/heads/master
+mark :6
+author Philippe Bruhat (BooK) <book at cpan.org> 1213115504 +0200
+committer Philippe Bruhat (BooK) <book at cpan.org> 1213115504 +0200
+data 25
+another commit on master
+from :4
+M 0100644 :5 loremipsum.txt
+
+blob
+mark :7
+data 135
+perferendis
+sit
+praesentium
+doloribus
+itaque
+illum
+facere
+aliquip
+nam
+laboriosam
+tempora
+ullam
+odit
+quidem
+blanditiis
+nulla
+laboriosam
+
+commit refs/tags/deletion
+mark :8
+author Philippe Bruhat (BooK) <book at cpan.org> 1213115522 +0200
+committer Philippe Bruhat (BooK) <book at cpan.org> 1213115522 +0200
+data 19
+removed some lines
+from :4
+M 0100644 :7 loremipsum.txt
+
+blob
+mark :9
+data 155
+perferendis
+sit
+praesentium
+doloribus
+itaque
+illum
+facere
+aliquip
+nam
+laboriosam
+tempora
+ullam
+odit
+quidem
+blanditiis
+nulla
+laboriosam
+officiis
+fuga
+ipsum
+
+commit refs/heads/master
+mark :10
+author Philippe Bruhat (BooK) <book at cpan.org> 1213115555 +0200
+committer Philippe Bruhat (BooK) <book at cpan.org> 1213115555 +0200
+data 21
+added some lines too
+from :8
+M 0100644 :9 loremipsum.txt
+
+progress 10 objects
+blob
+mark :11
+data 194
+perferendis
+sit
+praesentium
+doloribus
+itaque
+illum
+facere
+aliquip
+harum
+rerum
+magnam
+nam
+laboriosam
+tempora
+ullam
+odit
+quidem
+blanditiis
+nulla
+laboriosam
+vitae
+proident
+sit
+beatae
+dicta
+debitis
+
+commit refs/heads/master
+mark :12
+author Philippe Bruhat (BooK) <book at cpan.org> 1213115577 +0200
+committer Philippe Bruhat (BooK) <book at cpan.org> 1213115577 +0200
+data 31
+added some lines on the master
+from :6
+M 0100644 :11 loremipsum.txt
+
+blob
+mark :13
+data 195
+perferendis
+sit
+praesentium
+doloribus
+itaque
+illum
+facere
+aliquip
+nam
+laboriosam
+tempora
+ullam
+odit
+quidem
+blanditiis
+nulla
+laboriosam
+vitae
+proident
+sit
+beatae
+dicta
+debitis
+officiis
+fuga
+ipsum
+
+commit refs/heads/master
+mark :14
+author Philippe Bruhat (BooK) <book at cpan.org> 1213115620 +0200
+committer Philippe Bruhat (BooK) <book at cpan.org> 1213115620 +0200
+data 26
+merged branch into master
+from :12
+merge :10
+M 0100644 :13 loremipsum.txt
+
+blob
+mark :15
+data 224
+perferendis
+sit
+praesentium
+doloribus
+itaque
+illum
+facere
+aliquip
+nam
+laboriosam
+tempora
+ullam
+odit
+quidem
+blanditiis
+nulla
+laboriosam
+vitae
+proident
+sit
+beatae
+dicta
+debitis
+officiis
+fuga
+ipsum
+vitae
+repudiandae
+laboriosam
+
+progress 15 objects
+commit refs/heads/master
+mark :16
+author Philippe Bruhat (BooK) <book at cpan.org> 1213115889 +0200
+committer Philippe Bruhat (BooK) <book at cpan.org> 1213115889 +0200
+data 17
+more latin words
+from :14
+M 0100644 :15 loremipsum.txt
+
+reset refs/tags/removal
+from :8
+
Added: branches/upstream/libgit-fastexport-perl/current/t/git-fast-export.t
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libgit-fastexport-perl/current/t/git-fast-export.t?rev=22740&op=file
==============================================================================
--- branches/upstream/libgit-fastexport-perl/current/t/git-fast-export.t (added)
+++ branches/upstream/libgit-fastexport-perl/current/t/git-fast-export.t Fri Jul 4 09:46:34 2008
@@ -1,0 +1,269 @@
+use strict;
+use warnings;
+use Test::More;
+use File::Slurp;
+
+my @latin = split m!^----\n!m, << 'EOT';
+perferendis
+sit
+praesentium
+doloribus
+itaque
+illum
+facere
+aliquip
+----
+harum
+rerum
+magnam
+----
+nam
+laboriosam
+tempora
+ullam
+odit
+quidem
+----
+blanditiis
+nulla
+laboriosam
+----
+vitae
+proident
+sit
+----
+officiis
+fuga
+ipsum
+----
+beatae
+dicta
+debitis
+----
+vitae
+repudiandae
+laboriosam
+EOT
+
+my @blocks = (
+ { type => 'blob',
+ header => 'blob',
+ data => join( '', @latin[ 0, 1, 2 ] ),
+ mark => ['mark :1'],
+ footer => "\012",
+ },
+ { type => 'commit',
+ header => 'commit refs/heads/before',
+ data => "first commit\n",
+ mark => ['mark :2'],
+ author => [
+ 'author Philippe Bruhat (BooK) <book at cpan.org> 1213115458 +0200'
+ ],
+ committer => [
+ 'committer Philippe Bruhat (BooK) <book at cpan.org> 1213115458 +0200'
+ ],
+ files => ['M 0100644 :1 loremipsum.txt'],
+ date => 1213115458,
+ footer => "\012",
+ },
+ { type => 'blob',
+ header => 'blob',
+ data => join( '', @latin[ 0, 1, 2, 3 ] ),
+ mark => ['mark :3'],
+ footer => "\012",
+ },
+ { type => 'commit',
+ header => 'commit refs/heads/before',
+ mark => ['mark :4'],
+ author => [
+ 'author Philippe Bruhat (BooK) <book at cpan.org> 1213115469 +0200'
+ ],
+ committer => [
+ 'committer Philippe Bruhat (BooK) <book at cpan.org> 1213115469 +0200'
+ ],
+ data => "second commit\n",
+ from => ['from :2'],
+ files => ['M 0100644 :3 loremipsum.txt'],
+ date => 1213115469,
+ footer => "\012",
+ },
+ { type => 'blob',
+ header => 'blob',
+ data => join( '', @latin[ 0, 1, 2, 3, 4 ] ),
+ mark => ['mark :5'],
+ footer => "\012",
+ },
+ { type => 'progress',
+ header => 'progress [] 5 objects',
+ },
+ { type => 'commit',
+ header => 'commit refs/heads/master',
+ mark => ['mark :6'],
+ author => [
+ 'author Philippe Bruhat (BooK) <book at cpan.org> 1213115504 +0200'
+ ],
+ committer => [
+ 'committer Philippe Bruhat (BooK) <book at cpan.org> 1213115504 +0200'
+ ],
+ data => "another commit on master\n",
+ from => ['from :4'],
+ files => ['M 0100644 :5 loremipsum.txt'],
+ date => 1213115504,
+ footer => "\012",
+ },
+ { type => 'blob',
+ header => 'blob',
+ data => join( '', @latin[ 0, 2, 3 ] ),
+ mark => ['mark :7'],
+ footer => "\012",
+ },
+ { type => 'commit',
+ header => 'commit refs/tags/deletion',
+ mark => ['mark :8'],
+ author => [
+ 'author Philippe Bruhat (BooK) <book at cpan.org> 1213115522 +0200'
+ ],
+ committer => [
+ 'committer Philippe Bruhat (BooK) <book at cpan.org> 1213115522 +0200'
+ ],
+ data => "removed some lines\n",
+ from => ['from :4'],
+ files => ['M 0100644 :7 loremipsum.txt'],
+ date => 1213115522,
+ footer => "\012",
+ },
+ { type => 'blob',
+ header => 'blob',
+ data => join( '', @latin[ 0, 2, 3, 5 ] ),
+ mark => ['mark :9'],
+ footer => "\012",
+ },
+ { type => 'commit',
+ header => 'commit refs/heads/master',
+ mark => ['mark :10'],
+ author => [
+ 'author Philippe Bruhat (BooK) <book at cpan.org> 1213115555 +0200'
+ ],
+ committer => [
+ 'committer Philippe Bruhat (BooK) <book at cpan.org> 1213115555 +0200'
+ ],
+ data => "added some lines too\n",
+ from => ['from :8'],
+ files => ['M 0100644 :9 loremipsum.txt'],
+ date => 1213115555,
+ footer => "\012",
+ },
+ { type => 'progress',
+ header => 'progress [] 10 objects',
+ },
+ { type => 'blob',
+ header => 'blob',
+ data => join( '', @latin[ 0, 1, 2, 3, 4, 6 ] ),
+ mark => ['mark :11'],
+ footer => "\012",
+ },
+ { type => 'commit',
+ header => 'commit refs/heads/master',
+ mark => ['mark :12'],
+ author => [
+ 'author Philippe Bruhat (BooK) <book at cpan.org> 1213115577 +0200'
+ ],
+ committer => [
+ 'committer Philippe Bruhat (BooK) <book at cpan.org> 1213115577 +0200'
+ ],
+ data => "added some lines on the master\n",
+ from => ['from :6'],
+ files => ['M 0100644 :11 loremipsum.txt'],
+ date => 1213115577,
+ footer => "\012",
+ },
+ { type => 'blob',
+ header => 'blob',
+ data => join( '', @latin[ 0, 2, 3, 4, 6, 5 ] ),
+ mark => ['mark :13'],
+ footer => "\012",
+ },
+ { type => 'commit',
+ header => 'commit refs/heads/master',
+ mark => ['mark :14'],
+ author => [
+ 'author Philippe Bruhat (BooK) <book at cpan.org> 1213115620 +0200'
+ ],
+ committer => [
+ 'committer Philippe Bruhat (BooK) <book at cpan.org> 1213115620 +0200'
+ ],
+ data => "merged branch into master\n",
+ from => ['from :12'],
+ merge => ['merge :10'],
+ files => ['M 0100644 :13 loremipsum.txt'],
+ date => 1213115620,
+ footer => "\012",
+ },
+ { type => 'blob',
+ header => 'blob',
+ data => join( '', @latin[ 0, 2, 3, 4, 6, 5, 7 ] ),
+ mark => ['mark :15'],
+ footer => "\012",
+ },
+ { type => 'progress',
+ header => 'progress [] 15 objects',
+ },
+ { type => 'commit',
+ header => 'commit refs/heads/master',
+ mark => ['mark :16'],
+ author => [
+ 'author Philippe Bruhat (BooK) <book at cpan.org> 1213115889 +0200'
+ ],
+ committer => [
+ 'committer Philippe Bruhat (BooK) <book at cpan.org> 1213115889 +0200'
+ ],
+ data => "more latin words\n",
+ from => ['from :14'],
+ files => ['M 0100644 :15 loremipsum.txt'],
+ date => 1213115889,
+ footer => "\012",
+ },
+ { type => 'reset',
+ header => 'reset refs/tags/removal',
+ from => ['from :8'],
+ footer => "\012",
+ },
+);
+
+plan tests => 1 + 3 * @blocks + 2;
+
+use_ok('Git::FastExport');
+
+my $export = Git::FastExport->new();
+open my $fh, 't/fast-export' or die "Can't open t/fast-export: $!";
+my @strings;
+{
+ open my $gh, 't/fast-export' or die "Can't open t/fast-export: $!";
+ my $string = join '', <$gh>;
+ close $gh;
+ @strings
+ = split
+ /(?<=\012\012)|(?<=progress . objects\012)|(?<=progress .. objects\012)/m,
+ $string;
+
+ # we actually change the progress markers
+ s/progress/progress []/g for @strings;
+}
+
+$export->{export_fh} = $fh;
+
+$_ = 'canari';
+
+for my $block (@blocks) {
+ my $b = $export->next_block();
+ isa_ok( $b, 'Git::FastExport::Block' );
+ my $mesg = $block->{mark} ? $block->{mark}[0] : $block->{header};
+ chomp $mesg;
+ is_deeply( $b, $block, "$mesg object" );
+ is( $b->as_string, shift @strings, "$mesg string dump" );
+}
+
+is( $export->next_block(), undef, 'no more blocks' );
+
+is( $_, 'canari', 'the canari survived' );
+
Added: branches/upstream/libgit-fastexport-perl/current/t/pod-coverage.t
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libgit-fastexport-perl/current/t/pod-coverage.t?rev=22740&op=file
==============================================================================
--- branches/upstream/libgit-fastexport-perl/current/t/pod-coverage.t (added)
+++ branches/upstream/libgit-fastexport-perl/current/t/pod-coverage.t Fri Jul 4 09:46:34 2008
@@ -1,0 +1,18 @@
+use strict;
+use warnings;
+use Test::More;
+
+# Ensure a recent version of Test::Pod::Coverage
+my $min_tpc = 1.08;
+eval "use Test::Pod::Coverage $min_tpc";
+plan skip_all => "Test::Pod::Coverage $min_tpc required for testing POD coverage"
+ if $@;
+
+# Test::Pod::Coverage doesn't require a minimum Pod::Coverage version,
+# but older versions don't recognize some common documentation styles
+my $min_pc = 0.18;
+eval "use Pod::Coverage $min_pc";
+plan skip_all => "Pod::Coverage $min_pc required for testing POD coverage"
+ if $@;
+
+all_pod_coverage_ok();
Added: branches/upstream/libgit-fastexport-perl/current/t/pod.t
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libgit-fastexport-perl/current/t/pod.t?rev=22740&op=file
==============================================================================
--- branches/upstream/libgit-fastexport-perl/current/t/pod.t (added)
+++ branches/upstream/libgit-fastexport-perl/current/t/pod.t Fri Jul 4 09:46:34 2008
@@ -1,0 +1,12 @@
+#!perl -T
+
+use strict;
+use warnings;
+use Test::More;
+
+# Ensure a recent version of Test::Pod
+my $min_tp = 1.22;
+eval "use Test::Pod $min_tp";
+plan skip_all => "Test::Pod $min_tp required for testing POD" if $@;
+
+all_pod_files_ok();
More information about the Pkg-perl-cvs-commits
mailing list