Git::FastExport - A module to parse the output of git-fast-export


Git-FastExport documentation  | view source Contained in the Git-FastExport distribution.

Index


NAME

Top

Git::FastExport - A module to parse the output of git-fast-export

SYNOPSIS

Top

    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

    }

DESCRIPTION

Top

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

Top

This class provides the following methods:

new( [ $repository ] )

The constructor takes an optional git directory (a string used as a parameter to Git->repository( Directory => ... )) or Git repository object, and returns a Git::FastExport object attached to it.

fast_export( @args )

Initialize a git-fast-export command on the repository, using the arguments given in @args.

next_block()

Return 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 export_fh filehandle of the Git::FastExport object. It is normally setup via the fast_export() method, but it is possible to read from STDIN by doing:

    $export->{export_fh} = \*STDIN;
    while ( my $block = $export->next_block() ) {
        ...
    }

AUTHOR

Top

Philippe Bruhat (BooK)

ACKNOWLEDGEMENTS

Top

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.

COPYRIGHT

Top

LICENSE

Top

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


Git-FastExport documentation  | view source Contained in the Git-FastExport distribution.