Git::Raw::Remote - Git remote class
version 0.31
use Git::Raw; # open the Git repository at $path my $repo = Git::Raw::Repository -> open($path); # add a new remote my $remote = Git::Raw::Remote -> create($repo, 'origin', $url); # set the acquire credentials callback $remote -> callbacks({ 'credentials' => sub { Git::Raw::Cred -> userpass($usr, $pwd) } 'update_tips' => sub { my ($ref, $a, $b) = @_); print "Updated $ref: $a -> $b", "\n"; } }); # connect the remote $remote -> connect('fetch'); # fetch from the remote and update the local tips $remote -> download; $remote -> update_tips; # disconnect $remote -> disconnect; my $empty_repo = Git::Raw::Repository -> new; my $inmem_remote = Git::Raw::Remote -> create_inmemory($repo, undef, $url); my $list = $inmem_remote -> ls;
A Git::Raw::Remote represents a Git remote.
Git::Raw::Remote
WARNING: The API of this module is unstable and may change without warning (any change will be appropriately documented in the changelog).
Create a remote with the default fetch refspec and add it to the repository's configuration.
Create a remote in memory.
Load an existing remote.
Retrieve the name of the remote. If $name is passed, the remote's name will be updated and returned.
$name
Retrieve the URL of the remote. If $url is passed, the remote's URL will be updated and returned.
$url
Add a fetch spec to the remote.
Add a push spec to the remote.
Retrieve the list of refs at the remote. Returns a hash reference containing key = value> pairs where the key is the name of the reference, and the value is a hash reference containing the following values:
key =
"local"
Whether the reference exists locally.
"id"
The object ID of the reference.
"lid"
The local object ID of the reference (optional).
"credentials"
The callback to be called any time authentication is required to connect to the remote repository. The callback receives a string containing the URL of the remote, and it must return a Git::Raw::Cred object.
"progress"
Textual progress from the remote. Text send over the progress side-band will be passed to this function (this is the 'counting objects' output). The callback receives a string containing progress information.
"completion"
Completion is called when different parts of the download process are done (currently unused).
"transfer_progress"
During the download of new data, this will be regularly called with the current count of progress done by the indexer. The callback receives the following integers: total_objects, received_objects, local_objects, total_deltas, indexed_deltas and received_bytes.
total_objects
received_objects
local_objects
total_deltas
indexed_deltas
received_bytes
"update_tips"
Each time a reference is updated locally, this function will be called with information about it. The callback receives a string containing the name of the reference that was updated, and the two OID's a before and after b the update.
a
b
Connect to the remote. The direction can be either "fetch" or "push".
"fetch"
"push"
Disconnect the remote.
Download the remote packfile.
Save the remote to its repository's config.
Update the tips to the new status.
Check if the remote is connected.
Alessandro Ghedini <alexbio@cpan.org>
Copyright 2012 Alessandro Ghedini.
This program is free software; you can redistribute it and/or modify it under the terms of either: the GNU General Public License as published by the Free Software Foundation; or the Artistic License.
See http://dev.perl.org/licenses/ for more information.
To install Git::Raw, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Git::Raw
CPAN shell
perl -MCPAN -e shell install Git::Raw
For more information on module installation, please visit the detailed CPAN module installation guide.