Jacques Germishuys > Git-Raw > Git::Raw::Remote

Download:
Git-Raw-0.50.tar.gz

Dependencies

Annotate this POD

Website

View/Report Bugs
Module Version: 0.50   Source  

NAME ^

Git::Raw::Remote - Git remote class

VERSION ^

version 0.50

SYNOPSIS ^

    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 $anonymous_remote = Git::Raw::Remote -> create_anonymous($repo, $url, undef);
    my $list = $anonymous_remote -> ls;

DESCRIPTION ^

A Git::Raw::Remote represents a Git remote.

WARNING: The API of this module is unstable and may change without warning (any change will be appropriately documented in the changelog).

METHODS ^

create( $repo, $name, $url )

Create a remote with the default fetch refspec and add it to the repository's configuration.

create_anonymous( $repo, $url, $fetch_refspec )

Create a remote in memory (anonymous).

load( $repo, $name )

Load an existing remote. Returns a Git::Raw::Remote object if the remote was found, otherwise undef.

owner( )

Retrieve the Git::Raw::Repository owning the remote.

default_branch( )

Retrieve the default branch of remote repository, that is, the branch which HEAD points to. If the remote does not support reporting this information directly, it performs the guess as git does, that is, if there are multiple branches which point to the same commit, the first one is chosen. If the master branch is a candidate, it wins. If the information cannot be determined, this function will return undef. Note, this function should only be called after the remote has established a connection.

name( )

Retrieve the name of the remote.

rename( $repo, $old_name, $new_name, [ \@problems ] )

Rename a remote. Non-default refspecs cannot be renamed and will be store in @problems if provided.

url( [ $url ] )

Retrieve the URL of the remote. If $url is passed, the remote's URL will be updated and returned.

pushurl( [ $url ] )

Retrieve the push URL for the remote. If $url is passed, the remote's push URL will be updated and returned.

add_fetch( $spec )

Add a fetch spec to the remote.

add_push( $spec )

Add a push spec to the remote.

clear_refspecs( )

Clear the remote's refspecs.

refspec_count( )

Retrieve the refspec count.

refspecs( )

Retrieve the remote's refspecs. Returns a list of Git::Raw::RefSpec objects.

ls( )

Retrieve the list of refs at the remote. Returns a hash reference where the key is the name of the reference, and the value is a hash reference containing the following values:

callbacks( \%callbacks )

fetch( )

Download new data and update tips. Convenience function to connect to a remote, download the data, disconnect and update the remote-tracking branches.

connect( $direction )

Connect to the remote. The $direction should either be "fetch" or "push".

disconnect( )

Disconnect the remote.

download( )

Download the remote packfile.

save( )

Save the remote to its repository's config.

update_tips( )

Update the tips to the new status.

is_connected( )

Check if the remote is connected.

AUTHOR ^

Alessandro Ghedini <alexbio@cpan.org>

Jacques Germishuys <jacquesg@striata.com>

LICENSE AND COPYRIGHT ^

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.

syntax highlighting: