The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.

NAME

Git::FastExport - A parser for git fast-export streams

VERSION

version 0.108

SYNOPSIS

use Git::Repository;
use Git::FastExport;

# get the fast-export stream from a Git::Repository
my $r  = Git::Repository->new();
my $fh = $r->command(qw( fast-export --progress=1 --date-order --all ))->stdout;

# create the parser object
my $export = Git::FastExport->new($fh);

# extract blocks from the fast-import stream
while ( my $block = $export->next_block() ) {

    # do something with $block

}

DESCRIPTION

Git::FastExport is a module that parses the output of git-fast-export and returns Git::FastExport::Block objects that can be inspected or modified before being eventually passed on as the input to git-fast-import.

METHODS

This class provides the following methods:

new

my $export = Git::FastExport->new($fh);

The constructor takes an open filehandle and returns a Git::FastExport object attached to it.

next_block

my $block = $export->next_block();

Returns the next block in the git-fast-export stream as a Git::FastExport::Block object.

Return nothing at the end of stream.

This methods reads from the filehandle of the Git::FastExport object.

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.

AUTHOR

Philippe Bruhat (BooK) <book@cpan.org>

COPYRIGHT

Copyright 2008-2016 Philippe Bruhat (BooK), All Rights Reserved.

LICENSE

This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.