API-GitForge

 view release on metacpan or  search on metacpan

COPYING  view on Meta::CPAN

 Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
 Everyone is permitted to copy and distribute verbatim copies
 of this license document, but changing it is not allowed.

                            Preamble

  The GNU General Public License is a free, copyleft license for
software and other kinds of works.

  The licenses for most software and other practical works are designed
to take away your freedom to share and change the works.  By contrast,
the GNU General Public License is intended to guarantee your freedom to
share and change all versions of a program--to make sure it remains free
software for all its users.  We, the Free Software Foundation, use the
GNU General Public License for most of our software; it applies also to
any other work released this way by its authors.  You can apply it to
your programs, too.

  When we speak of free software, we are referring to freedom, not
price.  Our General Public Licenses are designed to make sure that you
have the freedom to distribute copies of free software (and charge for
them if you wish), that you receive source code or can get it if you
want it, that you can change the software or use pieces of it in new
free programs, and that you know you can do these things.

  To protect your rights, we need to prevent others from denying you
these rights or asking you to surrender the rights.  Therefore, you have
certain responsibilities if you distribute copies of the software, or if
you modify it: responsibilities to respect the freedom of others.

  For example, if you distribute copies of such a program, whether
gratis or for a fee, you must pass on to the recipients the same
freedoms that you received.  You must make sure that they, too, receive
or can get the source code.  And you must show them these terms so they
know their rights.

  Developers that use the GNU GPL protect your rights with two steps:
(1) assert copyright on the software, and (2) offer you this License
giving you legal permission to copy, distribute and/or modify it.

  For the developers' and authors' protection, the GPL clearly explains
that there is no warranty for this free software.  For both users' and
authors' sake, the GPL requires that modified versions be marked as
changed, so that their problems will not be attributed erroneously to
authors of previous versions.

  Some devices are designed to deny users access to install or run
modified versions of the software inside them, although the manufacturer
can do so.  This is fundamentally incompatible with the aim of
protecting users' freedom to change the software.  The systematic
pattern of such abuse occurs in the area of products for individuals to
use, which is precisely where it is most unacceptable.  Therefore, we
have designed this version of the GPL to prohibit the practice for those
products.  If such problems arise substantially in other domains, we
stand ready to extend this provision to those domains in future versions
of the GPL, as needed to protect the freedom of users.

  Finally, every program is threatened constantly by software patents.
States should not allow patents to restrict development and use of
software on general-purpose computers, but in those that do, we wish to

COPYING  view on Meta::CPAN

  6. Conveying Non-Source Forms.

  You may convey a covered work in object code form under the terms
of sections 4 and 5, provided that you also convey the
machine-readable Corresponding Source under the terms of this License,
in one of these ways:

    a) Convey the object code in, or embodied in, a physical product
    (including a physical distribution medium), accompanied by the
    Corresponding Source fixed on a durable physical medium
    customarily used for software interchange.

    b) Convey the object code in, or embodied in, a physical product
    (including a physical distribution medium), accompanied by a
    written offer, valid for at least three years and valid for as
    long as you offer spare parts or customer support for that product
    model, to give anyone who possesses the object code either (1) a
    copy of the Corresponding Source for all the software in the
    product that is covered by this License, on a durable physical
    medium customarily used for software interchange, for a price no
    more than your reasonable cost of physically performing this
    conveying of source, or (2) access to copy the
    Corresponding Source from a network server at no charge.

    c) Convey individual copies of the object code with a copy of the
    written offer to provide the Corresponding Source.  This
    alternative is allowed only occasionally and noncommercially, and
    only if you received the object code with such an offer, in accord
    with subsection 6b.

COPYING  view on Meta::CPAN

an absolute waiver of all civil liability in connection with the
Program, unless a warranty or assumption of liability accompanies a
copy of the Program in return for a fee.

                     END OF TERMS AND CONDITIONS

            How to Apply These Terms to Your New Programs

  If you develop a new program, and you want it to be of the greatest
possible use to the public, the best way to achieve this is to make it
free software which everyone can redistribute and change under these terms.

  To do so, attach the following notices to the program.  It is safest
to attach them to the start of each source file to most effectively
state the exclusion of warranty; and each file should have at least
the "copyright" line and a pointer to where the full notice is found.

    <one line to give the program's name and a brief idea of what it does.>
    Copyright (C) <year>  <name of author>

    This program is free software: you can redistribute it and/or modify

bin/git-clean-forge-fork  view on Meta::CPAN

=head1 VERSION

version 0.007

=head1 SYNOPSIS

B<git clean-forge-fork> [B<--upstream=>I<REMOTE>]

=head1 DESCRIPTION

Creates a fork for proposing changes to a project hosted on a git
forge, like GitHub or GitLab.  Also configures the fork to make it
obvious that it only exists for submitting changes, so that the fork
clutters up your git forge profile a bit less.  Also adds a 'fork'
remote to which you can push your proposed changes.

=head1 OPTIONS

=over 4

=item B<--upstream=>I<REMOTE>

Specify the name of the upstream git remote, i.e., what you want to
fork.  Defaults to "origin".

bin/git-clean-forge-repo  view on Meta::CPAN

Creates repos on git forges like GitHub and GitLab, and disables all
optional features of those forges.  Useful for when you want to use
the forge only as an ordinary git host, and nothing more.

=head1 OPTIONS

=over 4

=item B<--remote=>I<REMOTE>

Specify the name of the git remote you will use to push changes to the
repository created by this script.  You should already have created
this git remote; see "EXAMPLE" below.  Defaults to "origin".

=back

=head1 EXAMPLE

=over 4

    % git init

bin/git-nuke-forge-fork  view on Meta::CPAN


version 0.007

=head1 SYNOPSIS

B<git nuke-forge-fork> [B<--upstream=>I<REMOTE>]

=head1 DESCRIPTION

Deletes forks created by git-clean-forge-fork(1).  Useful to clean up
your git forge profile after your proposed changes have been included
upstream.

=head1 OPTIONS

=over 4

=item B<--upstream=>I<REMOTE>

Specify the name of the upstream git remote, i.e., what you previously
forked.  Defaults to "origin".

lib/API/GitForge.pm  view on Meta::CPAN

domain name of that forge and the path to the repository.

    system qw(git remote add salsa https://salsa.debian.org/spwhitton/foo);
    my ($forge_domain, $forge_repo) = API::GitForge::remote_forge_info("salsa");

    say $forge_domain;          # outputs 'salsa.debian.org'
    say $forge_repo;            # outputs 'spwhitton/foo'

=head1 STATUS

Unstable.  Interface may change.

=head1 AUTHOR

Sean Whitton <spwhitton@spwhitton.name>

=head1 COPYRIGHT AND LICENSE

This software is Copyright (c) 2017, 2020 by Sean Whitton <spwhitton@spwhitton.name>.

This is free software, licensed under:

lib/API/GitForge/Role/GitForge.pm  view on Meta::CPAN

=head2 ensure_fork($upstream)

Ensure that the current user has a fork of the repo at
C<https://example.com/$upstream>, and return URI to that fork suitable
for adding as a git remote.

=head2 clean_fork($upstream)

Ensure that the current user has a fork of the repo at
C<https://example.com/$upstream>, config that fork to make it obvious
it's only there for submitting change proposals, and return URI to
fork suitable for adding as a git remote.

=head2 nuke_fork($upstream)

Delete the user's fork of the repo at
C<https://example.com/$upstream>.

=head2 clean_config_repo($repo)

Turn off optional forge features for repo at
C<https://example.com/$repo>.

=head2 clean_config_fork($upstream)

Configure user's fork of repo at C<https://example.com/$upstream> to
make it obvious that it's only there for submitting change proposals.

=head1 STATUS

Unstable.  Interface may change.

=head1 AUTHOR

Sean Whitton <spwhitton@spwhitton.name>

=head1 COPYRIGHT AND LICENSE

This software is Copyright (c) 2017, 2020 by Sean Whitton <spwhitton@spwhitton.name>.

This is free software, licensed under:

lib/App/git/clean_forge_fork.pm  view on Meta::CPAN

        $git->rev_parse({ git_dir => 1 });
    } catch {
        die "pwd doesn't look like a git repository ..\n";
    };
    #>>>
    GetOptions "upstream=s" => \$upstream;

    my ($forge_domain, $upstream_repo) = remote_forge_info $upstream;
    exit
      unless $term->ask_yn(
        prompt => "Do you want to submit changes against $upstream_repo?");

    my $forge = new_from_domain
      domain       => $forge_domain,
      access_token => forge_access_token $forge_domain;
    my $fork_uri = $forge->clean_fork($upstream_repo);
    if (grep /\Afork\z/, $git->remote) {
        $fork_uri eq ($git->remote(qw(get-url fork)))[0]
          or die "fork remote exists but has wrong URI\n";
    } else {
        $git->remote(qw(add fork), $fork_uri);



( run in 1.367 second using v1.01-cache-2.11-cpan-c333fce770f )